Skip to content

gruntygap/quoridor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quoridor

A version of Quoridor built with Java. An eclipse project. UI-Base: JavaFX

Model

Main Objects of the Model

  • Game (Model)
    • The encapsulating object that contains all algorithms and constructs of Quoridor
  • Board
    • The board that holds n x n spaces. (n must be odd and n >= 5)
  • Space
    • The tile that holds the player, and is surrounded by fences
    • Has top, left, right, bottom Fence attributes.
    • Contains a player
    • Player (1/2)
      • A pawn controlled by a player.
      • A player can move from space to space
    • Fence
      • A barrier that the player cannot hop over
      • Can be valid (usable by the player) (inner Fences) or invalid (Not used by the player; default state of border).
      • Can be placed (Automatically the outside ring of fences) or not placed (the inner fences until changed by a Player).

Classes:

Model

Variables
  • ArrayList<ArrayList< Space > board;
  • Stores game data.
    • Constructor:
    ArrayList<ArrayList<Space>>() board;
    public Board(int size){
      board = new ArrayList<ArrayList<Space>();
      for // initiate the 2d ArrayList
      // fill values of arraylist
      // exclude() means that the space is placed but not valid
      for x..
        for y..
        if(x == 0) {
          space.top.exclude();
        }else if (x == size - 1) {
          space.bottom.exclude();
        }
        if(y == 0) {
          space.left.exclude();
        }else if(y == size - 1) {
          space.right.exclude();
        }
      }
Methods
  • getFeedBack()
    • Displays who won the game.
  • setSize(int size)
    • Sets the size of the board.
  • getSize()
    • gets the size of the board (if needed).
  • reset()
    • clears/resets the game board to original board.
  • isGameWon()
    • Determines if a player has won the game
  • setChanged()
    • Given method that says that something has changed (needed method by observable)
  • notifyObservers(...)
    • Given method that notifies subscribers to update. (needed method by observable)
    • When a player Moves.
    • When a fence is placed.
    • setting the board Size.
  • changeTurn(...)
    • Switches the current player's turn.
  • placeWall(...)
    • TBD
  • makeMove(...)
    • TBD
    • reset()
      • Resets the game board
Methods
  • Constructor();
  • getSpace(int x, int y);

Space

Variables
  • Fence top;
  • Fence left;
  • Fence bottom;
  • Fence right;
  • Player playerSpace;
Methods
  • Constructor();
  • setSpace();

Player

Variables
  • String identifier
    • Gives the "name" of the player
Methods

Fence

Variables
  • boolean placed;
  • boolean valid;
Methods
  • exclude(...)
  • isValid(...)

<<<<< in progress

Variables/Components
  • DataType board

  • DataType space

    • Stores space data.
    • Constructor:
    private Fence top;
    private Fence bottom;
    private Fence left;
    private Fence right;
    private DataType player;
    public Space(){
      // Instantiate Variables
      }
  • DataType fence

    • Stores fence data.
  • int size

    • Stores the size of the board.
  • DataType player

    • Stores whose move it currently is.
  • boolean gameOver

    • keeps track if the game has won. True for game over, false otherwise.

>>>>>>>>>

View

Methods
  • update(...)
    • Method used to update the view that is called by the model (needed method by observable)
Variables/Components
  • Model object to communicate with model
  • Button reset
    • Resets the board by calling model.reset.
  • ComboBox sizeSelect.
    • Gives user a ComboBox to select the size of the board.
  • Label feedback
    • Displays whose turn it currently is/who won the game.
  • Label sizeLabel
    • says "select a size"
  • int boardSize
    • takes in size user inputed from sizeSelect

Controller

Methods
  • Handle method
    • for ActionEvents
Variables/Components
  • Model object
    • for communicating with Model
  • View object (unless controller is inside of view)
    • for communicating with view

About

A version of Quoridor built with Java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published