More code cleanup
This commit is contained in:
parent
c723fdb3f7
commit
81ed075871
|
@ -138,21 +138,18 @@ fn isWall(p: Point, direction: Cardinal) bool {
|
|||
}
|
||||
|
||||
pub fn setWall(p: Point, direction: Cardinal, value: bool) void {
|
||||
// We should maybe have a better way of handling this if it actually happens to the robot
|
||||
// If that direction is an outer wall, assert that we saw a wall
|
||||
// TODO: cleanup
|
||||
if (isEdge(p, direction)) {
|
||||
// std.log.debug("Hello? {} {} {} {}", .{p, direction, isEdge(p, direction), value});
|
||||
// We should maybe have a better way of handling this if it actually happens to the robot
|
||||
assert(value);
|
||||
// print("Hello? {} {} {} {}", .{p, direction, isEdge(p, direction), value});
|
||||
// std.debug.panic("Outside of maze is ");
|
||||
}
|
||||
// assert(!(isEdge(p, direction) and !value));
|
||||
|
||||
// If we're running in sim, display that we saw a wall
|
||||
if (!is_robot and value) {
|
||||
robot.showWall(p, direction);
|
||||
}
|
||||
|
||||
// We don't keep track of the edges, we just assume they're there
|
||||
if (isEdge(p, direction)) {
|
||||
return;
|
||||
}
|
||||
|
@ -176,16 +173,16 @@ var mazeNodes = init: {
|
|||
break :init nodes;
|
||||
};
|
||||
|
||||
test {
|
||||
// y, x; and we start in the bottom left
|
||||
const s = mazeNodes[0][0];
|
||||
// @compileLog(s.p.x);
|
||||
// @compileLog(s.p.y);
|
||||
// @compileLog(map.start.x);
|
||||
// @compileLog(map.start.y);
|
||||
assert(s.p.x == map.start.x);
|
||||
assert(s.p.y == map.start.y);
|
||||
}
|
||||
// test {
|
||||
// // y, x; and we start in the bottom left
|
||||
// const s = mazeNodes[0][0];
|
||||
// // @compileLog(s.p.x);
|
||||
// // @compileLog(s.p.y);
|
||||
// // @compileLog(map.start.x);
|
||||
// // @compileLog(map.start.y);
|
||||
// assert(s.p.x == map.start.x);
|
||||
// assert(s.p.y == map.start.y);
|
||||
// }
|
||||
|
||||
|
||||
//// Algorithm
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
const algo = @import("algorithm.zig");
|
||||
const robot = algo.robot;
|
||||
|
|
|
@ -53,7 +53,6 @@ pub fn stall() noreturn {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: Style all of these
|
||||
// TODO: figure out what the above comment means. They're pretty stylish already
|
||||
pub fn readRight() bool {
|
||||
|
|
Loading…
Reference in New Issue