My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Saturday, February 21, 2009

Yahtzee! On Line to print or simply play

You know ... sometimes in 2009 a dice based game could be an evening resolution or simply nice time to spend with somebody else.
I was out of paper and after the second try to draw manually the Yahtzee table I though: Why on earth I do not create a table to play with?

Here I am: Yahtzee! on line
You can print in landscape and reuse the paper 4 times (two tables in the front, two in the back) or to be even more green, you can simply put your green laptop in the corner of the table and play with the interactive table.
I usually play with F11 option (full screen browser), but I am not sure the automatic score is a good idea (more interesting to count manually who is winning, isn't it?)

Have fun :)

4 comments:

Alejandro Moreno said...

That's awesome, Andrea. I'll be keeping this one close by!

I'm not sure about the automatic scoring either. Maybe leave it as a checkbox close to the "New Game" button?

And just because I'm a nit-picky bastard: the singular for dice is die, the plural is dice (dices is not a word).

Thanks!

Andrea Giammarchi said...

Cheers Alejandro, i changed here (I'll change there) and I'll put the checkbox for the automatic score :)

Alejandro Moreno said...

Sorry for the double comment, but I just liked it so much I feel like I should give more feedback :)

The Yahtzee bonuses are not automatically scored, so that's kind of inconsistent.

I think there are too many mouse event handlers, and don't feel they add much to the sheet. Almost half of the sheet has set scores that are either on or off, but the mouse click doesn't really cut it for me. I think a simple

if (input > 0) boxscore = defaultscore

would be more fitting.

It would be nice if the sheet was navigatable with the arrow keys, or with Enter and Tab, like a spreadsheet.

I don't know how it's said in UK, but in Canada when you fail to get a valid score for any of your empty boxes, you have to "scratch" off the empty box of your choice. In your version, you can easily type a zero, or a slash (which gets converted to a zero) to mark this "scratch". But it would be nice if the slash stayed in the box.

Anyway, in spite of these comments, I really really like it as it is. Maybe if I have some free time I'll tinker with your code myself. :)

Andrea Giammarchi said...

Mouse events are for scores with a defaults (now counted as well when changed, cheers)

Since it is not possible to score intentionally zero and every cell has 3 status (points as number, empty as never played, 0 as "burned chance") I think this is enough.

If for Yahtzee bonus you mean the V I did not pay much attention 'cause those cells are more for printed sheets rather than game, while if you click in the bonus, you can score 100, 200, 300 or nothing.

Good suggestion the one with keys, but if I implement them I should remove mouse events.

I am not sure which will be more used, mouse events to point the cell or keyboards.

I created everything in few minutes so do not expect a perfect game, the important thing is being able to play or print, isn't it? :)