#!/usr/bin/perl # (c) 2005, Ward Cunningham # Made available under EPL 1.0 # http://www.opensource.org/licenses/eclipse-1.0.txt use strict; print "Content-type: text/html\n\n"; print <<"";
"; my $dice = ($chips[$p] < 3) ? $chips[$p] : 3; my ($l, $r) = (($p-1)%@chips, ($p+1)%@chips); for (1 .. $dice) { my @faces = ('L', 'R', 'C', 'S', 'C', '*'); for ($faces[int(rand()*@faces)]) { print; $chips[$p]-- if /[LRC]/; $chips[$l]++ if /L/; $chips[$r]++ if /R/; $chips++ if /C/; do {my $h = int (($chips+1)/2); $chips[$p]+=$h; $chips-=$h} if /S/; } } my $color = $chips >= (2 * @chips) ? '#ffffaa' : 'ffffff'; print " | ", map ("$_ ", @chips), " | $chips \n"; last play if grep ($_, @chips) == 1; } } my $more = @chips+1; print <<""; |
Each refresh plays one game inspired by l-c-r.
Columns show each player's roll followed by all player's chips and the center pot after that roll.
Try more players.
View the source.
This variation adds S for split-the-pot. We play this as if dice are rolled and played one at a time. Unlike the unmodified game, the pot can now both grow and shrink. We highlight the pot whenever it holds 2/3 of the original chips. |