package mille.bean;

import java.util.ArrayList;
import java.lang.Character;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

public class MilleBean {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Deck milleDeck = new Deck();
        milleDeck.shuffle();
        
        // TODO: get player name
        String playerName = "";
        String computerPlayer1Name = "";
        String computerPlayer2Name = "";
        String computerPlayer3Name = "";
        
        HumanPlayer humanPlayer = new HumanPlayer(playerName);
        ComputerPlayer computerPlayer1 = new ComputerPlayer(computerPlayer1Name);
        ComputerPlayer computerPlayer2 = new ComputerPlayer(computerPlayer2Name);
        ComputerPlayer computerPlayer3 = new ComputerPlayer(computerPlayer3Name);
        
        ArrayList<Player> players = new ArrayList<>();
        
        players.add(humanPlayer);
        players.add(computerPlayer1);
        players.add(computerPlayer2);
        players.add(computerPlayer3);
        
        createDisplay();
        
        // MAIN LOOP
        while (!Display.isCloseRequested())
        { 
            Display.update();
            
            computerPlayer1.makePlay();
            Display.update();
            computerPlayer2.makePlay();
            Display.update();
            computerPlayer3.makePlay();

            int cardNumber = -1;
            int playerNumber = -1;
            
            boolean cardNumberObtained = false;
            boolean bothNumbersObtained = false;
            
            while (!bothNumbersObtained)
            {
                while (Keyboard.next())
                {
                    char character = Keyboard.getEventCharacter();

                    // character has a numeric representation
                    if (Character.getNumericValue(character) > 0)
                    {
                        if (!cardNumberObtained)
                        {
                            cardNumber = Character.getNumericValue(character);
                            cardNumberObtained = true;
                        }
                        else
                        {
                            playerNumber = Character.getNumericValue(character);
                            bothNumbersObtained = true;
                        }
                    }
                }
            }
            
            System.out.println("Card number:" + cardNumber);
            System.out.println("Player number: " + playerNumber);
        }
        
        // end
        Display.destroy();
    }
    
    public static boolean isGameOver(Deck deck, ArrayList<Player> players)
    {
        if (deck.isEmpty())
        {
            return true;
        }
        else if(/*game conditions*/ false)
        {
            return true;
        }
        
        return true;
    }
    
    public static void createDisplay()
    {
        try
        {
            Display.setDisplayMode(new DisplayMode(800, 600));
            Display.create();
        }
        catch (LWJGLException e)
        {
            e.printStackTrace();
            System.exit(0);
        }
    }
}
@@ -46,36 +46,8 @@
 st;%0A
-import java.lang.Character;%0A
 impo
@@ -1652,430 +1652,8 @@
    %0A
-            while (!bothNumbersObtained)%0A            %7B%0A                while (Keyboard.next())%0A                %7B%0A                    char character = Keyboard.getEventCharacter();%0A%0A                    // character has a numeric representation%0A                    if (Character.getNumericValue(character) %3E 0)%0A                    %7B%0A                        if (!cardNumberObtained)%0A                        %7B%0A                
     
@@ -1677,62 +1677,26 @@
 r = 
-Character.
 getNum
+b
 er
-icValue(character);%0A                
+Input();%0A
     
@@ -1746,93 +1746,9 @@
     
-     
-       %7D
 %0A
-                        else%0A                        %7B%0A                
     
@@ -1774,62 +1774,26 @@
 r = 
-Character.
 getNum
+b
 er
-icValue(character);%0A                
+Input();%0A
     
@@ -1834,98 +1834,8 @@
 ;%0A  
-                      %7D%0A                    %7D%0A                %7D%0A            %7D%0A            
 %0A   
@@ -2603,9 +2603,523 @@
 %7D%0A    %7D%0A
+    %0A    public static int getNumberInput()%0A    %7B%0A        // Keyboard.next() belongs somewhere in here%0A        int numberValue = -1;%0A        while (numberValue %3C 0)%0A        %7B%0A            char eventCharacter = Keyboard.getEventCharacter();%0A%0A            // if character has a numeric representation%0A            if (Character.getNumericValue(eventCharacter) %3E 0)%0A            %7B%0A                numberValue = Character.getNumericValue(eventCharacter);%0A            %7D%0A        %7D%0A        %0A        return numberValue;%0A    %7D%0A
 %7D

rename method to makePlay()