Home
Manifold
Alcazar
Blog
Shop
contact
Try Alcazar in your browser.
I CONTROL THE PUZZLE
Premade Puzzles
Size
Walls ("Clues")
A0-- A1--
Solution
B0-- B0A0 A0A1 A1B1 B1--
Make Puzzle
Save Puzzle
Note: User-submitted puzzles are not always well-formed or solvable.
Play the real Alcazar game here
I CONTROL THE PUZZLE CONTROLLER
Grid Size
2
3
4
5
6
7
8
9
10
x
2
3
4
5
6
7
8
9
10
12
16
18
Random Seed
Randomize
Make me a puzzle!!!!
Generate
Reveal Generator
%% define grid of cells #const width=6. #const height=9. cell((0..width+1,0..height+1)). inner_cell((1..width,1..height)). dir(u;d;l;r). shift(u, 0, 1). shift(d, 0,-1). shift(l,-1, 0). shift(r, 1, 0). adj((X1,Y1),D,(X2,Y2)) :- inner_cell((X1,Y1)); cell((X2,Y2)); X2 = X1 + DX; Y2 = Y1 + DY; shift(D,DX,DY). outer_cell(C2) :- adj(C1,D,C2); not inner_cell(C2). %% generate walls { wall(C1,C2) : adj(C1,D,C2) }. wall(C2,C1) :- wall(C1,C2). % force symmetry of walls :- N = #count { adj(C1,D,C2):adj(C1,D,C2)}, N/3 { wall(C1,C2) }. % walls forced by level description format wall((0,1),(1,1)). wall((width,1),(width+1,1)). wall((0,height),(1,height)). wall((width+1,height),(width,height)). %% generate solution 2 { terminus(C) : outer_cell(C) } 2. 2 { path(C1,C2) : adj(C1,D,C2) } 2 :- inner_cell(C1). :- inner_cell(C2); path(C1,C2); not path(C2,C1). % path symmetry :- path(C1,C2); outer_cell(C2); not terminus(C2). % every outward path uses a terminus :- terminus(C2); adj(C1,D,C2); not path(C1,C2). % every terminus uses an outward path :- path(C1,C2); wall(C1,C2). % wall enforcement % HACK: reference solution is all connected reached(C) :- terminus(C). reached(C1) :- path(C1,C2); reached(C2). :- inner_cell(C); not reached(C). %% check uniqueness using saturation idiom % guess alternate solution with disjunctions alt_terminus(C)|blt_terminus(C) :- outer_cell(C). alt_path(C1,C2)|blt_path(C1,C2) :- adj(C1,D,C2). same_terminus(C) :- alt_terminus(C); terminus(C). same_terminus(C) :- blt_terminus(C); not terminus(C). same_path(C1,C2) :- alt_path(C1,C2); path(C1,C2). same_path(C1,C2) :- blt_path(C1,C2); not path(C1,C2). % is the supposedly alternate solution should not be identical to reference bot :- same_terminus(C):outer_cell(C); same_path(C1,C2):adj(C1,D,C2). % force exactly two termini bot :- 3 { alt_terminus(C) }. bot :- N = #count { outer_cell(C):outer_cell(C) }; N-1 { blt_terminus(C):outer_cell(C) }. % force exactly two paths per inner_cell bot :- inner_cell(C1); 3 { alt_path(C1,C2) }. bot :- inner_cell(C1); 3 { blt_path(C1,C2) }. bot :- inner_cell(C2); alt_path(C1,C2); blt_path(C2,C1). % path symmetry bot :- outer_cell(C2); alt_path(C1,C2); blt_terminus(C2). % every outward path uses a terminus bot :- alt_terminus(C2); adj(C1,D,C2); blt_path(C1,C2). % every terminus uses an outward path bot :- alt_path(C1,C2); wall(C1,C2). % wall enforcement % saturation alt_terminus(C) :- bot; outer_cell(C). blt_terminus(C) :- bot; outer_cell(C). alt_path(C1,C2) :- bot; adj(C1,D,C2). blt_path(C1,C2) :- bot; adj(C1,D,C2). :- not bot. #show adj/3. #show wall/2. #show terminus/1. #show path/2. param("width",width). param("height",height). #show param/2. #show outer_cell/1. %#show alt_path/2. %#show bot/0.
Newsletter
Thanks for signing up!
The Incredible Company
Close