Ludii Forum
Pattern recognition - Printable Version

+- Ludii Forum (https://ludii.games/forums)
+-- Forum: Suggestions (https://ludii.games/forums/forumdisplay.php?fid=10)
+--- Forum: Ludii Features / Services (https://ludii.games/forums/forumdisplay.php?fid=11)
+--- Thread: Pattern recognition (/showthread.php?tid=114)

Pages: 1 2 3


RE: Pattern recognition - Eric Piette - 11-26-2020

Hi,

We have a (while ...) ludeme. So yes you can do what you mean with it.

Regards,
Eric


RE: Pattern recognition - AlekErickson - 11-28-2020

Can you give me more examples than Xanan Zirge for identifying whether pieces are in the crosscut?

I need to make it so that only pieces inside the crosscut can be swapped. For instance - the commented line - how would I incorporate such a condition (swaps must resolve a cut) in a way that works?


(define "IsNotCut" (not (is Pattern {F R F R F} whats:{(mover) (next)})))
(game "Test"
(players 2)
(equipment {(board (square 8))
(piece "Ball" Each
(forEach Site
(sites Around (from)
if:(is Enemy (who at:(to)))
)
(move Swap Pieces (from) (site))
)
)
(regions P1 { (sites Side N) (sites Side S) } )
(regions P2 { (sites Side W) (sites Side E) } )
})
(rules
(start {(place "Ball1" (sites {56 58 60 62 49 51 53 55 40 42 44 46 33 35 37 39 24 26 28 30 17 19 21 23 8 10 12 14 1 3 5 7} )) (place "Ball2" (sites {0 2 4 6 9 11 13 15 16 18 20 22 25 27 29 31 32 34 36 38 41 43 45 47 48 50 52 54 57 59 61 63}))} )


(play

(forEach Piece)
// ifAfterwards:"IsNotCut"

)
(end {(if (is Connected Orthogonal Mover) (result Mover Win))})
)
)


RE: Pattern recognition - Eric Piette - 11-30-2020

Hi,

Just to be sure, you want to be able to swap pieces belonging only to a crosscut pattern and if after making your move, you are still in a crosscut pattern?

Regards,
Eric


RE: Pattern recognition - AlekErickson - 11-30-2020

Hi Eric, thanks for your response. I will tell you exactly what I'm trying to achieve with this.

I want a turn to consist of one of two options:

option 1:
a) adding a stone to an empty square.
b) if and only if this generates a crosscut, swap that stone with an adjacent enemy stone in the same crosscut.
c) Continue swapping until that stone is no longer in a cross cut.

option 2:
a) select a stone already in a crosscut, and swap as above.
b) then add a stone to an empty square.


RE: Pattern recognition - Eric Piette - 11-30-2020

Hi,

So for b) That's up to the player to select with which piece to swap no?
If this is the case you will have to check if the last piece added is in a crosscut pattern, if that's the case (moveAgain).
Then in the next move, allow the player to swap the last piece played to one of the enemy piece in the crosscut, if that piece still belong to a crosscut pattern (moveAgain) once again etc.... until no crosscut pattern is detected.

However that would be much easier with a (sites Pattern ...) ludeme to get all the sites in the pattern. 

Regards,
Eric


RE: Pattern recognition - AlekErickson - 11-30-2020

Thank you Eric, it would make my life a lot easier if you could expand on these ludemes in the way you describe!


RE: Pattern recognition - AlekErickson - 12-03-2020

Hi, I was wondering if there is an update when the (sites Pattern) ludeme will be available.


RE: Pattern recognition - Eric Piette - 12-04-2020

Hi,

No special date for it to be added, I will try to do it between two others jobs :)
When I will do it, I will warn you here.

Regards,
Eric


RE: Pattern recognition - Eric Piette - 12-14-2020

Hi Alek,

The new ludeme (sites Pattern ...) will be there in the next release.

Regards,
Eric


RE: Pattern recognition - AlekErickson - 12-14-2020

Thanks eric!
I will try to see if i can figure out how to use it :D