Results 1 to 5 of 5
Thread: Chopsticks Game
- 01-05-2012, 02:15 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 2
- Rep Power
- 0
Chopsticks Game
So this is my first program, I'm just looking for some feedback, for example is there any way for me to make the program simpler, or if its good for a first program. I worked on it for quite a while.
As you can see its a very long piece of code for a very simple game, any ideas on how to improve it are welcome. Thanks.Java Code:import java.util.Scanner; public class Exp { public static void main(String args[]) { int var = 1; Directions directionsObject = new Directions(); game1 SinglePlayerObject = new game1(); game2 MultiPlayerObject = new game2(); while (var == 1) { Scanner com = new Scanner(System.in); System.out.println("---[CHOPSTICKS]---"); System.out.println("Enter 'd' for directions"); System.out.println("Enter '1' for single-player"); System.out.println("Enter '2' for two-player"); System.out.println("To quit, enter 'quit'"); switch(com.nextLine()) { case "d": directionsObject.message(); break; case "1": SinglePlayerObject.SinglePlayer(); break; case "2": MultiPlayerObject.MultiPlayer(); break; case "quit": var++; break; default: System.out.println("Command not recognized. Try again."); System.out.println(" "); System.out.println(" "); } } } }import java.util.Scanner; public class Directions { public void message() { int varD = 1; while (varD == 1) { Scanner Dcom = new Scanner(System.in); System.out.println(""); System.out.println("----[Directions]----"); System.out.println("To start, each player (you and your opponent) has two"); System.out.println("counters, each with the value one. Then, the first player"); System.out.println("selects one of their opponent's counters to attack. When"); System.out.println("a counter is attacked, the one attacked adds the value of"); System.out.println("the attacker's counter to his own. The its his opponent's"); System.out.println("turn to attack. When a counter reaches 5, the counter is"); System.out.println("disabled. The game continues until both of one player's"); System.out.println("counters are disabled."); System.out.println(""); System.out.println("Also, at every turn, you have the option to 'split' or"); System.out.println("redistribute, your counters. You transfer any amount of"); System.out.println("counts from one counter to the other. As long as you aren't"); System.out.println("simply switching the values or overloading and effectively"); System.out.println("disabling a counter, it will be allowed."); System.out.println(""); System.out.println("Hit enter to return to menu."); System.out.println(""); switch(Dcom.nextLine()) { default: varD++; break; } } } } import java.util.Scanner; public class game1 { Exp menuObject = new Exp(); private String SplitCheck; private int temp = 1; private int SPLIToper1, SPLIToper2; private int loop1 = 1; private int turn1 = 1; private int opp1 = 1, opp2 = 1, player1 = 1, player2 = 1; private int attacker; private int target; Scanner g1com = new Scanner(System.in); public void SinglePlayer () { while (loop1 == 1) { while(turn1 == 1) { CheckForDisable(); CheckGameEnd(); System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); CheckGameEnd(); if(temp == 1) { CheckSplitOrHit(); } temp = 1; GetTargets(); ChangeValues(); turn1++; } while(turn1 == 2) { CheckForDisable(); System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); CheckGameEnd(); System.out.println(""); System.out.println("Your opponent is thinking......"); System.out.println(""); AIchangerMAIN(); turn1--; } } menuObject.main(null); } private void CheckForDisable () { if(opp1 >=5) { opp1 = 0; } if(opp2 >=5) { opp2 = 0; } if(player1 >=5) { player1 = 0; } if(player2 >=5) { player2 = 0; } } private void CheckGameEnd() { if(opp1 == 0 && opp2 == 0) { System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); System.out.println("Congrats! You won!"); System.out.println(""); menuObject.main(null); } if(player1 == 0 && player2 == 0) { System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); System.out.println("Sorry. You Lost."); System.out.println(""); menuObject.main(null); } } private void CheckSplitOrHit() { System.out.println("Would you like to split?('yes' for yes, anything else for no)"); SplitCheck = g1com.next(); switch(SplitCheck) { case "yes": SPLIT(); break; default: } } private void GetTargets () { if(player1 == 0) { System.out.println("You have to use the right side."); System.out.println(""); attacker = 2; if(opp1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(opp2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } else if(player2 == 0) { System.out.println("You have to use the left side."); System.out.println(""); attacker = 1; if(opp1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(opp2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } else { System.out.println("Which side would you like to use?(enter '1' or '2')"); attacker = g1com.nextInt(); if(opp1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(opp2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } } private void ChangeValues() { if(attacker < 3 && attacker > 0 && target < 3 && target > 0) { switch(attacker) { case 1: switch(target) { case 1: opp1 = opp1 + player1; break; case 2: opp2 = opp2 + player1; break; } break; case 2: switch(target) { case 1: opp1 = opp1 + player2; break; case 2: opp2 = opp2 + player2; break; } break; default: break; } } else { System.out.println("One of your inputs was faulty. When selecting sides, use '1' or '2'."); SinglePlayer(); } } // // private void SPLIT() { SPLIToper1 = 0; SPLIToper2 = 0; if(player1 + player2 == 2) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 2 && SPLIToper1 != player1 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; } else { System.out.println("That doesn't add up..... You should attack"); } SinglePlayer(); } else if(player1 + player2 == 4) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 4 && SPLIToper1 != player1 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; } else { System.out.println("That doesn't add up..... You should attack"); } SinglePlayer(); } else if(player1 + player2 == 6) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 6 && SPLIToper1 != player1 && SPLIToper1 <= 4 && SPLIToper2 <= 4 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; } else { System.out.println("That doesn't add up..... You should attack"); } SinglePlayer(); } else if(player1 + player2 == 8) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 8 && SPLIToper1 != player1 && SPLIToper1 <= 4 && SPLIToper2 <= 4 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; } else { System.out.println("That doesn't add up..... You should attack."); } SinglePlayer(); } else { System.out.println("You can't split. You have to attack."); temp++; SinglePlayer(); } } // //methods after here are for AI. // private void AIchangerMAIN() { if(opp1 + player1 >= 5 && player2 == 0) { player1 += opp1; } else if(opp2 + player1 >= 5 && player2 == 0) { player1 += opp2; } else if(opp1 + player2 >= 5 && player1 == 0) { player2 += opp1; } else if(opp2 + player2 >= 5 && player1 == 0) { player2 += opp2; } else if(opp1 + opp2 == 2 && opp1 != 1) { System.out.println("Your opponent split."); opp1 = 1; opp2 = 1; } else if(opp1 + opp2 == 4 && opp1 != 2) { System.out.println("Your opponent split."); if(opp1 == 3) { opp1 = 2; opp2 = 2; } else if(opp1 == 1) { opp1 = 2; opp2 = 2; } else if(opp1 == 4) { opp1 = 2; opp2 = 2; } else if(opp1 == 0) { opp1 = 2; opp2 = 2; } else { System.out.println("something weird happened..."); } } else if(opp1 + player1 >= 5) { player1 += opp1; } else if(opp2 + player1 >= 5) { player1 += opp2; } else if(opp1 + player2 >= 5) { player2 += opp1; } else if(opp2 + player2 >= 5) { player2 += opp2; } else if(opp1 == 0 && player1 == 0) { player2 += opp2; } else if(opp2 == 0 && player1 == 0) { player2 += opp1; } else if(opp1 == 0 && player2 == 0) { player1 += opp2; } else if(opp2 == 0 && player1 == 0) { player2 += opp1; } else if(opp1 == 1 && opp2 == 2 && player1 == 0 && player2 == 1) { player2 += opp1; } else if(opp1 == 1 && opp2 == 2 && player2 == 0 && player1 == 1) { player1 += opp1; } else if(opp1 == 2 && opp2 == 1 && player1 == 0 && player2 == 1) { player2 += opp1; } else if(opp1 == 2 && opp2 == 1 && player2 == 0 && player1 == 1) { player1 += opp1; } else { if(opp1 != 0 && opp2 != 0 && player1 != 0 && player2 !=0) { if(opp1 < opp2) { if(player1 < player2) { player1 += opp1; } else if(player2 < player1) { player2 += opp1; } else { player1 += opp1; } } else if(opp2 < opp1) { if(player1 < player2) { player1 += opp2; } else if(player2 < player1) { player2 += opp2; } else { player1 += opp2; } } else { player1 += opp2; } } else if(player1 == 0 || player2 == 0) { if((player1 <= 3 && opp1 != 0 && opp2 != 0) || (player2 <= 3 && opp1 != 0 && opp2 != 0)) { if(player1 > player2) { if(opp1 > opp2) { player1 += opp1; } else { player1 += opp2; } } else { if(opp1 > opp2) { player2 += opp1; } else { player2 += opp2; } } } else if(opp1 < opp2) { player2 += opp1; } else { player2 += opp2; } } else if(opp1 == 0) { if(player1 < player2 && player1 != 0) { player1 += opp2; } else { player2 += opp2; } } else if(opp2 == 0) { if(player1 < player2 && player2 != 0) { player1 += opp1; } else { player2 += opp1; } } else { if(opp1 > opp2) { if(player1 > player2) { player1 += opp1; } else { player2 += opp1; } } else { if(player2 > player1) { player2 += opp1; } else { player1 += opp1; } } } } } }import java.util.Scanner; public class game2 { Exp menuObject = new Exp(); private String SplitCheck; private int temp = 1; private int SPLIToper1, SPLIToper2; private int loop1 = 1; private int turn1 = 1; private int opp1 = 1, opp2 = 1, player1 = 1, player2 = 1; private int attacker; private int target; Scanner g1com = new Scanner(System.in); public void MultiPlayer () { while (loop1 == 1) { while(turn1 == 1) { CheckForDisable(); CheckGameEnd(); System.out.println(""); System.out.println("[Player 1's turn]"); System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); CheckGameEnd(); if(temp == 1) { CheckSplitOrHit(); } temp = 1; GetTargets(); ChangeValues(); turn1++; } while(turn1 == 2) { CheckForDisable(); CheckGameEnd2(); System.out.println(""); System.out.println("[Player 2's turn]"); System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + player1 + " || " + player2); System.out.println(""); System.out.println("You: " + opp1 + " || " + opp2); System.out.println(""); CheckGameEnd2(); if(temp == 1) { CheckSplitOrHit2(); } temp = 1; GetTargets2(); ChangeValues2(); turn1--; } } menuObject.main(null); } private void CheckForDisable() { if(opp1 >=5) { opp1 = 0; } if(opp2 >=5) { opp2 = 0; } if(player1 >=5) { player1 = 0; } if(player2 >=5) { player2 = 0; } } private void CheckGameEnd() { if(opp1 == 0 && opp2 == 0) { System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); System.out.println("Congrats! You won!"); System.out.println(""); menuObject.main(null); } if(player1 == 0 && player2 == 0) { System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); System.out.println("Sorry. You Lost."); System.out.println(""); menuObject.main(null); } } private void CheckSplitOrHit() { System.out.println("Would you like to split?('yes' for yes, anything else for no)"); SplitCheck = g1com.next(); switch(SplitCheck) { case "yes": SPLIT(); break; default: } } private void GetTargets () { if(player1 == 0) { System.out.println("You have to use the right side."); System.out.println(""); attacker = 2; if(opp1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(opp2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } else if(player2 == 0) { System.out.println("You have to use the left side."); System.out.println(""); attacker = 1; if(opp1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(opp2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } else { System.out.println("Which side would you like to use?(enter '1' or '2')"); attacker = g1com.nextInt(); if(opp1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(opp2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } } private void ChangeValues() { if(attacker < 3 && attacker > 0 && target < 3 && target > 0) { switch(attacker) { case 1: switch(target) { case 1: opp1 = opp1 + player1; break; case 2: opp2 = opp2 + player1; break; } break; case 2: switch(target) { case 1: opp1 = opp1 + player2; break; case 2: opp2 = opp2 + player2; break; } break; default: break; } } else { System.out.println("One of your inputs was faulty. When selecting sides, use '1' or '2'."); MultiPlayer(); } } // // private void SPLIT() { SPLIToper1 = 0; SPLIToper2 = 0; if(player1 + player2 == 2) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 2 && SPLIToper1 != player1 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else if(player1 + player2 == 4) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 4 && SPLIToper1 != player1 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else if(player1 + player2 == 6) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 6 && SPLIToper1 != player1 && SPLIToper1 <= 4 && SPLIToper2 <= 4 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else if(player1 + player2 == 8) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 8 && SPLIToper1 != player1 && SPLIToper1 <= 4 && SPLIToper2 <= 4 && SPLIToper1 != player2) { player1 = SPLIToper1; player2 = SPLIToper2; turn1++; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else { System.out.println("You can't split. You have to attack."); temp++; MultiPlayer(); } } // //methods after here are for player2. // private void CheckGameEnd2() { if(player1 == 0 && player2 == 0) { System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); System.out.println("Congrats! You won!"); System.out.println(""); menuObject.main(null); } if(opp1 == 0 && opp2 == 0) { System.out.println(""); System.out.println(" 1 2"); System.out.println("------------------------"); System.out.println("Opponent: " + opp1 + " || " + opp2); System.out.println(""); System.out.println("You: " + player1 + " || " + player2); System.out.println(""); System.out.println("Sorry. You Lost."); System.out.println(""); menuObject.main(null); } } private void CheckSplitOrHit2() { System.out.println("Would you like to split?('yes' for yes, anything else for no)"); SplitCheck = g1com.next(); switch(SplitCheck) { case "yes": SPLIT2(); break; default: } } private void GetTargets2() { if(opp1 == 0) { System.out.println("You have to use the right side."); System.out.println(""); attacker = 2; if(player1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(player2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } else if(opp2 == 0) { System.out.println("You have to use the left side."); System.out.println(""); attacker = 1; if(player1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(player2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } else { System.out.println("Which side would you like to use?(enter '1' or '2')"); attacker = g1com.nextInt(); if(player1 == 0) { System.out.println("You have to attack the right side."); System.out.println(""); target = 2; } else if(player2 == 0) { System.out.println("You have to attack the left side."); System.out.println(""); target = 1; } else { System.out.println("Which side do you want to attack?(enter '1' or '2')"); target = g1com.nextInt(); } } } private void ChangeValues2() { if(attacker < 3 && attacker > 0 && target < 3 && target > 0) { switch(attacker) { case 1: switch(target) { case 1: player1 = player1 + opp1; break; case 2: player2 = player2 + opp1; break; } break; case 2: switch(target) { case 1: player1 = player1 + opp2; break; case 2: player2 = player2 + opp2; break; } break; default: break; } } else { System.out.println("One of your inputs was faulty. When selecting sides, use '1' or '2'."); MultiPlayer(); } } // // private void SPLIT2() { SPLIToper1 = 0; SPLIToper2 = 0; if(opp1 + opp2 == 2) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 2 && SPLIToper1 != opp1 && SPLIToper1 != opp2) { opp1 = SPLIToper1; opp2 = SPLIToper2; turn1--; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else if(opp1 + opp2 == 4) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 4 && SPLIToper1 != opp1 && SPLIToper1 != opp2) { opp1 = SPLIToper1; opp2 = SPLIToper2; turn1--; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else if(opp1 + opp2 == 6) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 6 && SPLIToper1 != opp1 && SPLIToper1 <= 4 && SPLIToper2 <= 4 && SPLIToper1 != opp2) { opp1 = SPLIToper1; opp2 = SPLIToper2; turn1--; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else if(opp1 + opp2 == 8) { System.out.println("Enter the value you want for your left counter."); SPLIToper1 = g1com.nextInt(); System.out.println("Enter the value you want for your right counter."); SPLIToper2 = g1com.nextInt(); if(SPLIToper1 + SPLIToper2 == 8 && SPLIToper1 != opp1 && SPLIToper1 <= 4 && SPLIToper2 <= 4 && SPLIToper1 != opp2) { opp1 = SPLIToper1; opp2 = SPLIToper2; turn1--; MultiPlayer(); } else { System.out.println("That doesn't add up..... Try again."); } MultiPlayer(); } else { System.out.println("You can't split. You have to attack."); temp++; MultiPlayer(); } } // }
- 01-05-2012, 03:12 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,537
- Rep Power
- 11
Re: Chopsticks Game
A few small points of style would enhance readability - which will help get better answers here (where we don't necessarily know the logic of the game), and will help you in 6 months time when you go back to read the code:
* Start variables with a lowercase letter and classes with an uppercase one
* Make instance variables private unless you have some reason not to
* Document methods. (Briefly, but descriptively. It's an art.)
- 01-05-2012, 03:27 AM #3
Member
- Join Date
- Jan 2012
- Posts
- 2
- Rep Power
- 0
Re: Chopsticks Game
So basically, I should add more notes/comments to make it easier for other people to understand whats going on with the code, so that way I'll get better feedback? And after I add/change the code, should I re-post it or just modify the actual initial post? Sorry, I'm new to this. :)
- 01-05-2012, 03:50 AM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,537
- Rep Power
- 11
Re: Chopsticks Game
Well it's up to you - the code *is* long by the standards of this (or any!) forum. On the other hand, someone might be interested and know about the game and so be able to figure out what the various methods are doing. Perhaps just leave it and see what happens.
I'm sorry that I don't have the time to look closely at it. But I would recommend it to anyone with the time. The game itself is interesting and I hope people will offer there thoughts on how it might be refactored. (for instance the methods made more numerous, but *shorter*). It's certainly a good first game. Well done.
- 01-06-2012, 06:17 AM #5
Member
- Join Date
- Feb 2010
- Posts
- 80
- Rep Power
- 0
Similar Threads
-
Complete Game Engine for beginner and intermediate game programmers
By rdjava in forum Java GamingReplies: 1Last Post: 06-02-2011, 09:29 AM -
Implementing "Game Over" in Minesweeper game based on Gridworld framework.
By JFlash in forum New To JavaReplies: 2Last Post: 08-05-2010, 04:49 AM -
game code for any game
By deathnote202 in forum Java GamingReplies: 4Last Post: 06-10-2010, 08:06 AM -
Help with game
By TGH in forum New To JavaReplies: 26Last Post: 01-12-2010, 02:55 PM -
2D strategy game or 2D war game
By led1433 in forum Java 2DReplies: 5Last Post: 02-10-2009, 06:00 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks