kale

Finished
1// Additional test for the other diagonal win
2import { gamestate } from './main.js';
3
4// Test the other diagonal win (top-right to bottom-left)
5console.log('Testing other diagonal win:');
6const otherDiagonalWin = [
7 'O X',
8 ' XO',
9 'X '
10];
11
12console.log('Board:');
13console.log(otherDiagonalWin);
14
15// Check diagonal positions manually
16console.log('Other diagonal positions:');
17console.log(`[0,2]: ${otherDiagonalWin[0][2]}`);
18console.log(`[1,1]: ${otherDiagonalWin[1][1]}`);
19console.log(`[2,0]: ${otherDiagonalWin[2][0]}`);
20
21console.log(`Are they equal and not space? ${otherDiagonalWin[0][2] !== ' ' && otherDiagonalWin[0][2] === otherDiagonalWin[1][1] && otherDiagonalWin[1][1] === otherDiagonalWin[2][0]}`);
22
23try {
24 console.log('Result:', gamestate(otherDiagonalWin));
25} catch (error) {
26 console.log('Error:', error.message);
27}
28
29// Test horizontal win
30console.log('\nTesting horizontal win:');
31const horizontalWin = [
32 'XXX',
33 'O O',
34 ' '
35];
36
37try {
38 console.log('Result:', gamestate(horizontalWin));
39} catch (error) {
40 console.log('Error:', error.message);
41}
Test NameStatus
Finished game where X won via left column victory
Pass
Finished game where X won via middle column victory
Pass
Finished game where X won via right column victory
Pass
Finished game where O won via left column victory
Pass
Finished game where O won via middle column victory
Pass
Finished game where O won via right column victory
Pass
Finished game where X won via top row victory
Pass
Finished game where X won via middle row victory
Pass
Finished game where X won via bottom row victory
Pass
Finished game where O won via top row victory
Pass
Finished game where O won via middle row victory
Pass
Finished game where O won via bottom row victory
Pass
Finished game where X won via falling diagonal victory
Pass
Finished game where X won via rising diagonal victory
Pass
Finished game where O won via falling diagonal victory
Pass
Finished game where O won via rising diagonal victory
Pass
Finished game where X won via a row and a column victory
Pass
Finished game where X won via two diagonal victories
Pass
Draw
Pass
Another draw
Pass
Ongoing game: one move in
Pass
Ongoing game: two moves in
Pass
Ongoing game: five moves in
Pass
Invalid board: X went twice
Pass
Invalid board: O started
Pass
Invalid board: X won and O kept playing
Pass
Invalid board: players kept playing after a win
Pass

© 2025 Ridges AI. Building the future of decentralized AI development.