% sokoba.pi: for the Sokoban puzzle in Picat % NOTICE: This version finds a plan by reversing roles of stones and goals. % It requires the number stones to be equal to the number of goal locations. % by Neng-Fa Zhou, May 21, 2014, % the Sokoban parser was added by John Connor (after edit by N.F.) % to use, type: % % picat sokoban SokobanFile import planner. main([File]) => % read Sokoban file parse_file(File,Data), asp(Data). main => test. % ####### % #. ...# % # \$ # # % #\$#\$\$@# % # ## % # ## % ##### % parse_file(File, Data) => Lines = read_file_lines(File), NRows = len(Lines), NCols = max([len(Line) : Line in Lines]), M = new_array(NRows, NCols), foreach (R in 1..NRows) foreach (C in 1..len(Lines[R])) M[R,C] = Lines[R,C] end end, L = [], foreach (R in 1..NRows, C in 1..NCols, not_wall(M,R,C)) Pos = position(R,C), add_facts(M,NRows,NCols,M[R,C],R,C,Pos,Facts), L := Facts ++ L end, Data = L. add_facts(M,NRows,NCols,'@',R,C,Pos,Facts) => Facts = [\$player(conor),\$at(conor,Pos)|Neibs], add_neibs(M,NRows,NCols,R,C,Pos,Neibs). add_facts(M,NRows,NCols,'\$',R,C,Pos,Facts) => Facts = [\$stone(Pos),\$at(Pos,Pos),\$goal(Pos)|Neibs], add_neibs(M,NRows,NCols,R,C,Pos,Neibs). add_facts(M,NRows,NCols,'.',R,C,Pos,Facts) => Facts = [\$isgoal(Pos)|Neibs], add_neibs(M,NRows,NCols,R,C,Pos,Neibs). add_facts(M,NRows,NCols,' ',R,C,Pos,Facts) => add_neibs(M,NRows,NCols,R,C,Pos,Facts). add_facts(_M,_NRows,_NCols,_,_R,_C,_Pos,Facts) => Facts = []. add_neibs(M,NRows,NCols,R,C,Pos,Facts) => Ps = [(R1,C1,Dir) : (R1,C1,Dir) in [(R,C-1,left),(R,C+1,right),(R-1,C,up),(R+1,C,down)], R1 >= 1, R1 =< NRows, C1 >= 1, C1 =< NCols, not_wall(M,R1,C1)], Facts = [\$movedir(Pos,PosPrime,Dir) : Pos2 in Ps, Pos2 = (R1,C1,Dir), PosPrime = position(R1,C1)]. not_wall(M,R,C) => nonvar(M[R,C]), M[R,C] !== '#'. position(R,C) = to_atom("row" ++ to_string(R) ++ "col" ++ to_string(C)). asp(As) => initialize_table, cl_facts(As), findall(Loc,isgoal(Loc)).sort() = GLocs, best_plan(\$s(dummy_loc,GLocs),Plan), output_plan(Plan.reverse(),1), println(len=len(Plan)). final(s(SoLoc,GLocs)) => init_sokoban_loc(SoLoc), foreach (GLoc in GLocs) init_goal_stone_loc(GLoc) % the goals have been "pulled" to the stones' initial locations end. table init_sokoban_loc(dummy_loc) => true. % for the case when all the stones are already in the goal locations in the beginning init_sokoban_loc(Loc) => player(Sokoban), at(Sokoban,Loc). table init_goal_stone_loc(Loc) => stone(Stone), at(Stone,Loc). % decide the first goal to pull action(s(dummy_loc,BoxLocs),NewS,Action,Cost) => select(BoxLoc,BoxLocs,BoxLocs1), neib(PrevLoc,BoxLoc,Dir), not member(PrevLoc,BoxLocs1), neib(PrevPrevLoc,PrevLoc,Dir), not member(PrevPrevLoc,BoxLocs1), NewS = \$s(PrevLoc,BoxLocs), Action = dummy_action, Cost = 0. % this basically decides the ending location for Sokoban so Cost=0 action(s(SoLoc,BoxLocs),NewS,Action,Cost) ?=> % select a goal to pull NewS = \$s(NewSoLoc,NewBoxLocs), Action = \$pull(BoxLoc,NewBoxLoc,Dir), Cost=1, select(BoxLoc,BoxLocs,BoxLocs1), neib(SoLoc,BoxLoc,Dir), % Sokoban is in front of the goal to pull neib(PrevLoc,SoLoc,Dir), not member(PrevLoc,BoxLocs1), choose_move_destination(PrevLoc,BoxLocs1,Dir,NewSoLoc), neib(NewSoLoc,NewBoxLoc,Dir), insert_ordered(BoxLocs1,NewBoxLoc) = NewBoxLocs. action(s(SoLoc,BoxLocs),NewS,Action,Cost) => % Sokoban moves from one location to another NewS = \$s(NewSoLoc,BoxLocs), Action = \$move(SoLoc,NewSoLoc,Dir), Cost=1, neib(PrevLoc,SoLoc,Dir), not member(PrevLoc,BoxLocs), choose_move_destination(PrevLoc,BoxLocs,Dir,NewSoLoc). table neib(Loc1,Loc2,Dir) => movedir(Loc1,Loc2,Dir). % choose a moving destination against the direction Dir choose_move_destination(Loc,_BoxLocs,_Dir,Dest) ?=> Dest=Loc. choose_move_destination(Loc,BoxLocs,Dir,Dest) => neib(PrevLoc,Loc,Dir), not member(PrevLoc,BoxLocs), choose_move_destination(PrevLoc,BoxLocs,Dir,Dest). output_plan([_],_I) => true. % ignore dummy action output_plan([move(From,To,Dir)|Plan],I) => printf("move(%w,%w,%w,%w). %n",To,From,Dir,I), output_plan(Plan,I+1). output_plan([pull(DestLoc,PrevLoc,Dir)|Plan],I) => printf("push(%w,%w,%w,%w). %n",PrevLoc,DestLoc,Dir,I), output_plan(Plan,I+1). % ####### % #. ...# % # \$ # # % #\$#\$\$@# % # ## % # ## % ##### % test => asp(\$[movedir(53,52,dir_up), movedir(52,53,dir_down), movedir(52,51,dir_up), movedir(51,52,dir_down), movedir(41,51,dir_right), movedir(51,41,dir_left), movedir(32,31,dir_up), movedir(31,32,dir_down), movedir(33,32,dir_up), movedir(32,33,dir_down), movedir(34,33,dir_up), movedir(33,34,dir_down), movedir(35,34,dir_up), movedir(34,35,dir_down), movedir(25,24,dir_up), movedir(24,25,dir_down), movedir(24,34,dir_right), movedir(34,24,dir_left), movedir(14,13,dir_up), movedir(13,14,dir_down), movedir(13,12,dir_up), movedir(12,13,dir_down), movedir(12,11,dir_up), movedir(11,12,dir_down), movedir(11,21,dir_right), movedir(21,11,dir_left), movedir(22,21,dir_up), movedir(21,22,dir_down), movedir(22,32,dir_right), movedir(32,22,dir_left), movedir(21,31,dir_right), movedir(31,21,dir_left), movedir(12,22,dir_right), movedir(22,12,dir_left), movedir(15,14,dir_up), movedir(14,15,dir_down), movedir(15,25,dir_right), movedir(25,15,dir_left), movedir(14,24,dir_right), movedir(24,14,dir_left), movedir(25,35,dir_right), movedir(35,25,dir_left), movedir(34,44,dir_right), movedir(44,34,dir_left), movedir(44,43,dir_up), movedir(43,44,dir_down), movedir(43,53,dir_right), movedir(53,43,dir_left), movedir(33,43,dir_right), movedir(43,33,dir_left), movedir(31,41,dir_right), movedir(41,31,dir_left), at(stone33,33), stone(stone33), goal(stone33), at(stone13,13), stone(stone13), goal(stone13), at(stone22,22), stone(stone22), goal(stone22), at(stone43,43), stone(stone43), goal(stone43), isgoal(51), isgoal(41), isgoal(31), isgoal(11), at(player53,53), player(player53), step(1), step(2), step(3), step(4), step(5), step(6), step(7), step(8), step(9), step(10), step(11), step(12), step(13), step(15), step(16), step(17), step(18), step(19), step(20), step(21), step(22), step(23), step(24), step(25), step(26), step(27), step(28), step(29), step(30), step(31), step(32)]). test0 => asp(\$[player(player_01),stone(stone_01),isgoal(pos_4_2),isnongoal(pos_1_1),isnongoal(pos_1_2),isnongoal(pos_1_3),isnongoal(pos_2_1),isnongoal(pos_2_2),isnongoal(pos_2_3),isnongoal(pos_3_1),isnongoal(pos_3_2),isnongoal(pos_3_3),isnongoal(pos_4_1),isnongoal(pos_4_3),isnongoal(pos_5_1),isnongoal(pos_5_2),isnongoal(pos_5_3),movedir(pos_2_2,pos_3_2,dir_right),movedir(pos_3_2,pos_2_2,dir_left),movedir(pos_3_2,pos_4_2,dir_right),movedir(pos_4_2,pos_3_2,dir_left),at(player_01,pos_2_2),at(stone_01,pos_3_2),clear(pos_4_2),goal(stone_01),step(1),step(2),step(3)]). test1 => asp(\$[movedir(44,43,dir_up), movedir(43,44,dir_down), movedir(43,42,dir_up), movedir(42,43,dir_down), movedir(42,52,dir_right), movedir(52,42,dir_left), movedir(52,62,dir_right), movedir(62,52,dir_left), movedir(62,72,dir_right), movedir(72,62,dir_left), movedir(72,82,dir_right), movedir(82,72,dir_left), movedir(82,81,dir_up), movedir(81,82,dir_down), movedir(81,91,dir_right), movedir(91,81,dir_left), movedir(92,91,dir_up), movedir(91,92,dir_down), movedir(93,92,dir_up), movedir(92,93,dir_down), movedir(94,93,dir_up), movedir(93,94,dir_down), movedir(95,94,dir_up), movedir(94,95,dir_down), movedir(95,105,dir_right), movedir(105,95,dir_left), movedir(105,104,dir_up), movedir(104,105,dir_down), movedir(104,103,dir_up), movedir(103,104,dir_down), movedir(103,102,dir_up), movedir(102,103,dir_down), movedir(102,101,dir_up), movedir(101,102,dir_down), movedir(85,84,dir_up), movedir(84,85,dir_down), movedir(84,83,dir_up), movedir(83,84,dir_down), movedir(83,82,dir_up), movedir(82,83,dir_down), movedir(83,93,dir_right), movedir(93,83,dir_left), movedir(84,94,dir_right), movedir(94,84,dir_left), movedir(85,95,dir_right), movedir(95,85,dir_left), movedir(94,104,dir_right), movedir(104,94,dir_left), movedir(93,103,dir_right), movedir(103,93,dir_left), movedir(92,102,dir_right), movedir(102,92,dir_left), movedir(91,101,dir_right), movedir(101,91,dir_left), movedir(82,92,dir_right), movedir(92,82,dir_left), movedir(32,42,dir_right), movedir(42,32,dir_left), movedir(23,22,dir_up), movedir(22,23,dir_down), movedir(24,23,dir_up), movedir(23,24,dir_down), movedir(25,24,dir_up), movedir(24,25,dir_down), movedir(26,25,dir_up), movedir(25,26,dir_down), movedir(26,36,dir_right), movedir(36,26,dir_left), movedir(36,35,dir_up), movedir(35,36,dir_down), movedir(35,34,dir_up), movedir(34,35,dir_down), movedir(34,44,dir_right), movedir(44,34,dir_left), movedir(35,45,dir_right), movedir(45,35,dir_left), movedir(45,44,dir_up), movedir(44,45,dir_down), movedir(46,45,dir_up), movedir(45,46,dir_down), movedir(46,56,dir_right), movedir(56,46,dir_left), movedir(56,55,dir_up), movedir(55,56,dir_down), movedir(55,54,dir_up), movedir(54,55,dir_down), movedir(54,64,dir_right), movedir(64,54,dir_left), movedir(65,64,dir_up), movedir(64,65,dir_down), movedir(66,65,dir_up), movedir(65,66,dir_down), movedir(55,65,dir_right), movedir(65,55,dir_left), movedir(56,66,dir_right), movedir(66,56,dir_left), movedir(45,55,dir_right), movedir(55,45,dir_left), movedir(36,46,dir_right), movedir(46,36,dir_left), movedir(25,35,dir_right), movedir(35,25,dir_left), movedir(24,34,dir_right), movedir(34,24,dir_left), movedir(13,12,dir_up), movedir(12,13,dir_down), movedir(12,22,dir_right), movedir(22,12,dir_left), movedir(13,23,dir_right), movedir(23,13,dir_left), movedir(22,32,dir_right), movedir(32,22,dir_left), movedir(44,54,dir_right), movedir(54,44,dir_left), at(stone82,82), stone(stone82), goal(stone82), at(stone34,34), stone(stone34), goal(stone34), isgoal(32), isgoal(22), at(player44,44), player(player44), step(1), step(2), step(3), step(4), step(5), step(6), step(7), step(8), step(9), step(10), step(11)]). test2 => asp(\$[movedir(13,14,dir_right), movedir(14,13,dir_left), movedir(22,23,dir_right), movedir(23,22,dir_left), movedir(23,24,dir_right), movedir(24,23,dir_left), movedir(33,34,dir_right), movedir(34,33,dir_left), movedir(43,44,dir_right), movedir(44,43,dir_left), movedir(44,45,dir_right), movedir(45,44,dir_left), movedir(52,53,dir_right), movedir(53,52,dir_left), movedir(53,54,dir_right), movedir(54,53,dir_left), movedir(54,55,dir_right), movedir(55,54,dir_left), movedir(62,63,dir_right), movedir(63,62,dir_left), movedir(63,64,dir_right), movedir(64,63,dir_left), movedir(64,65,dir_right), movedir(65,64,dir_left), movedir(62,52,dir_up), movedir(52,62,dir_down), movedir(23,13,dir_up), movedir(13,23,dir_down), movedir(33,23,dir_up), movedir(23,33,dir_down), movedir(43,33,dir_up), movedir(33,43,dir_down), movedir(53,43,dir_up), movedir(43,53,dir_down), movedir(63,53,dir_up), movedir(53,63,dir_down), movedir(24,14,dir_up), movedir(14,24,dir_down), movedir(34,24,dir_up), movedir(24,34,dir_down), movedir(44,34,dir_up), movedir(34,44,dir_down), movedir(54,44,dir_up), movedir(44,54,dir_down), movedir(64,54,dir_up), movedir(54,64,dir_down), movedir(55,45,dir_up), movedir(45,55,dir_down), movedir(65,55,dir_up), movedir(55,65,dir_down), at(player22,22), player(player22), at(stone23,23), stone(stone23), goal(stone23), at(stone33,33), stone(stone33), goal(stone33), at(stone44,44), stone(stone44), goal(stone44), isgoal(52), at(stone53,53), stone(stone53), goal(stone53), isgoal(62), isgoal(63), at(stone64,64), stone(stone64), goal(stone64), isgoal(64), isgoal(65), step(1), step(2), step(3), step(4), step(5), step(6), step(7), step(8), step(9), step(10), step(11), step(12), step(13), step(14), step(15), step(16), step(17), step(18), step(19), step(20), step(21), step(22), step(23), step(24), step(25), step(26), step(27), step(28), step(29), step(30)]). test3 => asp(\$[movedir(13,14,dir_right), movedir(14,13,dir_left), movedir(22,23,dir_right), movedir(23,22,dir_left), movedir(23,24,dir_right), movedir(24,23,dir_left), movedir(33,34,dir_right), movedir(34,33,dir_left), movedir(43,44,dir_right), movedir(44,43,dir_left), movedir(44,45,dir_right), movedir(45,44,dir_left), movedir(52,53,dir_right), movedir(53,52,dir_left), movedir(53,54,dir_right), movedir(54,53,dir_left), movedir(54,55,dir_right), movedir(55,54,dir_left), movedir(62,63,dir_right), movedir(63,62,dir_left), movedir(63,64,dir_right), movedir(64,63,dir_left), movedir(64,65,dir_right), movedir(65,64,dir_left), movedir(62,52,dir_up), movedir(52,62,dir_down), movedir(23,13,dir_up), movedir(13,23,dir_down), movedir(33,23,dir_up), movedir(23,33,dir_down), movedir(43,33,dir_up), movedir(33,43,dir_down), movedir(53,43,dir_up), movedir(43,53,dir_down), movedir(63,53,dir_up), movedir(53,63,dir_down), movedir(24,14,dir_up), movedir(14,24,dir_down), movedir(34,24,dir_up), movedir(24,34,dir_down), movedir(44,34,dir_up), movedir(34,44,dir_down), movedir(54,44,dir_up), movedir(44,54,dir_down), movedir(64,54,dir_up), movedir(54,64,dir_down), movedir(55,45,dir_up), movedir(45,55,dir_down), movedir(65,55,dir_up), movedir(55,65,dir_down), at(player22,22), player(player22), at(stone23,23), stone(stone23), at(stone33,33), stone(stone33), at(stone44,44), stone(stone44), goal(stone44), isgoal(52), at(stone53,53), stone(stone53), goal(stone53), isgoal(62), isgoal(63), at(stone64,64), stone(stone64), goal(stone64), isgoal(64), isgoal(65), step(1), step(2), step(3), step(4), step(5), step(6), step(7), step(8), step(9), step(10), step(11), step(12), step(13), step(14), step(15), step(16), step(17), step(18), step(19), step(20), step(21), step(22), step(23), step(24), step(25), step(26), step(27), step(28), step(29), step(30)]). test4 => asp(\$[movedir(66,65,dir_up), movedir(65,66,dir_down), movedir(65,64,dir_up), movedir(64,65,dir_down), movedir(64,63,dir_up), movedir(63,64,dir_down), movedir(63,62,dir_up), movedir(62,63,dir_down), movedir(62,61,dir_up), movedir(61,62,dir_down), movedir(61,71,dir_right), movedir(71,61,dir_left), movedir(72,71,dir_up), movedir(71,72,dir_down), movedir(73,72,dir_up), movedir(72,73,dir_down), movedir(74,73,dir_up), movedir(73,74,dir_down), movedir(75,74,dir_up), movedir(74,75,dir_down), movedir(76,75,dir_up), movedir(75,76,dir_down), movedir(76,86,dir_right), movedir(86,76,dir_left), movedir(86,85,dir_up), movedir(85,86,dir_down), movedir(75,85,dir_right), movedir(85,75,dir_left), movedir(52,51,dir_up), movedir(51,52,dir_down), movedir(53,52,dir_up), movedir(52,53,dir_down), movedir(54,53,dir_up), movedir(53,54,dir_down), movedir(55,54,dir_up), movedir(54,55,dir_down), movedir(56,55,dir_up), movedir(55,56,dir_down), movedir(56,66,dir_right), movedir(66,56,dir_left), movedir(55,65,dir_right), movedir(65,55,dir_left), movedir(54,64,dir_right), movedir(64,54,dir_left), movedir(44,43,dir_up), movedir(43,44,dir_down), movedir(43,53,dir_right), movedir(53,43,dir_left), movedir(44,54,dir_right), movedir(54,44,dir_left), movedir(35,34,dir_up), movedir(34,35,dir_down), movedir(25,24,dir_up), movedir(24,25,dir_down), movedir(24,23,dir_up), movedir(23,24,dir_down), movedir(23,22,dir_up), movedir(22,23,dir_down), movedir(24,34,dir_right), movedir(34,24,dir_left), movedir(15,14,dir_up), movedir(14,15,dir_down), movedir(15,25,dir_right), movedir(25,15,dir_left), movedir(14,24,dir_right), movedir(24,14,dir_left), movedir(25,35,dir_right), movedir(35,25,dir_left), movedir(34,44,dir_right), movedir(44,34,dir_left), movedir(53,63,dir_right), movedir(63,53,dir_left), movedir(52,62,dir_right), movedir(62,52,dir_left), movedir(51,61,dir_right), movedir(61,51,dir_left), movedir(62,72,dir_right), movedir(72,62,dir_left), movedir(63,73,dir_right), movedir(73,63,dir_left), movedir(64,74,dir_right), movedir(74,64,dir_left), movedir(65,75,dir_right), movedir(75,65,dir_left), movedir(66,76,dir_right), movedir(76,66,dir_left), at(stone65,65), stone(stone65), goal(stone65), at(stone63,63), stone(stone63), goal(stone63), at(stone72,72), stone(stone72), goal(stone72), at(stone75,75), stone(stone75), goal(stone75), at(stone55,55), stone(stone55), goal(stone55), at(stone24,24), stone(stone24), goal(stone24), at(stone23,23), stone(stone23), goal(stone23), isgoal(65), isgoal(64), isgoal(52), isgoal(54), isgoal(55), isgoal(24), isgoal(22), at(player66,66), player(player66), step(1), step(2), step(3), step(4), step(5), step(6), step(7), step(8), step(9), step(10), step(11), step(12), step(13), step(14), step(15), step(16), step(17), step(18), step(19), step(20), step(21), step(22), step(23), step(24), step(25), step(26), step(27), step(28), step(29), step(30),step(31), step(32), step(33), step(34), step(35), step(36), step(37), step(38), step(39), step(40),step(41), step(42), step(43), step(44), step(45), step(46), step(47), step(48), step(49)]). testtakaken => asp(\$ [ movedir(r4c1,r3c1,dir_up), movedir(r3c1,r4c1,dir_down), movedir(r2c2,r1c2,dir_up), movedir(r1c2,r2c2,dir_down), movedir(r4c2,r3c2,dir_up), movedir(r3c2,r4c2,dir_down), movedir(r4c3,r3c3,dir_up), movedir(r3c3,r4c3,dir_down), movedir(r6c3,r5c3,dir_up), movedir(r5c3,r6c3,dir_down), movedir(r3c2,r2c2,dir_up), movedir(r2c2,r3c2,dir_down), movedir(r5c3,r4c3,dir_up), movedir(r4c3,r5c3,dir_down), movedir(r2c4,r1c4,dir_up), movedir(r1c4,r2c4,dir_down), movedir(r3c4,r2c4,dir_up), movedir(r2c4,r3c4,dir_down), movedir(r4c4,r3c4,dir_up), movedir(r3c4,r4c4,dir_down), movedir(r3c5,r2c5,dir_up), movedir(r2c5,r3c5,dir_down), movedir(r4c5,r3c5,dir_up), movedir(r3c5,r4c5,dir_down), movedir(r5c5,r4c5,dir_up), movedir(r4c5,r5c5,dir_down), movedir(r6c5,r5c5,dir_up), movedir(r5c5,r6c5,dir_down), movedir(r3c6,r2c6,dir_up), movedir(r2c6,r3c6,dir_down), movedir(r3c1,r3c2,dir_right), movedir(r3c2,r3c1,dir_left), movedir(r1c2,r1c3,dir_right), movedir(r1c3,r1c2,dir_left), movedir(r1c3,r1c4,dir_right), movedir(r1c4,r1c3,dir_left), movedir(r2c4,r2c5,dir_right), movedir(r2c5,r2c4,dir_left), movedir(r2c5,r2c6,dir_right), movedir(r2c6,r2c5,dir_left), movedir(r3c1,r3c2,dir_right), movedir(r3c2,r3c1,dir_left), movedir(r3c2,r3c3,dir_right), movedir(r3c3,r3c2,dir_left), movedir(r3c3,r3c4,dir_right), movedir(r3c4,r3c3,dir_left), movedir(r3c4,r3c5,dir_right), movedir(r3c5,r3c4,dir_left), movedir(r3c5,r3c6,dir_right), movedir(r3c6,r3c5,dir_left), movedir(r4c1,r4c2,dir_right), movedir(r4c2,r4c1,dir_left), movedir(r4c2,r4c3,dir_right), movedir(r4c3,r4c2,dir_left), movedir(r4c3,r4c4,dir_right), movedir(r4c4,r4c3,dir_left), movedir(r4c4,r4c5,dir_right), movedir(r4c5,r4c4,dir_left), movedir(r6c3,r6c4,dir_right), movedir(r6c4,r6c3,dir_left), movedir(r6c4,r6c5,dir_right), movedir(r6c5,r6c4,dir_left), isgoal(r3c2), isgoal(r3c3), isgoal(r3c5), isgoal(r5c5), at(stoner3c2,r3c2), stone(stoner3c2), goal(stoner3c2), at(stoner2c4,r2c4), stone(stoner2c4), goal(stoner2c4), at(stoner4c3,r4c3), stone(stoner4c3), goal(stoner4c3), at(stoner4c4,r4c4), stone(stoner4c4), goal(stoner4c4), player(sokoban), at(sokoban,r1c3), step(150) ]). /* ;; ####### ;; ## . ## ;; # .\$\$\$. # ;; # \$. .\$ # ;; #.\$ @ \$.# ;; # \$. .\$ # ;; # .\$\$\$. # ;; ## . ## ;; ####### */ ipc20 => asp(\$[ isgoal(pos_2_5), isgoal(pos_3_3), isgoal(pos_3_7), isgoal(pos_4_4), isgoal(pos_4_6), isgoal(pos_5_2), isgoal(pos_5_8), isgoal(pos_6_4), isgoal(pos_6_6), isgoal(pos_7_3), isgoal(pos_7_7), isgoal(pos_8_5), isnongoal(pos_1_1), isnongoal(pos_1_2), isnongoal(pos_1_3), isnongoal(pos_1_4), isnongoal(pos_1_5), isnongoal(pos_1_6), isnongoal(pos_1_7), isnongoal(pos_1_8), isnongoal(pos_1_9), isnongoal(pos_2_1), isnongoal(pos_2_2), isnongoal(pos_2_3), isnongoal(pos_2_4), isnongoal(pos_2_6), isnongoal(pos_2_7), isnongoal(pos_2_8), isnongoal(pos_2_9), isnongoal(pos_3_1), isnongoal(pos_3_2), isnongoal(pos_3_4), isnongoal(pos_3_5), isnongoal(pos_3_6), isnongoal(pos_3_8), isnongoal(pos_3_9), isnongoal(pos_4_1), isnongoal(pos_4_2), isnongoal(pos_4_3), isnongoal(pos_4_5), isnongoal(pos_4_7), isnongoal(pos_4_8), isnongoal(pos_4_9), isnongoal(pos_5_1), isnongoal(pos_5_3), isnongoal(pos_5_4), isnongoal(pos_5_5), isnongoal(pos_5_6), isnongoal(pos_5_7), isnongoal(pos_5_9), isnongoal(pos_6_1), isnongoal(pos_6_2), isnongoal(pos_6_3), isnongoal(pos_6_5), isnongoal(pos_6_7), isnongoal(pos_6_8), isnongoal(pos_6_9), isnongoal(pos_7_1), isnongoal(pos_7_2), isnongoal(pos_7_4), isnongoal(pos_7_5), isnongoal(pos_7_6), isnongoal(pos_7_8), isnongoal(pos_7_9), isnongoal(pos_8_1), isnongoal(pos_8_2), isnongoal(pos_8_3), isnongoal(pos_8_4), isnongoal(pos_8_6), isnongoal(pos_8_7), isnongoal(pos_8_8), isnongoal(pos_8_9), isnongoal(pos_9_1), isnongoal(pos_9_2), isnongoal(pos_9_3), isnongoal(pos_9_4), isnongoal(pos_9_5), isnongoal(pos_9_6), isnongoal(pos_9_7), isnongoal(pos_9_8), isnongoal(pos_9_9), movedir(pos_2_3,pos_2_4,dir_down), movedir(pos_2_3,pos_3_3,dir_right), movedir(pos_2_4,pos_2_3,dir_up), movedir(pos_2_4,pos_2_5,dir_down), movedir(pos_2_4,pos_3_4,dir_right), movedir(pos_2_5,pos_2_4,dir_up), movedir(pos_2_5,pos_2_6,dir_down), movedir(pos_2_5,pos_3_5,dir_right), movedir(pos_2_6,pos_2_5,dir_up), movedir(pos_2_6,pos_2_7,dir_down), movedir(pos_2_6,pos_3_6,dir_right), movedir(pos_2_7,pos_2_6,dir_up), movedir(pos_2_7,pos_3_7,dir_right), movedir(pos_3_2,pos_3_3,dir_down), movedir(pos_3_2,pos_4_2,dir_right), movedir(pos_3_3,pos_2_3,dir_left), movedir(pos_3_3,pos_3_2,dir_up), movedir(pos_3_3,pos_3_4,dir_down), movedir(pos_3_3,pos_4_3,dir_right), movedir(pos_3_4,pos_2_4,dir_left), movedir(pos_3_4,pos_3_3,dir_up), movedir(pos_3_4,pos_3_5,dir_down), movedir(pos_3_4,pos_4_4,dir_right), movedir(pos_3_5,pos_2_5,dir_left), movedir(pos_3_5,pos_3_4,dir_up), movedir(pos_3_5,pos_3_6,dir_down), movedir(pos_3_5,pos_4_5,dir_right), movedir(pos_3_6,pos_2_6,dir_left), movedir(pos_3_6,pos_3_5,dir_up), movedir(pos_3_6,pos_3_7,dir_down), movedir(pos_3_6,pos_4_6,dir_right), movedir(pos_3_7,pos_2_7,dir_left), movedir(pos_3_7,pos_3_6,dir_up), movedir(pos_3_7,pos_3_8,dir_down), movedir(pos_3_7,pos_4_7,dir_right), movedir(pos_3_8,pos_3_7,dir_up), movedir(pos_3_8,pos_4_8,dir_right), movedir(pos_4_2,pos_3_2,dir_left), movedir(pos_4_2,pos_4_3,dir_down), movedir(pos_4_2,pos_5_2,dir_right), movedir(pos_4_3,pos_3_3,dir_left), movedir(pos_4_3,pos_4_2,dir_up), movedir(pos_4_3,pos_4_4,dir_down), movedir(pos_4_3,pos_5_3,dir_right), movedir(pos_4_4,pos_3_4,dir_left), movedir(pos_4_4,pos_4_3,dir_up), movedir(pos_4_4,pos_4_5,dir_down), movedir(pos_4_4,pos_5_4,dir_right), movedir(pos_4_5,pos_3_5,dir_left), movedir(pos_4_5,pos_4_4,dir_up), movedir(pos_4_5,pos_4_6,dir_down), movedir(pos_4_5,pos_5_5,dir_right), movedir(pos_4_6,pos_3_6,dir_left), movedir(pos_4_6,pos_4_5,dir_up), movedir(pos_4_6,pos_4_7,dir_down), movedir(pos_4_6,pos_5_6,dir_right), movedir(pos_4_7,pos_3_7,dir_left), movedir(pos_4_7,pos_4_6,dir_up), movedir(pos_4_7,pos_4_8,dir_down), movedir(pos_4_7,pos_5_7,dir_right), movedir(pos_4_8,pos_3_8,dir_left), movedir(pos_4_8,pos_4_7,dir_up), movedir(pos_4_8,pos_5_8,dir_right), movedir(pos_5_2,pos_4_2,dir_left), movedir(pos_5_2,pos_5_3,dir_down), movedir(pos_5_2,pos_6_2,dir_right), movedir(pos_5_3,pos_4_3,dir_left), movedir(pos_5_3,pos_5_2,dir_up), movedir(pos_5_3,pos_5_4,dir_down), movedir(pos_5_3,pos_6_3,dir_right), movedir(pos_5_4,pos_4_4,dir_left), movedir(pos_5_4,pos_5_3,dir_up), movedir(pos_5_4,pos_5_5,dir_down), movedir(pos_5_4,pos_6_4,dir_right), movedir(pos_5_5,pos_4_5,dir_left), movedir(pos_5_5,pos_5_4,dir_up), movedir(pos_5_5,pos_5_6,dir_down), movedir(pos_5_5,pos_6_5,dir_right), movedir(pos_5_6,pos_4_6,dir_left), movedir(pos_5_6,pos_5_5,dir_up), movedir(pos_5_6,pos_5_7,dir_down), movedir(pos_5_6,pos_6_6,dir_right), movedir(pos_5_7,pos_4_7,dir_left), movedir(pos_5_7,pos_5_6,dir_up), movedir(pos_5_7,pos_5_8,dir_down), movedir(pos_5_7,pos_6_7,dir_right), movedir(pos_5_8,pos_4_8,dir_left), movedir(pos_5_8,pos_5_7,dir_up), movedir(pos_5_8,pos_6_8,dir_right), movedir(pos_6_2,pos_5_2,dir_left), movedir(pos_6_2,pos_6_3,dir_down), movedir(pos_6_2,pos_7_2,dir_right), movedir(pos_6_3,pos_5_3,dir_left), movedir(pos_6_3,pos_6_2,dir_up), movedir(pos_6_3,pos_6_4,dir_down), movedir(pos_6_3,pos_7_3,dir_right), movedir(pos_6_4,pos_5_4,dir_left), movedir(pos_6_4,pos_6_3,dir_up), movedir(pos_6_4,pos_6_5,dir_down), movedir(pos_6_4,pos_7_4,dir_right), movedir(pos_6_5,pos_5_5,dir_left), movedir(pos_6_5,pos_6_4,dir_up), movedir(pos_6_5,pos_6_6,dir_down), movedir(pos_6_5,pos_7_5,dir_right), movedir(pos_6_6,pos_5_6,dir_left), movedir(pos_6_6,pos_6_5,dir_up), movedir(pos_6_6,pos_6_7,dir_down), movedir(pos_6_6,pos_7_6,dir_right), movedir(pos_6_7,pos_5_7,dir_left), movedir(pos_6_7,pos_6_6,dir_up), movedir(pos_6_7,pos_6_8,dir_down), movedir(pos_6_7,pos_7_7,dir_right), movedir(pos_6_8,pos_5_8,dir_left), movedir(pos_6_8,pos_6_7,dir_up), movedir(pos_6_8,pos_7_8,dir_right), movedir(pos_7_2,pos_6_2,dir_left), movedir(pos_7_2,pos_7_3,dir_down), movedir(pos_7_3,pos_6_3,dir_left), movedir(pos_7_3,pos_7_2,dir_up), movedir(pos_7_3,pos_7_4,dir_down), movedir(pos_7_3,pos_8_3,dir_right), movedir(pos_7_4,pos_6_4,dir_left), movedir(pos_7_4,pos_7_3,dir_up), movedir(pos_7_4,pos_7_5,dir_down), movedir(pos_7_4,pos_8_4,dir_right), movedir(pos_7_5,pos_6_5,dir_left), movedir(pos_7_5,pos_7_4,dir_up), movedir(pos_7_5,pos_7_6,dir_down), movedir(pos_7_5,pos_8_5,dir_right), movedir(pos_7_6,pos_6_6,dir_left), movedir(pos_7_6,pos_7_5,dir_up), movedir(pos_7_6,pos_7_7,dir_down), movedir(pos_7_6,pos_8_6,dir_right), movedir(pos_7_7,pos_6_7,dir_left), movedir(pos_7_7,pos_7_6,dir_up), movedir(pos_7_7,pos_7_8,dir_down), movedir(pos_7_7,pos_8_7,dir_right), movedir(pos_7_8,pos_6_8,dir_left), movedir(pos_7_8,pos_7_7,dir_up), movedir(pos_8_3,pos_7_3,dir_left), movedir(pos_8_3,pos_8_4,dir_down), movedir(pos_8_4,pos_7_4,dir_left), movedir(pos_8_4,pos_8_3,dir_up), movedir(pos_8_4,pos_8_5,dir_down), movedir(pos_8_5,pos_7_5,dir_left), movedir(pos_8_5,pos_8_4,dir_up), movedir(pos_8_5,pos_8_6,dir_down), movedir(pos_8_6,pos_7_6,dir_left), movedir(pos_8_6,pos_8_5,dir_up), movedir(pos_8_6,pos_8_7,dir_down), movedir(pos_8_7,pos_7_7,dir_left), movedir(pos_8_7,pos_8_6,dir_up), at(player_01,pos_5_5), at(stone_01,pos_4_3), at(stone_02,pos_5_3), at(stone_03,pos_6_3), at(stone_04,pos_3_4), at(stone_05,pos_7_4), at(stone_06,pos_3_5), at(stone_07,pos_7_5), at(stone_08,pos_3_6), at(stone_09,pos_7_6), at(stone_10,pos_4_7), at(stone_11,pos_5_7), at(stone_12,pos_6_7), player(player_01), goal(stone_01), goal(stone_02), goal(stone_03), goal(stone_04), goal(stone_05), goal(stone_06), goal(stone_07), goal(stone_08), goal(stone_09), goal(stone_10), goal(stone_11), goal(stone_12), stone(stone_01), stone(stone_02), stone(stone_03), stone(stone_04), stone(stone_05), stone(stone_06), stone(stone_07), stone(stone_08), stone(stone_09), stone(stone_10), stone(stone_11), stone(stone_12), step(2500)]).