Created
November 20, 2015 00:59
-
-
Save e-tverdokhleb/394c22cfd72776dad926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BattleFieldTemplate extends JPanel { | |
boolean COLORDED_MODE = true; | |
int desk_step = 64; | |
int tank_move_step = 7; | |
long tank_speed = 500; | |
int tankX = 0; | |
int tankY = 0; | |
void runTheGame() throws Exception { | |
moveRandom(); | |
} | |
void moveRandom() throws InterruptedException { | |
while (true) { | |
int i = getRandom(); | |
System.out.println(i); | |
move(i); | |
repaint(); | |
Thread.sleep(tank_speed); | |
} | |
} | |
int getRandom() { | |
String str = String.valueOf(System.currentTimeMillis()); | |
int y = 0; | |
for (int i = 0; i < str.length() - 1; i++) { | |
if ((i % 2) == 0) { | |
y += Integer.parseInt(str.valueOf(str.charAt(i))); | |
System.out.print(i + " "); | |
} else { | |
y -= Integer.parseInt(str.valueOf(str.charAt(i))); | |
System.out.print(i + " "); | |
} | |
} | |
y = (Math.abs(y)%4+1); | |
System.out.println("y: " + y); | |
return y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Вы игнорируете мои указания. Плохо для Вас.