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


 
class
	PLAYER
create
	set_name
feature
	set_name(n:STRING)
		do
			name := n.twin
			set_points(0)
		end
 
	strategy(cur_points:INTEGER)
		local
			current_points, thrown:INTEGER
		do
			io.put_string ("You currently have " +points.out+". %NDo you want to save your points? Press y or n.%N")
			io.read_line
			if io.last_string.same_string ("y") then
				set_points(cur_points)
			else
				io.put_string ("Then throw again.%N")
				thrown:=throw_dice
				if thrown= 1 then
					io.put_string("You loose your points%N")
				else
					strategy(cur_points+thrown)
				end
			end
 
		end
	set_points (value:INTEGER)
		require
			value_not_neg: value >= 0
		do
			points := points + value
		end
 
	random: V_RANDOM
			-- Random sequence.
		once
			create Result
		end
	throw_dice: INTEGER
	        do
		        random.forth
	         	Result := random.bounded_item (1, 6)
	        end
 
	name: STRING
	points: INTEGER
end
 