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


const WIN=100, PLAYERS=2;
players,safeScores:=Walker.cycle([0..PLAYERS-1]), PLAYERS.pump(List(),0);
rollDie:=(1).random.fp(7);
yes,player,score,S:=T("","y"),players.next(),0,0;
tally:='wrap(player,score){ w:=safeScores[player]+=score; (w>=WIN) };
 
while(True){
   print("Player %d: (%d, %d). Rolling? (y/n) ".fmt(player+1,S,score));
   if(yes.holds(ask().strip().toLower())){
      rolled:=rollDie(); println(" Rolled a %d".fmt(rolled));
      if(rolled==1){
	 println(" Bust! You lose %d but keep %d\n".fmt(score,S));
      }else{
	 score+=rolled; 
	 if(score + S>=WIN){ tally(player,score); break; }
	 continue; 
      }
   }else{
      if(tally(player,score)) break;
      println(" Sticking with %d\n".fmt(safeScores[player]));
   }
   player,score,S=players.next(),0,safeScores[player];
}
println("\n\nPlayer %d wins with a score of %d".fmt(player+1, safeScores[player]));