From: Alexander Fedotov Date: Thu, 10 Mar 2016 11:27:46 +0000 (+0100) Subject: coord gen small fix + cleanup X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=6c1c0ba84ad6178629147dce00cc5432d40c39f1;p=mc1516pa.git coord gen small fix + cleanup --- diff --git a/code/SokobanCoord.icl b/code/SokobanCoord.icl index 4a664ad..dfbc60f 100644 --- a/code/SokobanCoord.icl +++ b/code/SokobanCoord.icl @@ -6,18 +6,20 @@ import Sokoban inpath :== "screen.2000" outpath :== "solver.smv" +/* puzzle :: SokobanPuzzle puzzle = Sokoban [[Wall, Wall, Wall, Wall, Wall, Wall], [Wall, Free, Free, Free, Free, Wall], [Wall, Agent,Free, Box, Free, Wall], [Wall, Free, Free, Free, Target, Wall], [Wall, Wall, Wall, Wall, Wall, Wall]] +*/ checkX :: [[SokobanTile]] Int -> Int -checkX p x = let (Sokoban p) = puzzle in if (x > (length p - 1)) (-1) x +checkX p x = if (x > (length p - 1)) (-1) x checkY :: [[SokobanTile]] Int Int -> Int -checkY p x y = let (Sokoban p) = puzzle in if (y > (length (p !! x) - 1)) (-1) y +checkY p x y = if (y > (length (p !! x) - 1)) (-1) y genField :: [[SokobanTile]] Int Int -> String genField p x y = " init(x" +++ toString x +++ "_" +++ toString y +++ ") := " +++ fromTile ((p !! x) !! y) +++ ";\n"