Hi Guys,
I'm new at prolog, and for now i'm yet learning on how to do this kind of programming.
The problem is: I have a list with number that are for a game. That game is a board game and always with equal lines/cols like 2x2 ,3x3, 10x10, etc...
I have created a single list to have those numbers; now i would like to have that list separated in a list of lists this way: if i have a 10x10 board i want 10 lists of 10 numbers each inside a list, and if it is 3x3 i want 3 lists of 3 numbers each inside a list, and so on...
For example:
a 3x3 board
L = [4 , 5, 6, 4, 1 , 3, 5, 6, 8]
Should be
L = [[4,5,6],[4,1,3],[5,6,8]]
I'm new at prolog, and for now i'm yet learning on how to do this kind of programming.
The problem is: I have a list with number that are for a game. That game is a board game and always with equal lines/cols like 2x2 ,3x3, 10x10, etc...
I have created a single list to have those numbers; now i would like to have that list separated in a list of lists this way: if i have a 10x10 board i want 10 lists of 10 numbers each inside a list, and if it is 3x3 i want 3 lists of 3 numbers each inside a list, and so on...
For example:
a 3x3 board
L = [4 , 5, 6, 4, 1 , 3, 5, 6, 8]
Should be
L = [[4,5,6],[4,1,3],[5,6,8]]