7
(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
1
So this is in essential Qubic?
– Johannes Kuhn – 2013-12-01T20:41:51.137@JohannesKuhn I suppose; that seems to be another version of 3D tic tac toe which I mentioned in the question – Doorknob – 2013-12-01T20:42:52.957
Is the output format strict or would any readable representation of four planes suffice? – Fors – 2013-12-01T21:06:23.007
1Doesn't this make more sense as a code-challenge? In code golf, there will be so many parameters (with 1 letter names) that the code will be unreadable. – DavidC – 2013-12-01T21:10:14.313
@Fors No, the output must be in that format. – Doorknob – 2013-12-01T21:28:17.180
@David Maybe; if this process to be too unreadable or difficult as a code golf, I might make it a coffee challenge (but then I would have to make it a bit harder... ;-) ) – Doorknob – 2013-12-01T21:30:24.670
@DavidCarraher I made it a [tag:code-challenge] – Doorknob – 2013-12-01T23:04:08.763
Good idea. Hopefully you'll have several attempts. – DavidC – 2013-12-01T23:13:51.107
@Doorknob you talk about a graphical grid; if we do that, do we need to allow textual input? – Justin – 2013-12-02T05:59:18.230
@Doorknob So far, the program looks huge (and I'm not near finished...). ~250 lines. I've never seen an answer on this stackexchange site that large. – Justin – 2013-12-02T07:31:34.137
1
@Quincunx http://codegolf.stackexchange.com/questions/4838/most-complex-hello-world-program-you-can-justify :P
– Doorknob – 2013-12-02T13:07:39.840@Quincunx You can allow textual input, or you can allow input by clicking a square to go there (by the
[cc]
bonus, you would get 30 extra points for that) – Doorknob – 2013-12-02T13:08:27.940can I not output anything if the game is not finished? Also, can I choose what form to output "wins" or "ties"? – Justin – 2013-12-03T08:17:00.117