// Arup Guha
// 1/28/2026
// Marble Game Practice Question for COP 3330 Quiz Review

import java.util.*;

public class marblegame {

	final public static int START = 32;
	
	public static void main(String[] args) {
		
		Scanner stdin = new Scanner(System.in);
		int playerNo = 1;
		int numMarbles = START;
		
		// We always play one turn.
		do {
		
			// Prompt current player, for this exercise, no error checking.
			System.out.println("There are currently "+numMarbles+" number of marbles.");
			System.out.println("Player number "+playerNo+" how many marbles do you want to take, 1, 2 or 3?");
			int take = stdin.nextInt();
			
			// Update this.
			numMarbles -= take;
			
			// Don't switch the player number!
			if (numMarbles <= 0) break;
			
			// Lots of ways to do this. Switch the player number.
			playerNo = 3 - playerNo;
		
		} while (numMarbles > 0);
		
		// Ending message.
		System.out.println("Player number "+playerNo+" wins by taking the last marble!");
	}
}