rt

An obligatory Java Project
Log | Files | Refs | LICENSE

commit 9a830a5f88ce262ffd536f080aa17424a8adb9bd
parent 8d5054948444eeb68ee4c2113156201137246e44
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date:   Mon, 25 Nov 2019 18:01:16 +0100

Remove debug statements and comments

Diffstat:
Mgroup.java | 2--
Mscript.java | 8--------
Mservertask.java | 20+-------------------
3 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/group.java b/group.java @@ -16,12 +16,10 @@ public class group { public synchronized int add(acc m) { if (nelem < 3) { - System.out.println("group add"); for (int i = 0; i < nelem; i++) if (Math.abs(gAccounts[i].getScore() - m.getScore()) > 2) cmet = 0; if (cmet == 1) { - System.out.println("cond met"); gAccounts[nelem] = m; nelem++; cmet = 1; diff --git a/script.java b/script.java @@ -47,11 +47,8 @@ public class script { } public boolean assignUser(int p, acc a, Lock lock) { - System.out.println("prior locked" + a.getUname()); lock.lock(); - System.out.println("locked"); try { - System.out.println("dbg: assignUser " + p + " " + a.getUname()); a.setScore(); if (p == 0) { @@ -73,14 +70,11 @@ public class script { return false; } finally { lock.unlock(); - System.out.println("Unlocked"); } } public String getResult(Lock lock, acc a) { - System.out.println("getResult: prior lock " + a.getUname()); lock.lock(); - System.out.println("getResult: locked " + a.getUname()); String s = ""; try { while (true) { @@ -97,11 +91,9 @@ public class script { s = roles[0][0] + " played by " + roles[0][1] + " got " + roles[0][2] + " points." + "\n" + roles[1][0] + " played by " + roles[1][1] + " got " + roles[1][2] + " points." + "\n" + roles[2][0] + " played by " + roles[2][1] + " got " + roles[2][2] + " points." + "\n"; - System.out.println("getResult s: " + s); return s; } finally { lock.unlock(); - System.out.println("getResult: unlocked " + a.getUname()); } } } diff --git a/servertask.java b/servertask.java @@ -53,7 +53,6 @@ public class servertask implements Runnable { if (util.isNumeric(message)) { val = Integer.parseInt(message); if (val < 4 && val > 0) { - System.out.println("inere val: " + val + player.getUname()); if (pscript.assignUser(val,player,lock)) { return true; } @@ -83,11 +82,9 @@ public class servertask implements Runnable { private String[][] getChar(group g) { roundAvg = Math.round(g.getAvgscr()); - System.out.println("dbg " + roundAvg); for (script s : server.Scripts) { if (roundAvg == s.getDlevel()) { pscript = s; - System.out.println("dbg " + s.getDlevel()); return s.getRoles(); } } @@ -98,7 +95,6 @@ public class servertask implements Runnable { private void initGame() { int gf = 0; for (group g : server.Groups) { - System.out.println("gs"); if (g.add(player) == 1) { pgroup = g; gf = 1; @@ -117,11 +113,8 @@ public class servertask implements Runnable { } } while (true) { - // pgroup.getAccUname(); if (pgroup.getNumMem() == 3) { - System.out.println("getchar"); chars = getChar(pgroup); - System.out.println("dbg chars: " + chars[0][0] + chars[1][0] + chars[2][0]); break; } try { @@ -140,8 +133,6 @@ public class servertask implements Runnable { @Override public void run() { try { - // System.out.println("TCP Client connected " + connection); - DataInputStream inputStr = new DataInputStream( new BufferedInputStream(connection.getInputStream())); DataOutputStream outputStr = new DataOutputStream( @@ -156,7 +147,6 @@ public class servertask implements Runnable { while (message.compareTo("q") != 0) { // use 'q' to quit if (util.isNumeric(message) && (val = Integer.parseInt(message)) > 0 && val < 3) { if (val == 1 && loggedin == 0) { - System.out.println("in 1"); outputStr.writeUTF("Enter your username and password" + " in the format:" + " username password\n"); @@ -171,7 +161,6 @@ public class servertask implements Runnable { notifyClient(outputStr, "Invalid Input\nTry again\n" + lastMsg); } if (val == 2 && loggedin == 0) { - System.out.println("in 2"); outputStr.writeUTF("Kindly enter your" + " username and password" + " in the format: username password\n"); @@ -182,9 +171,8 @@ public class servertask implements Runnable { loggedin = 1; notifyClient(outputStr, "Login Successful\n" + "Please wait.\n" + - " Initializing game world...\n"); + "Initializing game world...\n"); initGame(); - System.out.println("here"); lastMsg = "Please select a character " + "in 60 seconds :" + "\n" + "1 " + chars[0][0] + "\n" + @@ -211,13 +199,9 @@ public class servertask implements Runnable { } } if (assigned == false) { - // as = pscript.assignUser(0,player); - // notifyClient(outputStr,as); selChar(inputStr,outputStr,1); } - System.out.println("dbg: flow " + player.getUname()); as = pscript.getResult(lock,player); - System.out.println("result: " + as); notifyClient(outputStr,as); notifyClient(outputStr,"Game Over.\n" + "You have been logged out\n" + @@ -235,14 +219,12 @@ public class servertask implements Runnable { notifyClient(outputStr, "Invalid Input\n" + "Please try again\n" + "Welcome to RT\nSelect one:\n1 Signup\n2 Login\nq Quit"); - // System.out.println("TCP Client> " + message); message = inputStr.readUTF(); } server.Groups.remove(pgroup); inputStr.close(); outputStr.close(); connection.close(); - } catch (IOException ex) { System.out.println("Couldn't establish connection: " + ex); }