List all the possible actions on a 4x4 board in Prolog

How can I list all possible boards after (for example), one player performs an action on a 4x4 board (with 8 different pions)?

Peonies should be, for example:

([1,2,3,4,5,6,7,8])

and every time you play once, it cannot be reused.

The board should be like this board

([1,1,-,-],(1,2,-,-)...(1,3,-,-)(1,4,-,-)
 [2,1,-,-],(2,2,-,-)...(2,3,-,-)(2,4,-,-)
 [3,1,-,-],(3,2,-,-)...(3,3,-,-)(3,4,-,-)
 [4,1,-,-],(4,2,-,-)...(4,3,-,-)(4,4,-,-)

And one player in a round puts one peony on the board until it is full.

+5
source share
1 answer

, board0_move_board/3, B, M M B. , board_move/2, , , . :

findall(Board, (board_move(Board0, Move), board0_move_board(Board0, Move, Board)), Boards)
+2

All Articles