Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // game loop
- while (true) {
- int E = in.nextInt(); // The level of Thor's remaining energy, representing the number of moves he can still make.
- String direction = "";
- if(LY > TyPos && TyPos < 18) {
- direction += "S";
- TyPos++;
- System.err.println("Thor Pos = (" + TxPos + "," + TyPos + ")");
- } else if(LY < TyPos && TyPos > 0) {
- direction += "N";
- TyPos--;
- System.err.println("Thor Pos = (" + TxPos + "," + TyPos + ")");
- }
- if(LX > TxPos && TxPos < 40) {
- direction += "E";
- TxPos++;
- System.err.println("Thor Pos = (" + TxPos + "," + TyPos + ")");
- } else if(LX < TxPos && TxPos > 0) {
- direction += "W";
- TxPos--;
- System.err.println("Thor Pos = (" + TxPos + "," + TyPos + ")");
- }
- System.out.println(direction); // A single line providing the move to be made: N NE E SE S SW W or NW
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement