Dicewars-Java-Approach/server/game-logic/Manager/Test.java

49 lines
1.8 KiB
Java

package manager;
import manager.GameManager;
import manager.field.Field;
import manager.field.Player;
import java.util.ArrayList;
public class Test {
public static void main(String[] args){
GameManager gm = new GameManager();
// Test to add Players to the Gamemanager and print them:
gm.add_player("Sebastian");
gm.add_player("Lars");
gm.add_player("Nils");
gm.add_player("Felix");
for(Player current:gm.get_players()){
System.out.println(current.get_name());
}
// Test to add a Field-List to the Gamemanager:
ArrayList<Field> fields = new ArrayList<Field>();
Field f1 = new Field(4,gm.get_players().get(0));
Field f2 = new Field(3,gm.get_players().get(1));
Field f3 = new Field(5,gm.get_players().get(2));
f1.add_neighbour(f2);
f2.add_neighbour(f1);
fields.add(f1);
fields.add(f2);
fields.add(f3);
gm.new_game(fields);
// Test to attack a neighboured fields:
System.out.println("\n The Owner of the First Field is:");
System.out.println(gm.get_fields().get(0).get_owner().get_name());
System.out.println("The Number of Dices of the First Field is:");
System.out.println(gm.get_fields().get(0).get_dice_number());
System.out.println("\n");
gm.attack_field(gm.get_fields().get(1),gm.get_fields().get(0));
System.out.println("\n Attack Field 1 with Field 2: \n");
System.out.println("\n The Owner of the First Field is:");
System.out.println(gm.get_fields().get(0).get_owner().get_name());
System.out.println("The Number of Dices of the First Field is:");
System.out.println(gm.get_fields().get(0).get_dice_number());
System.out.println("\n");
}
}