Game Othello (Reversi), flipping, Prolog

I am using the Othello game in Prolog. The game board is presented as a list of lists.

I had a problem with turning pieces after moving.

My strategy is to look in all 8 directions from the position where I placed my part (for example, black),

and find the closed black part and flip each white part between my parts.

So, I have 8 separate predicates for this.

The problem is that I call them sequentially after performing the move, and if any of these predicates fails, it all fails.

Is there any way around this? Or maybe my approach is wrong?

+3
source share
2 answers

Cari Norum, , . , - , . , .

0

, ?

, CS uni, , stackoverflow ...;)

0

Source: https://habr.com/ru/post/1732714/


All Articles