From: "trans. (T. Onoma)" Date: 2004-12-12T06:15:23+09:00 Subject: Re: [QUIZ] Learning Tic-Tac-Toe (#11) I'm up for this if I we can a get a couple day extension on the quiz. T. On Saturday 11 December 2004 02:12 pm, Hans Fugal wrote: | It would be good to be able to play against eachother when this is all | over, so I propose the following 'protocol'. It's not complicated and | probably not ready for tournament tic-tac-toe ;-), but it should do nicely. | | 3 entities - a game server and two players. The game waits for players | to connect. Upon connection the game sends an arbitrary hello line, then | the character representing this player, and the board size: | | Ruby Quiz Tic-Tac-Toe server version 1.0 | X 3x3 | | And the player responds with an arbitrary hello: | | hello my name is Juan | | When two players have joined, the game sends the current state to both | players: | | ___ ___ ___ | | | Then the game sends a message to the current player: | | move | | The player responds with an action: | | 1,1 | | The game then sends the state, or "move" again if it was an invalid move: | | ___ _X_ ___ | | game to player 2: | | move | | Player 2: | | 0,2 | | game to both: | | __O _X_ ___ | | ad nauseum. When the game is over, the game sends to the winner and | loser, respectively: | | win | lose | | The game then disconnects. | | White space is ignored, except for newlines (each message is on one | line). The game state is in row-major order. | | Attached is such a server, and you are welcome to play a running version | at fugal.net:1276. If you notice bugs please let me know - it has been | through some rudimentary testing but not exhaustive testing. -- ( o _ カラチ // trans. / \ transami@runbox.com ruby -rdrb -e 'DRb.start_service;duck=DRbObject.new(nil,"druby://whytheluckystiff.net:6503");puts duck.toms' I don't give a damn for a man that can only spell a word one way. -Mark Twain [8,16,20,29,78,65,2,14,26,12,12,28,71,114,12,13,12,82,72,21,17,4,10,2,95]. each_with_index{|x,i| $><<(x^'Begin landing your troops'[i]).chr} -Tadayoshi Funaba