Skip to content

Instantly share code, notes, and snippets.

@e-tverdokhleb
Created November 20, 2015 00:59
Show Gist options
  • Save e-tverdokhleb/394c22cfd72776dad926 to your computer and use it in GitHub Desktop.
Save e-tverdokhleb/394c22cfd72776dad926 to your computer and use it in GitHub Desktop.
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;
}
@liuiv15
Copy link

liuiv15 commented Nov 24, 2015

Вы игнорируете мои указания. Плохо для Вас.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment