Class: Game

Connect4# Game


new Game(players, msg)

Class that stores the current state of a connect 4 game.
Parameters:
Name Type Description
players Object The players in this game.
msg Discord~Message The message displaying the current game.
Source:

Members


board :Array.<Array.<number>>

2D Array of a 7w x 6h board. 0 is nobody, 1 is player 1, 2 is player 2.
Type:
  • Array.<Array.<number>>
Source:

msg :Discord~Message

The message displaying the current game.
Type:
  • Discord~Message
Source:

players :Object

The players in this game.
Type:
  • Object
Source:

turn :number

Which player's turn it is. Either 1 or 2.
Type:
  • number
Source:

Methods


print( [winner])

Edit the current message to show the current board.
Parameters:
Name Type Argument Default Description
winner number <optional>
0 The player who has won the game. 0 is game not done, 1 is player 1, 2 is player 2, 3 is draw.
Source: