The   game of Pig   is a multiplayer game played with a single six-sided die.   The
object of the game is to reach   100   points or more.  
Play is taken in turns.   On each person's turn that person has the option of either:

 Rolling the dice:   where a roll of two to six is added to their score for that turn and the player's turn continues as the player is given the same choice again;   or a roll of   1   loses the player's total points   for that turn   and their turn finishes with play passing to the next player.
 Holding:   the player's score for that round is added to their total and becomes safe from the effects of throwing a   1   (one).   The player's turn finishes with play passing to the next player.


Task

Create a program to score for, and simulate dice throws for, a two-person game.



Related task

   Pig the dice game/Player


include lib/choose.4th
include lib/yesorno.4th
 
: turn                                 ( n1 -- n2)
  ." Player " . ." is up" cr           \ which player is up
  0 begin                              \ nothing so far
    s" Rolling" yes/no?                \ stand or roll?
  while                                \ now roll the dice
    6 choose 1+ dup ." Rolling " . dup 1 =
    if drop drop 0 else + ." (" dup 0 .r ." )" then cr dup 0=
  until                                \ until player stands or 1 is rolled
;
 
: pigthedice                           ( --)
  2 0 1 over                           \ setup players
  begin over turn + dup ." Total score: " . cr cr dup 100 < while 2swap repeat
  ." Player " swap . ." won with " . ." points." cr
  ." Player " swap . ." lost with " . ." points." cr
;                                      \ show the results
 
pigthedice