Initial Commit

This commit is contained in:
2026-04-12 08:41:30 -05:00
commit f812b09c8c
7 changed files with 427 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
const std = @import("std");
const Io = std.Io;
const grome = @import("grome");
pub fn main(init: std.process.Init) !void {
// This is appropriate for anything that lives as long as the process.
const arena: std.mem.Allocator = init.arena.allocator();
// Initialize the stdout writer
var stdout_buffer: [1024]u8 = undefined;
var stdout_file_writer: Io.File.Writer = .init(.stdout(), init.io, &stdout_buffer);
const stdout_writer = &stdout_file_writer.interface;
// alright lets play with the matrix
const width = 50;
const height = 50;
var matrix = try grome.Matrix(u8, width, height).init(arena, ' ');
var iter = matrix.row_iterator();
const density = (width * height) / 100;
for (0..density) |_| {
var buf: [3]u8 = undefined;
init.io.random(&buf);
matrix.set(@intCast(buf[0] % width), @intCast(buf[1] % height), @intCast((buf[2] % 50) + 93));
}
_ = try stdout_writer.write(" ┌─");
for (0..width) |_| {
_ = try stdout_writer.write("");
}
_ = try stdout_writer.write("─┐ \n");
while (iter.next()) |row| {
_ = try stdout_writer.print(" │ {s} │ \n", .{row});
}
_ = try stdout_writer.write(" └─");
for (0..width) |_| {
_ = try stdout_writer.write("");
}
_ = try stdout_writer.write("─┘ \n");
try stdout_writer.flush();
}