skeleton: Cleaned up code and md

This commit is contained in:
Nathan Woodburn 2023-03-15 17:28:02 +11:00
parent dc6e1258b2
commit 5463debddf
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
9 changed files with 113 additions and 114 deletions

View File

@ -1,128 +1,112 @@
# Simple draft skeleton: # Simple draft skeleton:
# Overview # Game play flow
## Board Setup 1. Game Setup
2. Phase Setup
3. While phase isn't over do phase
4. Score
5. Phase Setup
6. While phase isn't over do phase
7. Score
8. Game End
## Game Setup
* Create player data (maybe using enums)
## Phase Setup
* Clear board
* Create a grid of tiles * Create a grid of tiles
* Create islands and assign size and location (on tiles) * Create islands and assign size and location (on tiles)
* Create "stone circles" * Create stone circles
## On Game start functions
* Create player data (maybe using enums)
* Assign villages to players * Assign villages to players
* Assign settlers to players * Assign settlers to players
* Randomly Assign resources and statuettes to map "stone circles" * Randomly Assign resources and statuettes to stone circles
## Exploration Phase
1. Pick player
2. Player places piece (use function to check placement rules)
3. Repeat with next player (while not Exploration Phase over)
## Check Placement
If piece is settler, check if one of:
* on unoccupied water
* on unoccupied land adjacent to one of their pieces
If piece is village, check on unoccupied land adjacent to one of their pieces
## Phase
* Advance to next player
* Player places piece (use function piece plaging)
## Piece Placing ## Piece Placing
* Check placement (using function) * Check placement (using function)
* Assign piece to tile * Assign piece to tile
* If piece on "stone circle" > get resources and statuettes * If piece on stone circle, get resources and statuettes
## Valid Placement (bool)
## Exploration Phase over * If piece is settler, if either of:
If one of: * on unoccupied water
* on unoccupied land adjacent to one of their pieces
* If piece is village, if both:
* on unoccupied land
* is adjacent to one of their pieces
## Phase over (bool)
If either of:
* All resources (not including statuettes) have been collected * All resources (not including statuettes) have been collected
* No player has any remaining moves available * No player has any remaining moves available
## Scoring
* Island Scoring
* If player has pieces on > 7 islands, score 20 points
* If player has pieces on 7 islands, score 10 points
* Otherwise, score 0 points
# Settlement Phase * Links Scoring
## Setup * Score 5 points per island in players largest link
1. Remove pieces from board * Majorities Scoring
2. Assign resources and statuettes to stone circles * Player with most pieces on each island type scores points assigned to that island
3. Player after last player from exploration phase goes first * Ties are distributed evenly rounding down
* Resources Scoring
## Play * For each player
1. Pick player (from setup.3) * For each resource
2. Player places piece (use settlement check function to check placement rules) * If >3 of resource, score 20 points
3. Repeat with next player (while not Exploration Phase over) * If 3 of resource, score 10 points
* If 2 of resource, score 5 points
## End * If player has all 4 resources, score 10 points
Use same conditions as exploration phase over
Score
# Scoring
## Island Scoring
* If player has pieces on > 7 islands, score 20 points
* If player has pieces on 7 islands, score 10 points
* Otherwise, score 0 points
## Links Scoring
1. For each player get largest link
2. Score 5 points per island in largest link
## Majorities Scoring
* Player with most pieces on each island type scores points assigned to that island
* Ties are distributed evenly rounding down
## Resources Scoring
* For each player
* For each resource
* If >3 of resource, score 20 points
* If 3 of resource, score 10 points
* If 2 of resource, score 5 points
* If player has all 4 resources, score 10 points
## Statuettes Scoring ## Statuettes Scoring
* Each statuette is worth 4 points * Each statuette is worth 4 points
# Classes/Fuctions # Functions
* Setup Functions
## Setup board * Clear Board
## Create player (requires input data, probably from player number and colour) * Board Setup
## Phase play * Player Setup
## Check Placement (requires input data, probably piece annd returns bool) * Game Functions
## Place Piece (requires input data, probably from player and piece type) * Player Turn
## Phase over (bool) * Place Piece
* Claim Stone Circle
* Valid placement (bool)
* Phase Over (bool)
* Scoring Functions
* Island Scoring
* Links Scoring
* Majorities Scoring
* Resources Scoring
* Statuettes Scoring
# Objects # Objects
## Piece ## Board
* Owner (Player) * Islands (List of Islands)
* Type (Settler, Village) * Stone Circles (List of Stone Circles)
* Placed on (Tile)
## Tile
* Location (x,y)
* Type (Land, Water)
* Pieces (List of Pieces)
## Island ## Island
* Size (x,y) * Size (x,y)
* Location (x,y) * Location (x,y)
* Point value (int) * Point value (int)
* Tiles (List of Tiles) * Tiles (List of Tiles in an grid)
## Tile
* Location (x,y)
* Type (Land, Water)
* Pieces (List of Pieces, set during game)
## Piece
* Type (Settler, Village)
* Owner (Player)
* Placed on (Tile)
## Stone Circle ## Stone Circle
* Location (x,y) * Location (x,y)
* Resources (List of Resources) * Resources (List of Resources)
* Statuettes (List of Statuettes) * Number of Statuettes (int)
* Claimed (bool) * Claimed (bool, set during game)
## Player ## Player
* Name (string) * Name (string)
* Age (int) * Age (int)
* Score (int) * Score (int, set during game)
* Pieces (List of Pieces, set during game)
## Board
* Islands (List of Islands)
* Stone Circles (List of Stone Circles)

View File

@ -4,7 +4,8 @@ public class board {
public final island[] islands; public final island[] islands;
public final stoneCircle[] stoneCircles; 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.islands = islands;
this.stoneCircles = stoneCircles; this.stoneCircles = stoneCircles;
} }

View File

@ -3,13 +3,18 @@ package comp1110.ass2.skeleton;
public class island { public class island {
public final int width; public final int width;
public final int height; public final int height;
public final int x;
public final int y;
public tile[][] tiles; public tile[][] tiles;
public final int score; 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.width = width;
this.height = height; this.height = height;
this.score = score; 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 { enum pieceType {
Settler, Villager Settler, Villager
} }
public final pieceType type; public final pieceType type;
public final player owner; public final player owner;
public tile placedOn; 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.type = type;
this.owner = owner; this.owner = owner;
} }
} }

View File

@ -6,9 +6,11 @@ public class player {
public int score; public int score;
public piece[] pieces; 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.name = name;
this.age = age; this.age = age;
this.score = 0; this.score = 0;
this.pieces = null;
} }
} }

View File

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

View File

@ -8,24 +8,31 @@ package comp1110.ass2.skeleton;
*/ */
public class setup { public class setup {
/**
* This method clears the board.
*/
public void clearBoard() {
}
/** /**
* This method creates the board, islands, and stone circles. * This method creates the board, islands, and stone circles.
*/ */
public void boardSetup(){ public void boardSetup() {
} }
/** /**
* This method creates a player. * This method creates a player.
*/ */
public void playerSetup(){ public void playerSetup() {
} }
/** /**
* This method holds the startup code for the game. * 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) { public static void main(String[] args) {
} }

View File

@ -4,17 +4,15 @@ public class stoneCircle {
public final int x; public final int x;
public final int y; public final int y;
public boolean claimed; public boolean claimed;
public player owner;
public final resources[] resources; 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.x = x;
this.y = y; this.y = y;
this.claimed = false; this.claimed = false;
this.owner = null;
this.resources = resources; this.resources = resources;
this.statuettes = statuettes; this.statuettes = numStatuettes;
} }
} }

View File

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