Skip to content

Commit

Permalink
gitignore for .class
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopliebana authored and diegopliebana committed May 5, 2017
2 parents 7cc9771 + 00a5547 commit b7ac94e
Show file tree
Hide file tree
Showing 20 changed files with 42,177 additions and 1,276 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ out/
/build/dist/

*.ipr
*.class
1,223 changes: 0 additions & 1,223 deletions .idea/workspace.xml

This file was deleted.

22 changes: 21 additions & 1 deletion clients/GVGAI-JavaClient/src/ClientComm.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class ClientComm {

public static enum COMM_STATE {
START, INIT, INIT_END, ACT, ACT_END, ENDED, ENDED_END
START, INIT, INIT_END, ACT, ACT_END, ENDED, ENDED_END, CHOOSE
}

/**
Expand Down Expand Up @@ -130,6 +130,13 @@ private void listen() throws IOException {
writeToFile("action: " + rndAction);
writeToServer(rndAction);

}else if(commState == COMM_STATE.CHOOSE)
{
//This is the place to pick a level to be played after the initial 2 levels have gone through
Random r = new Random();
Integer message = r.nextInt(2);
writeToServer(message.toString());

}else if(commState == COMM_STATE.ENDED_END)
{
// TODO: 27/03/2017 Daniel: is the game stopped ?
Expand Down Expand Up @@ -201,6 +208,10 @@ public COMM_STATE processCommandLine() throws IOException {
game.remMillis = sso.elapsedTimer;
return COMM_STATE.ACT_END;

}else if(sso.gameState == SerializableStateObservation.State.CHOOSE_LEVEL) {
game.remMillis = sso.elapsedTimer;
return COMM_STATE.CHOOSE;

}
return commState;
}
Expand All @@ -209,6 +220,15 @@ public void processLine(String json) throws IOException{
writeToFile("initializing gson");
try {
Gson gson = new Gson();

// Debug line
//fileOutput.write(json);

if (json.equals("INIT_START")){
this.sso.gameState = SerializableStateObservation.State.INIT_STATE;
return;
}

this.sso = gson.fromJson(json, SerializableStateObservation.class);
writeToFile("gson initialized");
} catch (Exception e){
Expand Down
31 changes: 31 additions & 0 deletions debugClientLog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Listening for transport dt_socket at address: 8000
INIT_DONE
ACTION_RIGHT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_RIGHT
ACTION_RIGHT
ACTION_LEFT
ACTION_LEFT
ACTION_LEFT
ACTION_LEFT
ACTION_RIGHT
ACTION_RIGHT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_LEFT
ACTION_RIGHT
ACTION_RIGHT
ACTION_LEFT
Loading

0 comments on commit b7ac94e

Please sign in to comment.