Nov-03-2016, 06:51 PM
Hello, I would like to create a game board, with is something like that :
x x x x
x x x x
. . . .
. . . .
o o o o
o o o o
I would like to create this :
A « newBoard(n,p) » function where n and p are positive integers, with n > 4. It returns a two dimensions list that represent the initial state of a board composed of n rows and p columns.
The board will naturally be a two-dimensional list of integers equal to 0, 1 or 2. An empty square will be represented by a 0, a pawn of the first player by a 1 and a pawn of the second player by a 2.
I don't know how to create this type of grid like for example, if I enter n=8, p=3 i want this:
x x x
x x x
. . .
. . .
. . .
. . .
o o o
o o o
can some1 help me plz ?
x x x x
x x x x
. . . .
. . . .
o o o o
o o o o
I would like to create this :
A « newBoard(n,p) » function where n and p are positive integers, with n > 4. It returns a two dimensions list that represent the initial state of a board composed of n rows and p columns.
The board will naturally be a two-dimensional list of integers equal to 0, 1 or 2. An empty square will be represented by a 0, a pawn of the first player by a 1 and a pawn of the second player by a 2.
I don't know how to create this type of grid like for example, if I enter n=8, p=3 i want this:
x x x
x x x
. . .
. . .
. . .
. . .
o o o
o o o
can some1 help me plz ?