<commit_before>package ttt;

import java.util.Scanner;

public class Game {
	TTT ttt;
	Scanner keyboardSc;
	int winner = 0;
	int player = 1;

	public Game() {
		ttt = new TTT();
		keyboardSc = new Scanner(System.in);
	}

	public int readPlay() {
		int play;
		do {
			System.out.printf("\nPlayer %d, please enter the number of the square "
							+ "where you want to place your %c (or 0 to refresh the board): \n",
							player, (player == 1) ? 'X' : 'O');
			play = keyboardSc.nextInt();
		} while (play > 9 || play < 0);
		return play;
	}

	public void playGame() {
		int play;
		boolean playAccepted;

		do {
			player = ++player % 2;
			do {
				System.out.println(ttt.currentBoard());
				play = readPlay();
				if (play != 0) {
					playAccepted = ttt.play( --play / 3, play % 3, player);
					if (!playAccepted)
						System.out.println("Invalid play! Try again.");
				} else
					playAccepted = false;
			} while (!playAccepted);
			winner = ttt.checkWinner();
		} while (winner == -1);
	}

	public void congratulate() {
		if (winner == 2)
			System.out.printf("\nHow boring, it is a draw\n");
		else
			System.out.printf(
					"\nCongratulations, player %d, YOU ARE THE WINNER!\n",
					winner);
	}

//	public static void main(String[] args) {
//		Game g = new Game();
//		g.playGame();
//		g.congratulate();
//	}
}

//package ttt;
//
//import java.rmi.RemoteException;
//import java.util.Scanner;
//
//public class Game {
//	TTT ttt;
//	Scanner keyboardSc;
//	int winner = 0;
//	int player = 1;
//
//	public Game() {
//		try {
//			ttt = new TTT();
//		} catch (RemoteException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//		keyboardSc = new Scanner(System.in);
//	}
//
//	public int readPlay() {
//		int play;
//		do {
//			System.out.printf("\nPlayer %d, please enter the number of the square "
//							+ "where you want to place your %c (or 0 to refresh the board): \n",
//							player, (player == 1) ? 'X' : 'O');
//			play = keyboardSc.nextInt();
//		} while (play > 9 || play < 0);
//		return play;
//	}
//
//	public void playGame() {
//		int play;
//		boolean playAccepted;
//
//		do {
//			player = ++player % 2;
//			do {
//				System.out.println(ttt.currentBoard());
//				play = readPlay();
//				if (play != 0) {
//					playAccepted = ttt.play( --play / 3, play % 3, player);
//					if (!playAccepted)
//						System.out.println("Invalid play! Try again.");
//				} else
//					playAccepted = false;
//			} while (!playAccepted);
//			winner = ttt.checkWinner();
//		} while (winner == -1);
//	}
//
//	public void congratulate() {
//		if (winner == 2)
//			System.out.printf("\nHow boring, it is a draw\n");
//		else
//			System.out.printf(
//					"\nCongratulations, player %d, YOU ARE THE WINNER!\n",
//					winner);
//	}
///**
//	public static void main(String[] args) {
//		Game g = new Game();
//		g.playGame();
//		g.congratulate();
//	}
//	*/
//}<commit_msg>[FIXME] Code Error<commit_after>package ttt;

import java.util.Scanner;
import java.rmi.RemoteException;

public class Game {
	TTT ttt;
	Scanner keyboardSc;
	int winner = 0;
	int player = 1;

	public Game() {
		try {
		ttt = new TTT();
		//keyboardSc = new Scanner(System.in);
		} catch (RemoteException e) {
			e.printStackTrace();
		}	
		keyboardSc = new Scanner(System.in);
	}

	public int readPlay() {
		int play;
		do {
			System.out.printf("\nPlayer %d, please enter the number of the square "
							+ "where you want to place your %c (or 0 to refresh the board): \n",
							player, (player == 1) ? 'X' : 'O');
			play = keyboardSc.nextInt();
		} while (play > 9 || play < 0);
		return play;
	}

	public void playGame() {
		int play;
		boolean playAccepted;

		do {
			player = ++player % 2;
			do {
				System.out.println(ttt.currentBoard());
				play = readPlay();
				if (play != 0) {
					playAccepted = ttt.play( --play / 3, play % 3, player);
					if (!playAccepted)
						System.out.println("Invalid play! Try again.");
				} else
					playAccepted = false;
			} while (!playAccepted);
			winner = ttt.checkWinner();
		} while (winner == -1);
	}

	public void congratulate() {
		if (winner == 2)
			System.out.printf("\nHow boring, it is a draw\n");
		else
			System.out.printf(
					"\nCongratulations, player %d, YOU ARE THE WINNER!\n",
					winner);
	}
}
{'fraction_non_alphanumeric': 0.17938576081898558, 'fraction_numerical': 0.00837598883201489, 'mean_word_length': 2.420047732696897, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4144948', 'n_tokens_mistral': 1849, 'n_tokens_neox': 1584, 'n_words': 438}