GGCMPNJA4ZJ7M4MV2KL6FIVB3WY5S3K7MOFIQIJMKUSQRQT33RDQC
YBD25OAQVZVBOCZMYLB5UISVXD27RWIQHPDTOAEPNUU2QAD36GTAC
QJ3LGOWTF6RO3236Z2YJMDVFPBTQ2TSKUPP7ZGPDGEJPNJKSBDHAC
IUN32JQJ57DGPVQYWTQNGYXEIMBBWYEXGSGTW3IUZMRIWHEJ7HYAC
KGJAOQ7ATB6EPL24ONRQ6U6G3HVXNJLXKI4KSPVMM4D52DEUT4IAC
BHYPRVIESUYRESS3VBV62SHGMNJKPKQXZDOSJM3BRBZGYNVYFF6QC
N4TCGAFONE5YLQPLXBJGPIV7EXRA3JLFPM7ESZJ42IM6HD3D67UAC
F2AZDZWZABPDWUH4TPLK4N5NMSRYKFDKP3GURGUVNYH4R6W2JSCAC
WD2QUJPWSPGUUG65XIL7HR5BTFH3AKNGXKJSOO655PRHFKEWDMUQC
test {
_ = @import("grid_test.zig");
_ = @import("graph_test.zig");
}
const absx = try std.math.absInt(@intCast(isize, a[0]) - @intCast(isize, b[0]));
const absy = try std.math.absInt(@intCast(isize, a[1]) - @intCast(isize, b[1]));
return @intCast(usize, absx + absy);
const absx = @abs(@as(isize, @intCast(a[0])) - @as(isize, @intCast(b[0])));
const absy = @abs(@as(isize, @intCast(a[1])) - @as(isize, @intCast(b[1])));
return @as(usize, @intCast(absx + absy));
const absx = try std.math.absInt(@intCast(isize, a[0]) - @intCast(isize, b[0]));
const absy = try std.math.absInt(@intCast(isize, a[1]) - @intCast(isize, b[1]));
return @intCast(usize, absx + absy);
const absx = @abs(@as(isize, @intCast(a[0])) - @as(isize, @intCast(b[0])));
const absy = @abs(@as(isize, @intCast(a[1])) - @as(isize, @intCast(b[1])));
return absx + absy;
const powx = try std.math.powi(isize, @intCast(isize, a[0]) - @intCast(isize, b[0]), 2);
const powy = try std.math.powi(isize, @intCast(isize, a[1]) - @intCast(isize, b[1]), 2);
return std.math.sqrt(@intToFloat(f32, powx + powy));
const powx = try std.math.powi(isize, @as(isize, @intCast(a[0])) - @as(isize, @intCast(b[0])), 2);
const powy = try std.math.powi(isize, @as(isize, @intCast(a[1])) - @as(isize, @intCast(b[1])), 2);
return @sqrt(@as(f32, @floatFromInt(powx + powy)));
var next: PathType = @intCast(PathType, pos) + 1;
while (next < sideroom_depth) : (next += 1) {
if (room[next] != @intToEnum(Amphipod, idx)) tainted = true;
var next: PathType = @as(PathType, @intCast(pos)) + 1;
while (next < SIDEROOM_DEPTH) : (next += 1) {
if (room[next] != @as(Amphipod, @enumFromInt(idx))) tainted = true;
const lib = b.addStaticLibrary("pathfinder.zig", "src/pathfinder.zig");
lib.setBuildMode(mode);
lib.install();
const main_tests = b.addTest("src/pathfinder_test.zig");
main_tests.setBuildMode(mode);
pub fn build(b: *std.Build) void {
const optmization = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
const lib = b.addStaticLibrary(.{
.name = "pathfinder",
.root_source_file = .{ .path = "src/pathfinder.zig" },
.optimize = optmization,
.target = target,
});
b.installArtifact(lib);
const bench = b.addTest("src/benchmark.zig");
bench.setBuildMode(mode);
const main_tests = b.addTest(.{
.name = "test",
.root_source_file = .{ .path = "src/pathfinder.zig" },
.optimize = optmization,
.target = target,
});
const test_cmd = b.addRunArtifact(main_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&test_cmd.step);
const bench_step = b.step("bench", "Run library benchmarks");
bench_step.dependOn(&bench.step);
const benchmark = b.addTest(.{
.name = "benchmark",
.root_source_file = .{ .path = "src/benchmark.zig" },
.optimize = optmization,
});
const bench_cmd = b.addRunArtifact(benchmark);
const bench_step = b.step("bench", "Run benchmarks");
bench_step.dependOn(&bench_cmd.step);