Skip to content

Commit

Permalink
Added and removed classes based on the class diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenttrinh3336 committed Apr 1, 2024
1 parent 07547d6 commit f1f6ede
Show file tree
Hide file tree
Showing 26 changed files with 295 additions and 305 deletions.
26 changes: 12 additions & 14 deletions src/main/java/uta/cse3310/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,14 @@ public class App extends WebSocketServer {

// All games currently underway on this server are stored in
// the vector ActiveGames
private Vector<Game> ActiveGames = new Vector<Game>();
//private Vector<Game> ActiveGames = new Vector<Game>();

private int GameId = 1;

private int connectionId = 0;

private Instant startTime;

private Statistics stats;

public App(int port) {
super(new InetSocketAddress(port));
}
Expand All @@ -88,15 +86,15 @@ public App(int port, Draft_6455 draft) {

@Override
public void onOpen(WebSocket conn, ClientHandshake handshake) {

/*
connectionId++;
System.out.println(conn.getRemoteSocketAddress().getAddress().getHostAddress() + " connected");
ServerEvent E = new ServerEvent();
ServerEvent E = new ServerEvent(); */

// search for a game needing a player
Game G = null;
/*Game G = null;
for (Game i : ActiveGames) {
if (i.Players == uta.cse3310.PlayerType.XPLAYER) {
G = i;
Expand Down Expand Up @@ -146,20 +144,20 @@ public void onOpen(WebSocket conn, ClientHandshake handshake) {
System.out
.println("< " + Duration.between(startTime, Instant.now()).toMillis() + " " + "*" + " " + escape(jsonString));
broadcast(jsonString);

*/
}

@Override
public void onClose(WebSocket conn, int code, String reason, boolean remote) {
System.out.println(conn + " has closed");
/* System.out.println(conn + " has closed");
// Retrieve the game tied to the websocket connection
Game G = conn.getAttachment();
G = null;
G = null; */
}

@Override
@Override
public void onMessage(WebSocket conn, String message) {
System.out
/*System.out
.println("< " + Duration.between(startTime, Instant.now()).toMillis() + " " + "-" + " " + escape(message));
// Bring in the data from the webpage
Expand All @@ -169,7 +167,7 @@ public void onMessage(WebSocket conn, String message) {
UserEvent U = gson.fromJson(message, UserEvent.class);
// Update the running time
stats.setRunningTime(Duration.between(startTime, Instant.now()).toSeconds());
//stats.setRunningTime(Duration.between(startTime, Instant.now()).toSeconds());
// Get our Game Object
Game G = conn.getAttachment();
Expand All @@ -182,7 +180,7 @@ public void onMessage(WebSocket conn, String message) {
System.out
.println("> " + Duration.between(startTime, Instant.now()).toMillis() + " " + "*" + " " + escape(jsonString));
broadcast(jsonString);
broadcast(jsonString); */
}

@Override
Expand All @@ -202,7 +200,7 @@ public void onError(WebSocket conn, Exception ex) {
@Override
public void onStart() {
setConnectionLostTimeout(0);
stats = new Statistics();
//stats = new Statistics();
startTime = Instant.now();
}

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/uta/cse3310/Board.java

This file was deleted.

20 changes: 20 additions & 0 deletions src/main/java/uta/cse3310/Board_Create
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package uta.cse3310;

public class Board_Create {
public float Density;
public int Min_Letters;
public String Handle;

public int create_grid(){
return 1;
}
public void assign_direction(){

}
public boolean validate_word(){
return true;
}
public void randomize_filter(){

}
}
27 changes: 27 additions & 0 deletions src/main/java/uta/cse3310/Board_Game.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package uta.cse3310;
import java.util.ArrayList;
public class Board_Game {
public int Game_Id;
public int Total_valid_words;
public ArrayList<String> Words_found = new ArrayList<String>();
public int Player_count;

public boolean check_selection(){
return true;
}
public int display_board(){
return 1;
}
public int display_words(){
return 1;
}
public boolean leave_game(){
return true;
}
public boolean handle_outstanding(){
return true;
}
public long display_time(){
return 1;
}
}
9 changes: 9 additions & 0 deletions src/main/java/uta/cse3310/ChatBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package uta.cse3310;

public class ChatBox {
public String Message_display;

public String display_message(){
return Message_display;
}
}
15 changes: 15 additions & 0 deletions src/main/java/uta/cse3310/Communication.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package uta.cse3310;

public class Communication {
public String Message;

public int validate_message(){
return 1;
}
public int send_message(){
return 1;
}
public int receive_message(){
return 1;
}
}
183 changes: 0 additions & 183 deletions src/main/java/uta/cse3310/Game.java

This file was deleted.

15 changes: 15 additions & 0 deletions src/main/java/uta/cse3310/Game_Summary.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package uta.cse3310;

public class Game_Summary {
public String handle;
public int Game_Id;

public int display_summary(){
return 1;
}
public boolean return_lobby(){
return true;
}


}
13 changes: 13 additions & 0 deletions src/main/java/uta/cse3310/Helper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package uta.cse3310;

public class Helper {
public String Handle;
public int Game_Id;

public String random_word(){
return "test";
}
public boolean prompt_player(){
return true;
}
}
10 changes: 10 additions & 0 deletions src/main/java/uta/cse3310/Instruction_user
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package uta.cse3310;

public class Instruction_user{
public String Instructions;
public int Game_Id;

public void instruction_display(){

}
}
Loading

0 comments on commit f1f6ede

Please sign in to comment.