public static void main(String[] args) throws Exception {
		frame = new GUI(7);
		frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setResizable(true);
		frame.setLocationRelativeTo(null);
		frame.setVisible(true);

		//While loop secures that the application will never terminate (all by
		//itself).
		while(true) {
			//Check whether there are any empty fields left. If so, continue 
			//play.
			while(numberOfMove < totalNumberOfMoves) {
				System.out.println("Player " + players[currentIndex].getType() + "thinks");
				if(players[currentIndex].getType().equals("[AI] Monte-Carlo")) {
					//Monte-Carlo AI to play.
					
					Tuple<Integer, Integer> move;
					
					MonteCarlo mc = new MonteCarlo(
							board.duplicate(), 
							players[currentIndex].getColor(), 
							numberOfMove, 
							totalNumberOfMoves);

					//Get a new move.
					move = mc.uct(
							players[currentIndex].getSimulationNumber());

					//Perform the move on the board.
					board.makeMove(move, players[currentIndex].getColor());
					((GUI) frame).placeStone(
							move.getSecondElement(), 
							move.getFirstElement(), 
							players[currentIndex].getColor());

					//Increment number of currently made moves.
					++numberOfMove;

					//Adjust index of current player.
					currentIndex = (currentIndex + 1) % 2;
				} else if(players[currentIndex].getType().equals("[AI] MCTS Gibbs")) {
					//Gibbs (Boltzmann) AI to play.
					
					Tuple<Integer, Integer> move;
					
					MonteCarloH5Boltzmann mc = new MonteCarloH5Boltzmann(
							board.duplicate(), 
							players[currentIndex].getColor(), 
							numberOfMove, 
							totalNumberOfMoves);

					//Get a new move.
					move = mc.uct(
							players[currentIndex].getSimulationNumber());

					//Perform the move on the board.
					board.makeMove(move, players[currentIndex].getColor());
					((GUI) frame).placeStone(
							move.getSecondElement(), 
							move.getFirstElement(), 
							players[currentIndex].getColor());

					//Increment number of currently made moves.
					++numberOfMove;

					//Adjust index of current player.
					currentIndex = (currentIndex + 1) % 2;
				} else if(players[currentIndex].getType().equals("[AI] Charles")) {
					//Charles AI to play.
					
					Charles_2 charles = new Charles_2(players[currentIndex].getColor(), board);
					
					//Get a new move.
					Tuple<Integer, Integer> move = charles.getMove();
					
					//Perform the move on the board.
					board.makeMove(move, players[currentIndex].getColor());
					((GUI) frame).placeStone(
							move.getSecondElement(), 
							move.getFirstElement(), 
							players[currentIndex].getColor());

					//Increment number of currently made moves.
					++numberOfMove;

					//Adjust index of current player.
					currentIndex = (currentIndex + 1) % 2;
				} else if(players[currentIndex].getType().equals("[AI] MCTS Beam")) {
					//Beam Search agent to play.
					
					Tuple<Integer, Integer> move;

					MonteCarloH5 mc = new MonteCarloH5(
							board.duplicate(), 
							players[currentIndex].getColor(), 
							numberOfMove, 
							totalNumberOfMoves);

					//Get a new move.
					move = mc.uct(
							players[currentIndex].getSimulationNumber());

					//Perform the move on the board.
					board.makeMove(move, players[currentIndex].getColor());
					((GUI) frame).placeStone(
							move.getSecondElement(), 
							move.getFirstElement(), 
							players[currentIndex].getColor());

					//Increment number of currently made moves.
					++numberOfMove;

					//Adjust index of current player.
					currentIndex = (currentIndex + 1) % 2;
					
				}
			} //End of the while loop.
			
			//At this point the game is finished.
			System.out.println("The game has finished."); //It's not necessary.
			
			//Calculate the score and inform the user.
			if(GUI.gameOver) {
				if(Rules.calculateScore(board).equals("0")) {
					JOptionPane.showMessageDialog(null, "Draw");					
				} else {
					String winner = (Rules.calculateScore(board).equals(players[0].getColor()) ? players[0].getName() : players[1].getName());
					JOptionPane.showMessageDialog(null, "The winner is " + winner); 
				}
			}
			GUI.gameOver = false;
		}

	}