Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f88f796

Browse files
author
Shati Patel
committed
QL etudes: Update predicate
1 parent f94b01c commit f88f796

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

docs/language/learn-ql/ql-etudes/river-crossing-1.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class State extends string {
5656
* Holds if predator and prey are on the same shore and the man
5757
* is not present.
5858
*/
59-
predicate eats(Shore predator, Shore prey) { predator = prey and man = predator.other() }
59+
predicate eats(Shore predator, Shore prey) { predator = prey and man != predator }
6060

6161
/** Holds if nothing gets eaten in this state. */
6262
predicate isSafe() { not (eats(goat, cabbage) or eats(wolf, goat)) }

docs/language/learn-ql/ql-etudes/river-crossing.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class State extends string {
6969
* Holds if predator and prey are on the same shore and the man
7070
* is not present.
7171
*/
72-
predicate eats(Shore predator, Shore prey) { predator = prey and man = predator.other() }
72+
predicate eats(Shore predator, Shore prey) { predator = prey and man != predator }
7373

7474
/** Holds if nothing gets eaten in this state. */
7575
predicate isSafe() { not (eats(goat, cabbage) or eats(wolf, goat)) }

0 commit comments

Comments
 (0)