Board (Version 2)
from PythonFunctions import Board
brd = Board.CreateBoard(5, 5)
Board.DisplayBoard(brd)
Used to quickly create or display a 2d array of items. Useful for creating boards for board games.
CreateBoard (Version 2)
To create a board, you can use the Board.CreateBoard() function
- PythonFunctions.Board.CreateBoard(x, y)
Returns a 2D array
- Parameters
x (int) – The width of the board
y (int) – The height of the board
value (str) – Optional, The default value to set each item. Defaults to ‘-’
- Returns
The 2D array
- Return type
list[list[str]]
DisplayBoard (Version 2)
Display a 2d array? Use this useful function.
- PythonFunctions.Board.DisplayBoard(brd, colourData)
Prints out the 2D array in the terrminal
- Parameters
brd (list[list[str]]) – The 2D array
colourData (dict) – Optional, The colour to make each item
If you want to use the colourData option, assaign it like this, with the string on the left and the colour info (Read colours) as the colour You can replace 033[32m with anything from the Colours module