03-10-2021, 09:58 AM
(This post was last modified: 03-10-2021, 09:59 AM by dale walton.)

I have got to the point of getting some output yielding movement.

Looking at the full moves in compasison to the code Ludii is processing the script out of order:

The itterated (remember) statement should all be completed before the (then) in the (and) statement is executed, and thus before the actual movements are calculated. Because of this the moves generated seem somewhat random.

please check the code and suggest a correction/workaround and also kindly fix this longstanding (and) bug.

Moves:

7. [(Select Cell 15 - Cell 16), (Remember Value 'D1' 6), (Move 6-7), (Move 6-8), (Move 6-9), (Move 6-10), (Remember Value 'D1' 12), (Remember Value 'D1' 13), (Move 13-14), (Move 13-15), (Move 13-16), (Move 13-17), (Remember Value 'D2' 7), (Move 12-13), (Remember Value 'D2' 13), (Remember Value 'D2' 14)]

8. [(Select Cell 44 - Cell 30), (Remember Value 'D1' 23), (Move 30-22), (Move 23-15), (Move 15-8), (Forget Value 'D1' 23), (Forget Value 'D1' 30), (Forget Value 'D1' 31), (Forget Value 'D1' 23), (Forget Value 'D2' 15), (Forget Value 'D2' 22), (Forget Value 'D2' 23), (Move 15-2), (Move 23-8), (Move 23-2), (Remember Value 'D1' 30), (Remember Value 'D1' 31), (Move 31-23), (Move 31-15), (Remember Value 'D2' 15), (Remember Value 'D2' 22), (Remember Value 'D2' 23)]

(define "Shift"

(slide

(from Vertex #1)

(directions Cell from:(last From) to:(last To))

// (between (exact 0))

// (to Vertex)

))

(define "Plow"

(move Select

(from Cell (sites Board Cell) if:("IsDozerLocation" (from)))

(to Cell (sites Around Cell (from) OffDiagonal))

(then

(and

{

(forEach Site ("DozerLocation" (last From)) (remember Value "D1" (site)))

(forEach Site ("DozerLocation" (last To)) (remember Value "D2" (site)))

}

(then

(forEach Site

(difference (sites (values Remembered "D1")) (sites (values Remembered "D2")))

("Shift" (site))

(then

(forEach Site

(intersection (sites (values Remembered "D1")) (sites (values Remembered "D2")))

("Shift" (site))

(then

(forEach Site

(difference (sites (values Remembered "D2")) (sites (values Remembered "D1")))

("Shift" (site))

(then (forget Value All))

))))))))))

Looking at the full moves in compasison to the code Ludii is processing the script out of order:

The itterated (remember) statement should all be completed before the (then) in the (and) statement is executed, and thus before the actual movements are calculated. Because of this the moves generated seem somewhat random.

please check the code and suggest a correction/workaround and also kindly fix this longstanding (and) bug.

Moves:

7. [(Select Cell 15 - Cell 16), (Remember Value 'D1' 6), (Move 6-7), (Move 6-8), (Move 6-9), (Move 6-10), (Remember Value 'D1' 12), (Remember Value 'D1' 13), (Move 13-14), (Move 13-15), (Move 13-16), (Move 13-17), (Remember Value 'D2' 7), (Move 12-13), (Remember Value 'D2' 13), (Remember Value 'D2' 14)]

8. [(Select Cell 44 - Cell 30), (Remember Value 'D1' 23), (Move 30-22), (Move 23-15), (Move 15-8), (Forget Value 'D1' 23), (Forget Value 'D1' 30), (Forget Value 'D1' 31), (Forget Value 'D1' 23), (Forget Value 'D2' 15), (Forget Value 'D2' 22), (Forget Value 'D2' 23), (Move 15-2), (Move 23-8), (Move 23-2), (Remember Value 'D1' 30), (Remember Value 'D1' 31), (Move 31-23), (Move 31-15), (Remember Value 'D2' 15), (Remember Value 'D2' 22), (Remember Value 'D2' 23)]

(define "Shift"

(slide

(from Vertex #1)

(directions Cell from:(last From) to:(last To))

// (between (exact 0))

// (to Vertex)

))

(define "Plow"

(move Select

(from Cell (sites Board Cell) if:("IsDozerLocation" (from)))

(to Cell (sites Around Cell (from) OffDiagonal))

(then

(and

{

(forEach Site ("DozerLocation" (last From)) (remember Value "D1" (site)))

(forEach Site ("DozerLocation" (last To)) (remember Value "D2" (site)))

}

(then

(forEach Site

(difference (sites (values Remembered "D1")) (sites (values Remembered "D2")))

("Shift" (site))

(then

(forEach Site

(intersection (sites (values Remembered "D1")) (sites (values Remembered "D2")))

("Shift" (site))

(then

(forEach Site

(difference (sites (values Remembered "D2")) (sites (values Remembered "D1")))

("Shift" (site))

(then (forget Value All))

))))))))))

**Attached Files**

Oomph bugs2.lud (Size: 6.73 KB / Downloads: 1)

Oomph bug2.trl (Size: 2.53 KB / Downloads: 1)