---
# System prepended metadata

title: Othello OOP Design

---

# Othello OOP Design

    - Game instance and score will be initialized here
    - Possible to initialize game as a separate object

3 Objects

- a board (array of row and columns [][]) 

    Properties
        - size -> array of rows and columns
        - whiteCount = 2
        - blackCount = 2
        - nextPlayer = "black"
        
    
    initialize the board
        board = new Board([rows][columns])
        
    player1 = new Player(name, "black")
    player2 = new Player(name, "white") 
       
        // initialize all values to be 0 except middle
        with 2 whites and 2 blacks in the right order

    - putPiece(row, column, color)
        - piece = new Piece(row, column, color)
        - board[row][column] = piece

    - checkIfNeighborFlip
        - check left/right or top/bottom of new put piece

    - isAllowedToPosition
        - check if position in board is empty
    
    - isGameOver
        - blackCount + whiteCount >= 64
        - player.calculateScore

    - promptPlayer()


    - playTurn
        - isGameOver
        - promptPlayer
        - isAllowedToPosition
        - putPiece
        - checkIfNeighborFlip

- a piece
    properties
    - color
    - position
    - new Piece(row, column, color)
        - getPiece
        - setPosition(row, column)
        - getPosition --> row, column [x,y]
        - flipColor --> setANewColor
        - getColor

- a player
    - Properties
        - Color (white or black)
        - name (string)
        - score(int)

