(Better known as 3D Tic Tac Toe; I just made up a name that sounded catchy ;-) )
Let two people play this game against each other.
Specifications:
Output
the easiest way of explaining this will be with an example:
+-+-+-+-+ |X| | | | +-+-+-+-+ | |O| | | +-+-+-+-+ | | | | | +-+-+-+-+ |O| | | | +-+-+-+-+ +-+-+-+-+ | | | | | +-+-+-+-+ | |X| | | +-+-+-+-+ | | | |O| +-+-+-+-+ | | | | | +-+-+-+-+ +-+-+-+-+ | | | | | +-+-+-+-+ | |O| | | +-+-+-+-+ |O| |X| | +-+-+-+-+ | | | |X| +-+-+-+-+ +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | |X| +-+-+-+-+
in this case X has won (top left corner of layer #1 to bottom right corner of layer #2)
it is also okay to display the four layers horizontally, with one space between them
- grids may be non-text; in this case you must represent a third dimension in a reasonable way; see also scoring section below
- after each player's turn, output "{player} wins" if a player wins, "tie" if the board fills up and nobody has won, or the board if the game is not over yet (or notifiy the user of a win/tie in a reasonable way)
Input
- xyz coordinates, 0-based
example: input
031
is this location:+-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ |X| | | | +-+-+-+-+ +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+ | | | | | +-+-+-+-+
alternate between X and O, starting with X, and prompt the user with the text "{player}'s turn: "
- Winning condition
- a player wins if the player gets 4 of their symbol (X or O) in a row, horizontally, vertically, or diagonally. For example, these are all wins (in the input format I have specified) if a player has played any of them:
- 000, 001, 002, 003
- 120, 130, 100, 110
- 000, 110, 220, 330
- 300, 122, 033, 211
- Scoring
[ws]
10 base points for a working solution[gr]
+20 points if you have a graphical (meaning non-text) grid[cc]
+30 points if you can click on a cell to go there
[cp]
+20 points for building a computer player to play against[ai]
+10 to 100 points for how good the AI is (judged by me)[ot]
+15 points if you can choose between one and two player
[ex]
+3 points for each interesting or confusing thing in your code that you explain in your answer (interesting, so don't say "n++ adds one to n" and expect to get 3 points. just be reasonable.)- for example, you could say "I used
[a,b,c].map(max).sum%10
because it takes the foos and converts them into a bar, because {{insert explanation here}}, which I use to frob the baz." - if you golf part of or all of your code, you will of course find many more interesting things to explain, but golfing is not required.
- for example, you could say "I used
[wl]
+10 points for showing the winning line, for example "000 001 002 003," or highlighting the squares in some way (if you're using a GUI)- +5 points for every upvote (this is the popularity-contest part)
- downvotes don't count
- include your score in the answer by using the IDs I have placed for the bonuses
- example: 10 [ws] + 20 [gr] + 20 [cp] = 50
- don't include upvotes since those change often; I will count those myself
- I will accept the highest scored answer in one week; if a higher scored answer appears I will accept it
- if two answers tie, the earlier posted answer will win