Changed initial state to 'playing', so that we don't assume a broken connection is automatically a lost game.

This commit is contained in:
Elf M. Sternberg 2013-12-04 00:44:11 -08:00
parent 3bfc87f44a
commit 0de8d83595
2 changed files with 9 additions and 4 deletions

View File

@ -6,7 +6,12 @@ this in Bacon, but my Bacon is pretty raw. At best, I could
propertize the cards to create a new card (i.e. a new state) every
time a ball came in, but that seemed a little overwrought.
I'm sad that it requires underscore, but Node's native reduce doesn't
support object iteration, only arrays.
It was nice to have an opportunity to hack Coffee and Node again.
I don't know that I trust Yahoo's server. At least once I got back a
"you lost" signal from the server. Since this client includes full
playback of every game, I could see that I had clearly won.
Unfortunately, my initial code assumed "lost" as the default state, so
I couldn't see if maybe the 'won' signal was lost before receiving the
disconnect. I've changed that to 'playing,' so we can see that
condition now.

View File

@ -4,7 +4,7 @@ io = require "socket.io-client"
bingo = ["B", "I", "N", "G", "O"]
coors = [0..4]
state = "lost"
state = "playing"
snum = (n) -> if n < 10 then " #{n}" else "#{n}"
fnum = (j) -> if j.found then "[#{snum(j.n)}]" else " #{snum(j.n)} "