tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,18 @@
DynamicModule[{score, players = {1, 2}, roundscore = 0,
roll}, (score@# = 0) & /@ players;
Panel@Dynamic@
Column@{Grid[
Prepend[{#, score@#} & /@ players, {"Player", "Score"}],
Background -> {None, 2 -> Gray}], roundscore,
If[ValueQ@roll, Row@{"Rolled ", roll}, ""],
If[IntegerQ@roundscore,
Row@{Button["Roll", roll = RandomInteger[{1, 6}];
If[roll == 1, roundscore = 0; players = RotateLeft@players,
roundscore += roll]],
Button["Hold", score[players[[1]]] += roundscore;
roundscore = 0;
If[score[players[[1]]] >= 100, roll =.;
roundscore = Row@{players[[1]], " wins."},
players = RotateLeft@players]]},
Button["Play again.",
roundscore = 0; (score@# = 0) & /@ players]]}]