R
Ruby Quiz
The three rules of Ruby Quiz:
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
by Pat Eyler
My kids like to play a variant of "Cows and Bulls" when we're driving. One of
them (the server, to use a computing term -- you'll see why in a minute) will
think of a word (we usually play with either three or four letters), and the
other (the client) will try to guess it. With each guess, the server will
respond with the number of 'cows' (letters in the word, but not in the right
place) and bulls (letters in the correct place in the word).
Here's a short example:
Server: (thinks of the word cow) I'm thinking of a three letter word.
Client: cab
Server: 0 cows and 1 bull
Client: cat
Server: 0 cows and 1 bull
Client: cot
Server: 0 cows and 2 bulls
Client: cow
Server: That's right!
This weeks quiz has a couple of flavors:
1) You can write a server that will play our version of "Cows and Bulls". It
should follow a simplified version of the above, and look like:
Server: 3 # the number of letters in the word
Client: "cab"
Server: "0 1"
Client: "cat"
Server: "0 1"
Client: "cot"
Server: "0 2"
Client: "cow"
Server: 1 # indicating success
2) You should write also write a client that a player can interact with to play
the game.
3) You can also write a player that will interact with the server and play a
game.
1. Please do not post any solutions or spoiler discussion for this quiz until
48 hours have passed from the time on this message.
2. Support Ruby Quiz by submitting ideas as often as you can:
http://www.rubyquiz.com/
3. Enjoy!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
by Pat Eyler
My kids like to play a variant of "Cows and Bulls" when we're driving. One of
them (the server, to use a computing term -- you'll see why in a minute) will
think of a word (we usually play with either three or four letters), and the
other (the client) will try to guess it. With each guess, the server will
respond with the number of 'cows' (letters in the word, but not in the right
place) and bulls (letters in the correct place in the word).
Here's a short example:
Server: (thinks of the word cow) I'm thinking of a three letter word.
Client: cab
Server: 0 cows and 1 bull
Client: cat
Server: 0 cows and 1 bull
Client: cot
Server: 0 cows and 2 bulls
Client: cow
Server: That's right!
This weeks quiz has a couple of flavors:
1) You can write a server that will play our version of "Cows and Bulls". It
should follow a simplified version of the above, and look like:
Server: 3 # the number of letters in the word
Client: "cab"
Server: "0 1"
Client: "cat"
Server: "0 1"
Client: "cot"
Server: "0 2"
Client: "cow"
Server: 1 # indicating success
2) You should write also write a client that a player can interact with to play
the game.
3) You can also write a player that will interact with the server and play a
game.