An n-dimensional m-layer noughts and crosses game
Here is an example of a 3x3x2 board played on the command line:
The Python CLI implementation depends on Python 3.6+ and no external dependencies.
It can be run with: python3 run.py
- Copy the entire board.js file into a javascript interpreter (e.g. the chrome console).
- Create a board
let board = create_board();
- Draw the board to see current status
board.draw_board()
- Perform a move
board.perform_move(player, coords)
The arguments for the perform_move function are:
- player - single-character represtation of a player e.g. 'O', 'X', or use undefined to perform a dry-run to check if the move is valid
- coords - list of coordindate tuples from top layer to bottom
It iterates through coords returning False if selected cell has an owner, otherwise iterates a layer deeper. If coords is empty, the owner of the board is set to player (even if not at layer 0).
There are currently some very basic 'tests' for the Python CLI implementation, which is really just an example of exercising the main APIs!
Run with: python3 test.py