New methods in SiedlerBoard created
This commit is contained in:
@@ -2,13 +2,61 @@ package ch.zhaw.catan;
|
||||
|
||||
import ch.zhaw.catan.Config.Land;
|
||||
import ch.zhaw.hexboard.HexBoard;
|
||||
import ch.zhaw.hexboard.Label;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SiedlerBoard extends HexBoard<Land, String, String, String> {
|
||||
|
||||
Map<Point, ch.zhaw.hexboard.Label> lowerFieldLabel = new HashMap<>();
|
||||
|
||||
public void createFixGamefield(){
|
||||
Integer[][] waterCoordinates = {{4,2},{6,2},{8,2},{10,2},{3,5},{11,5},{2,8},{12,8},{1,11},
|
||||
{13,11},{2,14},{12,14},{3,17},{11,17},{4,20},{6,20},{8,20},{10,20}};
|
||||
Integer[][] desertCoordinates = {{7,11}};
|
||||
Integer[][] forestCoordinates = {{5,5,6},{10,8,10},{3,11,5},{8,14,3}};
|
||||
Integer[][] hillCoordinates = {{5,11,9},{5,17,8},{9,17,11}};
|
||||
Integer[][] fieldCoordinates = {{4,8,2},{8,8,5},{11,11,9},{4,14,10}};
|
||||
Integer[][] pastureCoordinates = {{7,5,3},{9,5,8},{10,14,12},{7,17,4}};
|
||||
Integer[][] mountainCoordinates = {{6,8,4},{9,11,6},{6,14,11}};
|
||||
|
||||
placeFieldWithoutLabel(Land.WATER, waterCoordinates);
|
||||
placeFieldWithoutLabel(Land.DESERT, desertCoordinates);
|
||||
placeFieldWithLabel(Land.FOREST, forestCoordinates);
|
||||
placeFieldWithLabel(Land.HILLS, hillCoordinates);
|
||||
placeFieldWithLabel(Land.FIELDS, fieldCoordinates);
|
||||
placeFieldWithLabel(Land.PASTURE, pastureCoordinates);
|
||||
placeFieldWithLabel(Land.MOUNTAIN, mountainCoordinates);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void placeFieldWithoutLabel(Land fieldType, Integer[][] fieldCoordinates) {
|
||||
for(Integer[] coordinates : fieldCoordinates) {
|
||||
addField(new Point(coordinates[0], coordinates[1]), fieldType);
|
||||
}
|
||||
}
|
||||
private void placeFieldWithLabel(Land fieldType, Integer[][] fieldInformation) {
|
||||
for(Integer[] information : fieldInformation) {
|
||||
addField(new Point(information[0], information[1]), fieldType);
|
||||
char[] label = information[2].toString().toCharArray();
|
||||
if (label.length == 1) {
|
||||
lowerFieldLabel.put(new Point(information[0], information[1]), new ch.zhaw.hexboard.Label('0', label[0]));
|
||||
} else {
|
||||
lowerFieldLabel.put(new Point(information[0], information[1]), new Label(label[0], label[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//TODO: Add fields, constructors and methods as you see fit. Do NOT change the signature
|
||||
// of the methods below.
|
||||
|
||||
Reference in New Issue
Block a user