Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cking20 authored and LandonPatmore committed Apr 2, 2018
1 parent b4a9e68 commit ebaecbe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ private GameManager(){
//SocketManager.getInstance().setUpEvents();
ConnectSocket();
setUpEvents();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
for(int i = 0; i < 4; i++){
theAIs[i] = new AI();
thePlayers[i] = theAIs[i];
Expand Down
10 changes: 7 additions & 3 deletions Server Frontend/core/src/com/csc480/game/Engine/Model/AI.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ private void removeTilesFromHand(PlayIdea p){

public boolean connectSocket(){
try{
mySocket = IO.socket("http://localhost:3000");
IO.Options opts = new IO.Options();
opts.forceNew = true;
mySocket = IO.socket("http://localhost:3000",opts);
mySocket.connect();
socketEvents();
//emit to server that AI has connected.
Expand Down Expand Up @@ -209,12 +211,14 @@ public void call(Object... args) {
System.out.println(data.toString());
boolean myTurn = data.getBoolean("isTurn");
//reconnect an AI
System.out.println(myTurn);
if (myTurn) {
/*
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}*/
myCache.Clear();
TESTFindPlays(GameManager.getInstance().theBoard);
state = 1;
Expand Down Expand Up @@ -327,7 +331,7 @@ public void TESTFindPlays(Board boardState){
//NEED TO ADD A PLAY IDEA TO THE QUEUE/////////////////////////////////////////////////////////////////////////////////////////////////////////
} else{
//SKIP MY TURN AND REDRAW//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//System.err.println("should skip anf get new tiles");
System.err.println("should skip and get new tiles");
}
}

Expand Down

0 comments on commit ebaecbe

Please sign in to comment.