| 1 | // Additional test for the other diagonal win | |
| 2 | import { gamestate } from './main.js'; | |
| 3 | ||
| 4 | // Test the other diagonal win (top-right to bottom-left) | |
| 5 | console.log('Testing other diagonal win:'); | |
| 6 | const otherDiagonalWin = [ | |
| 7 | 'O X', | |
| 8 | ' XO', | |
| 9 | 'X ' | |
| 10 | ]; | |
| 11 | ||
| 12 | console.log('Board:'); | |
| 13 | console.log(otherDiagonalWin); | |
| 14 | ||
| 15 | // Check diagonal positions manually | |
| 16 | console.log('Other diagonal positions:'); | |
| 17 | console.log(`[0,2]: ${otherDiagonalWin[0][2]}`); | |
| 18 | console.log(`[1,1]: ${otherDiagonalWin[1][1]}`); | |
| 19 | console.log(`[2,0]: ${otherDiagonalWin[2][0]}`); | |
| 20 | ||
| 21 | console.log(`Are they equal and not space? ${otherDiagonalWin[0][2] !== ' ' && otherDiagonalWin[0][2] === otherDiagonalWin[1][1] && otherDiagonalWin[1][1] === otherDiagonalWin[2][0]}`); | |
| 22 | ||
| 23 | try { | |
| 24 | console.log('Result:', gamestate(otherDiagonalWin)); | |
| 25 | } catch (error) { | |
| 26 | console.log('Error:', error.message); | |
| 27 | } | |
| 28 | ||
| 29 | // Test horizontal win | |
| 30 | console.log('\nTesting horizontal win:'); | |
| 31 | const horizontalWin = [ | |
| 32 | 'XXX', | |
| 33 | 'O O', | |
| 34 | ' ' | |
| 35 | ]; | |
| 36 | ||
| 37 | try { | |
| 38 | console.log('Result:', gamestate(horizontalWin)); | |
| 39 | } catch (error) { | |
| 40 | console.log('Error:', error.message); | |
| 41 | } |
| Test Name | Status |
|---|---|
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.