Compare commits

..

No commits in common. '2062ca7462340ad3c14b6d9227469b0c9b49b1a9' and '85fbb331048eae03a2d739f3e3d45b6c14f71a94' have entirely different histories.

@ -3,9 +3,6 @@ const io = std.io;
const mem = std.mem;
const os = std.os;
var player1Name: []const u8 = undefined;
var player2Name: []const u8 = undefined;
pub fn main() anyerror!void {
std.log.info("All your codebase are belong to us.", .{});
@ -18,12 +15,6 @@ pub fn main() anyerror!void {
// var fba = std.heap.FixedBufferAllocator.init(&buffer);
// const allocator = fba.allocator();
// Useage of app:
// 1. create players
// 2. set up new table
// 3. mark points as game is being played
// 4. rematch? (keep players)
try stdOut.writer().print(">", .{});
while (!quit) {
const input = (try nextLine(stdIn.reader(), &buffer)).?;
@ -46,19 +37,11 @@ fn nextLine(reader: anytype, buffer: []u8) !?[]const u8 {
}
}
//TODO: Create command parser
fn parser(query: []const u8) !void {
const stdOut = io.getStdOut();
if (mem.eql(u8, query, "quit")) {
try quitApp();
}
if (mem.eql(u8, query, "player1")) {
player1Name = try getInput();
try stdOut.writer().print("Player 1 is now {s}\n", .{player1Name});
}
if (mem.eql(u8, query, "player2")) {
player1Name = try getInput();
try stdOut.writer().print("Player 1 is now {s}\n", .{player1Name});
}
}
fn quitApp() !void {
@ -67,9 +50,8 @@ fn quitApp() !void {
os.exit(0);
}
fn getInput() ![]const u8{
const stdIn = io.getStdIn();
var buffer: [1000]u8 = undefined;
const input = (try nextLine(stdIn.reader(), &buffer)).?;
return input;
//TODO: Create inital settings
test "basic test" {
try std.testing.expectEqual(10, 3 + 7);
}
Loading…
Cancel
Save