Beginning Compilation.Imports complete. 30 types exist.Compilation Complete.Time Elapsed: 00:00:01.1542230################################################################################# #.....#...............#...#...........#.....#...............#.....#.............# ###.#.#.###########.#.#.#.#.###.#####.#.###.#######.#######.#.###.#####.#######.# #...#.#.#...#...#...#.#.#.#.#.#.....#...#.#.......#.......#...#...#.....#.......# #.#####.#.#.#.#.#.###.#.#.#.#.#####.#####.#######.#.#####.#####.###.#####.####### #.......#.#...#.#.#.#.#.#.....#...#.#.....#...#...#.....#...#...#...#...#.......# #.#######.#####.#.#.#.#######.#.#.#.###.#.#.#.#.#########.#.#.###.#####.#######.# #.........#...#.#.#.......#.#.#.#.#.#...#...#.#.#.......#.#.#.#.....#...#.......# ###########.###.#.#######.#.#.###.#.#.#######.#.#.#####.###.#.#####.#.#.#.####### #...#.......#...#.....#.#.#.......#.#...#.....#.#.#...#...#.#.#...#.#.#.#.#.#...# #.#.#.#######.#######.#.#.###.#####.#.#.###.###.#.###.###.#.#.#.#.#.#.#.#.#.#.#.# #.#...#...........#...#.#...#.#.....#.#...#.#.#...#...#...#.#...#...#.#.#.#...#.# #.#####.###########.###.###.###.#####.###.#.#.#####.###.###.#########.###.#####.# #.....#.#.#.........#.....#.....#...#.#...#...#.........#.........#.............# #####.#.#.#.#############.#######.#.#.#.#######.#########.#######.#.###########.# #.....#.#.#.#...........#.......#.#.#.#...#.....#.#.......#.......#.#...#.....#.# #.#####.#.#.#.#########.#####.#.###.#.###.#.#####.#.#######.#########.#.#.###.#.# #.....#.#.#.#.#...#.#...#.....#.....#...#.#...#...#...#.....#.........#...#.#.#.# #.###.#.#.#.#.#.#.#.#.###.###########.###.###.###.#.###.###.#.#############.#.### #.#.#.#...#.#...#.#.#...#.............#.....#...#...#...#...#...#...#.......#...# #.#.#.###.#.#####.#.###.###.#########.#.###.###.#.###.###.#####.#.###.###.#####.# #...#.....#.....#...#.#...#.....#...#.#.#...#...#.#...#.#.#...#.#...#.#.#...#...# #.#####.#######.###.#.###.#######.#.###.#.###.###.#.###.#.#.#.#.#.#.#.#.###.#.### #.#...#.#...#...#.#.....#.......#.#...#.#.#...#.#.#.#...#...#.#.#.#.#.#...#...#.# ###.#.#.#.###.#.#.#####.#######.#.###.#.###.###.#.#.#.#.#.#####.###.#.#.#.#####.# #...#.#...#...#.#.#...#.....#...#...#...#...#.....#.#.#...#...#...#.#.#.#...#...# #.###.#####.###.#.#.#.#####.#.###.#.###.#.###.#####.#.#####.#.###.#.#.###.#.#.#.# #...#.......#.....#.#.......#...#.#.#...#.#.......#.#.#...#.#.....#.#.....#.#.#.# ###.###.###########.###########.###.#.###.#####.###.###.#.#.#######.#######.#.#.# #...#...#...........#...#.......#...#...#.....#.#...#...#...#.............#.#.#.# #.#######.###########.#.#.#######.#####.#####.#.#.#.#.#######.#.#########.#.#.### #...#.....#.....#.#...#.#...#...#.....#.#.....#.#.#.#.#.......#.#...#...#.#.#...# #.#.#.#####.###.#.#.###.#.#.#.###.###.#.#.#######.#.#.#.#######.#.#.#.#.#.#.#.#.# #.#.#.......#.....#.#.#.#.#.#...#.#.#.#.#.#.......#.#.#.#.....#...#.#.#.#.#.#.#.# #.#.#########.#####.#.#.###.###.#.#.#.#.#.#.###.#####.#.#.###.#####.#.#.###.###.# #.#.......#...#.....#...#...#...#...#.#.#.#.#.#...#.#.#.#...#.#...#...#...#.#...# #.#######.#.###.#####.###.###.#####.#.###.#.#.###.#.#.###.###.#.#.#######.#.#.### #...#...#.#...#.#...#.#...#.#.......#.....#.....#.#.#.....#...#.#.#.......#.#...# ###.#.#.#.###.#.#.###.#.###.#.###################.#.#######.###.#.#.#####.#.###.# #.#...#.#...#.#.#...#...#...#...#.......#.......#.#.........#...#.#.#.....#...#.# #.#####.#.###.#.#.#.#####.#####.#.#.#####.#.###.#.###########.###.#.#####.###.#.# #.......#...#.#.#.#...#.......#.#.#.......#.#.....#.#.........#...#.....#.#...#.# #.#########.#.#.#####.#.###.###.###.#######.#####.#.#.###.#####.#######.#.#.###.# #.#...#...#...#.....#.....#...#...#.......#...#...#.#...#.#...#.........#.#.#...# #.#.#.###.#########.#########.###.###.#######.###.#.#.###.#.#.#####.#######.#.### #.#.#.....#.......#.........#.#...#.#.#.....#...#.#...#...#.#.#.....#.......#...# #.#.#####.#.#####.#########.#.#.###.#.#.###.###.#.#####.#.#.#.###.###.#########.# #.#.....#.#...#.....#...#...#.#.#...#.#.#.......#.....#.#.#.#...#...#.#.........# #.###.#.#####.#####.#.#.#.###.#.#.###.#.#############.#.#.#.###.###.#.#.###.###.# #...#.#.....#.....#...#.#.#...#.#.....#.#.........#.#...#.#...#...#.#.#...#...#.# ###.#.#####.#####.#####.#.#.###.#######.#.#######.#.#####.###.###.###.#######.### #.#.#.....#.....#.#...#.#.#.............#...#.....#.#...#.#...#.#...#.#.....#...# #.#.#########.###.#.#.#.#.#########.#######.#.#####.#.#.#.#.###.###.#.#.###.###.# #.#...........#...#.#.#.#.....#...#.#.....#.#.#.....#.#...#.#.....#...#...#.....# #.###########.#.###.#.#.#####.#.###.#.###.#.#.#.#####.#####.#####.#####.#.#.##### #...#.........#.....#.#.....#.#...#.#...#.#.#.#...........#.......#...#.#.#.#...# #.###.###############.#####.#.#.#.#.###.#.#.#.#######.###########.#.#.###.###.#.# #.#...#.....#...#.#...#...#.#.#.#...#...#...#.#.....#.#.......#...#.#...#.....#.# #.#.###.#.#.#.#.#.#.#####.#.#.#######.#######.#.###.###.#.#####.###.###.#######.# #.#...#.#.#...#.#.#...#...#...#.....#.#.....#...#.#...#.#.....#.#...#.#...#...#.# #.###.###.#####.#.###.#.#####.#.###.#.#.###.#####.###.#.#####.#.#.###.###.#.#.#.# #...#.....#...#.....#.#.#...#.#...#...#.#.#.........#...#.#...#.#...#.......#.#.# #.#########.#####.###.#.#.#.#.###.#####.#.#.#######.#####.#.###.#.#.#.#######.#.# #.......#...#...#.#...#...#...#...#...#.#.#...#...#...#...#.....#.#.#.#.....#.#.# #.###.###.#.#.#.#.#.###########.#####.#.#.###.#.#.###.###.#######.#.###.###.#.#.# #.#...#...#...#.#.#.....#.......#.....#.#...#.#.#...#...#.....#...#.....#...#.#.# #.#.###.#######.#.#####.#.#########.#.#.#.###.#####.###.#.#.#.###########.###.#.# #.#.....#...#...#.#.#...#.#...#.....#.#.#...#.#...#.....#.#.#.....#.......#.#.#.# #.#######.#.#.###.#.#.###.#.#.#.#####.#.#.#.#.#.#.#####.#.#.#####.#.#######.#.#.# #.#.......#.#.#...#.#.....#.#.#...#...#.#.#.#...#.....#.#.#.....#...#.#.......#.# #.#.#######.#.#.###.#######.#.###.#.###.###.#########.#.#######.#####.#.#######.# #...#...#...#...#.......#...#.....#.#.............#...#.........#...#...#.#.....# #####.###.#######.#####.#.#.#########.###########.#.#############.###.###.#.###.# #...#...#.#.....#...#.#.#.#...........#.........#.#...........#.......#.....#.#.# #.###.#.#.#.###.###.#.#.###.###########.#######.#########.###.#.#######.#####.#.# #...#.#.#...#.#.#...#.#...#.#.....#.....#.#...#.#.......#.#...#.#.............#.# #.#.#.#.#####.#.#.###.###.#.#####.#.#####.#.#.#.#.#####.###.###.#.#############.# #.#...#.......#...#.......#.......#.....#...#...#...#.#...#.#...#...#.....#.....# #.#######.#########.###################.#.#########.#.###.#.#.#######.###.#.###.# #.......#...............................#...........#.......#.........#.....#...# ################################################################################# Execution time: 00:00:46.7645850MethodGroupInstance::Select: 188558 - 00:00:00.6151950
// no enums yet... (bug #9)public goose class PathState{}public goose class Wall: PathState{}public goose class Clear: PathState{}public Wall wall = new Wall;public Clear clear = new Clear;public goose class TileState{}public goose class Unvisited: TileState{}public goose class Visited: TileState{}public Unvisited unvisited = new Unvisited;public Visited visited = new Visited;public goose class CardinalDirection{}public static CardinalDirection direction from code (int DirectionCode){ if(DirectionCode == 0){ return(north); }else if(DirectionCode == 1){ return(east); }else if(DirectionCode == 2){ return(south); }else if(DirectionCode == 3){ return(west); }else{ return(null); }}public static CardinalDirection random direction{ return(direction from code rng.Next(0,4));}public goose class East: CardinalDirection{}public goose class North: CardinalDirection{}public goose class West: CardinalDirection{}public goose class South: CardinalDirection{}public East east = new East;public North north = new North;public West west = new West;public South south = new South;public Random rng = new Random; public class Coordinate{ public int x; public int y; public bool this exists in (Map map){ if(x < 0 || map.Tiles.Count < x || map.Tiles.Count == x){ return(false); } if(y < 0 || map.Tiles[x].Count < y || map.Tiles[x].Count == y){ return(false); } return(true); } // Should be this methods so can do 'Coord move north' (bug #15) public Coordinate move (CardinalDirection direction){return(null);} public Coordinate move (North direction){ local Coordinate rtn = new Coordinate; rtn.x = x; rtn.y = y - 1; return(rtn); } public Coordinate move (East direction){ local Coordinate rtn = new Coordinate; rtn.x = x + 1; rtn.y = y; return(rtn); } public Coordinate move (South direction){ local Coordinate rtn = new Coordinate; rtn.x = x; rtn.y = y + 1; return(rtn); } public Coordinate move (West direction){ local Coordinate rtn = new Coordinate; rtn.x = x - 1; rtn.y = y; return(rtn); }}public class Tile{ public PathState EastPath = wall; public PathState SouthPath = wall; public TileState Status = unvisited;}public class Map{ public int maxX; public int maxY; public List> Tiles = new List>; public void Initialize(){ Tiles.Clear(); // no for loops yet... (bug #11) local int x; local int y; do{ y = 0; Tiles.Add(new List); do{ Tiles[x].Add(new Tile); y=y+1; }while(y x=x+1; }while(x } }public static void display( Map TargetMaze ){ local int x; local int y; x = 0; print "#"; do{ print "##"; x = x + 1; }while(x print " \r\n"; x = 0; y = 0; do{ print "#"; x = 0; do{ print "."; if( TargetMaze.Tiles[x][y].EastPath == wall ){ print "#"; }else{ print "."; } x = x + 1; }while(x print " \r\n"; x = 0; print "#"; do{ if( TargetMaze.Tiles[x][y].SouthPath == wall ){ print "#"; }else{ print "."; } print "#"; x = x+1; }while(x print " \r\n"; y = y+1; }while( y < TargetMaze.maxY ); }public static bool done in (Map workMap) at (Coordinate Cursor){ local Coordinate workCoordinate = new Coordinate; workCoordinate = Cursor.move north; if(workCoordinate exists in workMap && workMap.Tiles[workCoordinate.x][workCoordinate.y].Status == unvisited){ return(false); } workCoordinate = Cursor.move east; if(workCoordinate exists in workMap && workMap.Tiles[workCoordinate.x][workCoordinate.y].Status == unvisited){ return(false); } workCoordinate = Cursor.move south; if(workCoordinate exists in workMap && workMap.Tiles[workCoordinate.x][workCoordinate.y].Status == unvisited){ return(false); } workCoordinate = Cursor.move west; if(workCoordinate exists in workMap && workMap.Tiles[workCoordinate.x][workCoordinate.y].Status == unvisited){ return(false); } return(true);}public static void MazeStep( Map workMap, Coordinate Cursor){ workMap.Tiles[Cursor.x][Cursor.y].Status = visited; // Not declared in the while loop due to bug #14. local CardinalDirection RandomDirection; local Coordinate NewCursor; while( !done in workMap at Cursor ){ do{ RandomDirection = random direction; NewCursor = Cursor.move RandomDirection; }while( !(NewCursor exists in workMap && workMap.Tiles[NewCursor.x][NewCursor.y].Status == unvisited)); if( RandomDirection == east ){ workMap.Tiles[Cursor.x][Cursor.y].EastPath = clear; }else if(RandomDirection == south){ workMap.Tiles[Cursor.x][Cursor.y].SouthPath = clear; }else if(RandomDirection == west){ workMap.Tiles[NewCursor.x][NewCursor.y].EastPath = clear; }else if(RandomDirection == north){ workMap.Tiles[NewCursor.x][NewCursor.y].SouthPath = clear; }else{ print "!!! Unknown random direction?!?"; } MazeStep(workMap,NewCursor); }}public static Map create (int xsize) by (int ysize) maze{ local Map rtn = new Map; rtn.maxX = xsize; rtn.maxY = ysize; rtn.Initialize(); local Coordinate Cursor = new Coordinate; Cursor.x = rng.Next(0,xsize); Cursor.y = rng.Next(0,ysize); MazeStep(rtn,Cursor); return(rtn);}public static void main(){ display (create 40 by 40 maze);}
And there you go; slightly different than the prelim code. Worked through about 8 non-trivial bugs, 1 super bug, and worked around ~2 other new ones but it's there and works. It is dog slow though (my C# workshop app takes 0.1s to do the same thing vs 46.7s for the Tangent app). A little surprising since I expected that the compilation time would be the big problem with the growth in app size. But that's fine. You can profile working code and you can add optimizations to a compiler.
Now to think of another example app to shake more bugs out of this thing. Something that touches function passing and properties and class stuff more. Alas, it'll probably be 2-3 more test cycles before release. Too bad since I need to get more hands and eyes for feedback.