Skip to content

Instantly share code, notes, and snippets.

@pavlus
Created December 27, 2021 13:44
Show Gist options
  • Select an option

  • Save pavlus/3c4141775f58878eaaff5088065765f2 to your computer and use it in GitHub Desktop.

Select an option

Save pavlus/3c4141775f58878eaaff5088065765f2 to your computer and use it in GitHub Desktop.
Dishonored 2 Jindosh lock puzzle solver wth Alloy
open util/ordering[Character]
abstract sig Character {
color: disj one Color,
from: disj one City,
drinks: disj one Drink,
owns: disj one Heirloom
}
one sig Winslow, Marcolla, Contee, Natsiou, Finch extends Character{}
enum Color {Red, Blue, Purple, White, Green}
enum City{Fraeport, Dunwall, Baleton, Dabokva, Karnaca}
enum Drink{Wine, Rum, Absinthe, Beer, Whiskey}
enum Heirloom{SnuffTin, WarMedal, BirdPendant, Ring, Diamond}
let center = first.next.next
// from puzzle rules
fact {
Winslow.color = Purple
first = Marcolla
Marcolla.next.color = Blue
~color[Red].next = ~color[Green]
~color[Red].drinks = Whiskey
~from[Dabokva].color = White
~owns[SnuffTin].hasNeighbour[~from[Dabokva]]
Contee.owns = WarMedal
~from[Fraeport] = ~owns[Ring]
~owns[BirdPendant].hasNeighbour[~from[Dunwall]]
~from[Dunwall].hasNeighbour[~drinks[Absinthe]]
Finch.drinks = Rum
~from[Karnaca].drinks = Wine
center.drinks = Beer
Natsiou.from = Baleton
}
pred Character.hasNeighbour [c: Character]{ c in this.(prev+next) }
run {} for 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment