Pig the dice game/Player

You are encouraged to solve this task according to the task description, using any language you may know.
Task

Create a dice simulator and scorer of Pig the dice game and add to it the ability to play the game to at least one strategy.

 State here the play strategies involved.
 Show play during a game here.


As a stretch goal:

 Simulate playing the game a number of times with two players of given strategies and report here summary statistics such as, but not restricted to, the influence of going first or which strategy seems stronger.


Game Rules

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 one. The player's turn finishes with play passing to the next player.


References
 Pig (dice)
 The Math of Being a Pig and Pigs (extra) - Numberphile videos featuring Ben Sparks.


 
Module GamePig (games, strategy1, strategy2) {
      Print "Game of Pig"
      win1=0
      win2=0
      While games {
            games--
            dice=-1
            res$=""
            Player1points=0
            Player1sum=0
            Player2points=0
            Player2sum=0
            HaveWin=False
            score()
            \\ for simulation
            simulate$=String$("R", 500)
            Keyboard simulate$
            \\ end simulation
            while res$<>"Q" {
                  Print "Player 1 turn"
                  PlayerTurn(&Player1points, &player1sum, player2sum, ! strategy1)
                  if res$="Q" then exit
                  Player1sum+=Player1points
                  Score()
                  Print "Player 2 turn"
                  PlayerTurn(&Player2points,&player2sum, player1sum, ! strategy2)
                  if res$="Q" then exit
                  Player2sum+=Player2points
                  Score()
            }
            If HaveWin then {
                  Score()
                  If Player1Sum>Player2sum then {
                        Print "Player 1 Win"
                        win1++
                  } Else Print "Player 2 Win" : win2++
            }
      }
      \\ use stack as FIFO
      If win1>win2 Then {
            Data "Player 1 Win", win1,win2, array(strategy1,0), array(strategy1,1)
      } Else {
            Data "Player 2 Win",  win2,win1, array(strategy2,0), array(strategy2,1)
      }
 
      Sub Rolling()
            dice=random(1,6)
            Print "dice=";dice
      End Sub
      Sub PlayOrQuit()
            Print "R - Roling Q-Quit"
            Repeat {
                  res$=Ucase$(Key$)
            } Until Instr("RQ", res$)>0
      End Sub
      Sub PlayAgain()
            Print "R - Roling H - Hold Q-Quit"
            Repeat {
                  res$=Ucase$(Key$)
            } Until Instr("RHQ", res$)>0
      End Sub
      Sub PlayerTurn(&playerpoints, &sum, othersum, Max_Points, Min_difference)
            PlayOrQuit()
            If res$="Q" then Exit Sub
            playerpoints=0
            Rolling()
            While dice<>1 and res$="R" {
                  playerpoints+=dice
                  if dice>1 and playerpoints+sum>100 then {
                        sum+=playerpoints
                        HaveWin=True
                        res$="Q"
                  } Else {
                        if playerpoints>=Max_Points Then If 100-othersum>Min_difference Then res$="H" : exit
                        PlayAgain()
                        if res$="R" then Rolling()
                  }
            }
            if dice=1 then playerpoints=0
      End Sub
      Sub Score()
            Print "Player1 points="; Player1sum
            Print "Player2 points="; Player2sum
      End Sub     
}
Flush
GamePig 20, (8,10), (12, 20)
GamePig 20, (12, 20), (8,10)
Print "Results"
While not Empty {
      Read WhoWin$, winA,winb, Max_Points, Min_difference
      Print WhoWin$, winA;">";winb, Max_Points, Min_difference
}
 
 
 