skeleton: Cleaned up code and md

This commit is contained in:
2023-03-15 17:28:02 +11:00
parent dc6e1258b2
commit 5463debddf
9 changed files with 113 additions and 114 deletions

View File

@@ -4,7 +4,8 @@ public class board {
public final island[] islands;
public final stoneCircle[] stoneCircles;
public board(island[] islands, stoneCircle[] stoneCircles) {
public board(island[] islands, stoneCircle[] stoneCircles) {
// Needed to stop the compiler complaining about the final fields not being set
this.islands = islands;
this.stoneCircles = stoneCircles;
}

View File

@@ -3,13 +3,18 @@ package comp1110.ass2.skeleton;
public class island {
public final int width;
public final int height;
public final int x;
public final int y;
public tile[][] tiles;
public final int score;
public island(int width, int height, int score) {
public island(int width, int height,int x, int y, int score, tile[][] tiles) {
// Needed to stop the compiler complaining about the final fields not being set
this.width = width;
this.height = height;
this.score = score;
this.tiles = new tile[width][height];
this.tiles = tiles;
this.x = x;
this.y = y;
}
}
}

View File

@@ -4,14 +4,15 @@ public class piece {
enum pieceType {
Settler, Villager
}
public final pieceType type;
public final player owner;
public tile placedOn;
public piece(pieceType type, player owner) {
public piece(pieceType type, player owner) {
// Needed to stop the compiler complaining about the final fields not being set
this.type = type;
this.owner = owner;
}
}

View File

@@ -6,9 +6,11 @@ public class player {
public int score;
public piece[] pieces;
public player(String name, int age) {
public player(String name, int age) {
// Needed to stop the compiler complaining about the final fields not being set
this.name = name;
this.age = age;
this.score = 0;
this.pieces = null;
}
}

View File

@@ -8,6 +8,7 @@ public class resources {
public final resourceType type;
public resources(resourceType type) {
// Needed to stop the compiler complaining about the final fields not being set
this.type = type;
}
}

View File

@@ -8,24 +8,31 @@ package comp1110.ass2.skeleton;
*/
public class setup {
/**
* This method clears the board.
*/
public void clearBoard() {
}
/**
* This method creates the board, islands, and stone circles.
*/
public void boardSetup(){
public void boardSetup() {
}
/**
* This method creates a player.
*/
public void playerSetup(){
public void playerSetup() {
}
/**
* This method holds the startup code for the game.
* It will create 2-4 players, set up the board and assign the players their pieces.
* It will create 2-4 players, set up the board and assign the players their
* pieces.
*/
public static void main(String[] args) {
}

View File

@@ -4,17 +4,15 @@ public class stoneCircle {
public final int x;
public final int y;
public boolean claimed;
public player owner;
public final resources[] resources;
public final statuettes[] statuettes;
public final int statuettes;
public stoneCircle(int x, int y, resources[] resources, statuettes[] statuettes) {
public stoneCircle(int x, int y, resources[] resources, int numStatuettes) {
// Needed to stop the compiler complaining about the final fields not being set
this.x = x;
this.y = y;
this.claimed = false;
this.owner = null;
this.resources = resources;
this.statuettes = statuettes;
this.statuettes = numStatuettes;
}
}

View File

@@ -4,12 +4,12 @@ public class tile {
enum tileType {
Land, Water
}
public final tileType type;
public int x;
public int y;
public final tileType type;
public piece[] pieces;
public tile(tileType type, int x, int y) {
public tile(int x, int y, tileType type) {
this.type = type;
this.x = x;
this.y = y;