Помогите)
package com.javarush.task.task21.task2113;
import java.util.ArrayList;
import java.util.List;
public class Hippodrome {
private static List<Horse> horses = new ArrayList<>();
static Hippodrome game;
public List<Horse> getHorses() {
return horses;
}
public void print() {
for (Horse x : horses)
x.print();
for (int i = 0; i < 10; i++)
System.out.println();
}
public void move() {
for (Horse x : horses)
x.move();
}
public void run() throws InterruptedException {
for (int i = 1; i <= 100; i++) {
move();
print();
Thread.sleep(200);
}
}
public static Horse getWinner() {
Horse horsewin = horses.get(0);
double max = 0;
for (int i = 0; i < horses.size(); i++ ) {
if (max < horses.get(i).getDistance()) {
max = horses.get(i).getDistance();
horsewin = horses.get(i);
}
}
return horsewin;
}
public static void printWinner() {
System.out.println("Winner is " + getWinner().getName() + "!");
}
public Hippodrome(List<Horse> horses) {
this.horses = horses;
}
public static void main(String[] args) {
game = new Hippodrome(new ArrayList<>());
Horse one = new Horse("White",3, 0);
Horse two = new Horse("Blue",3, 0);
Horse three = new Horse("Red",3, 0);
game.getHorses().add(one);
game.getHorses().add(two);
game.getHorses().add(three);
try {
game.run();
printWinner();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}