o1.viinaharava

Type members

Classlikes

class GameBoard(width: Int, height: Int, boozeCount: Int) extends Grid[Glass]

Each instance of the class GameBoard represents a board for a game of Viinaharava. A game board is a Grid whose elements are Glass objects.

Each instance of the class GameBoard represents a board for a game of Viinaharava. A game board is a Grid whose elements are Glass objects.

A GameBoard is first initialized with water glasses (by initialElements). However, a number of the glasses are then immediately poured full of booze while the rest keep their default content of water.

Once created, a GameBoard does not replace any of its Glass objects with another. However, the state of each individual Glass may change.

Value parameters:
boozeCount

the number of booze glasses on the game board. When a GameBoard object is created, it randomly chooses this many different locations on the board and pours booze in them.

height

the number of rows of glasses in the game board

width

the number of glasses in each row of the game board

class Glass(val board: GameBoard, val location: GridPos)

The class Glass represents glasses in a game of Viinaharava. A glass object is mutable: it is initially full of water but can be modified to contain booze instead and can be emptied.

The class Glass represents glasses in a game of Viinaharava. A glass object is mutable: it is initially full of water but can be modified to contain booze instead and can be emptied.

Value parameters:
board

the game board that the glass is located on

location

the location of the glass on the game board