|
|
@ -35,8 +35,8 @@
|
|
|
|
const std = @import("std");
|
|
|
|
const std = @import("std");
|
|
|
|
const print = std.debug.print;
|
|
|
|
const print = std.debug.print;
|
|
|
|
|
|
|
|
|
|
|
|
// This is the same character class enum we've seen before.
|
|
|
|
// This is the same character role enum we've seen before.
|
|
|
|
const Class = enum {
|
|
|
|
const Role = enum {
|
|
|
|
wizard,
|
|
|
|
wizard,
|
|
|
|
thief,
|
|
|
|
thief,
|
|
|
|
bard,
|
|
|
|
bard,
|
|
|
@ -45,14 +45,14 @@ const Class = enum {
|
|
|
|
|
|
|
|
|
|
|
|
pub fn main() void {
|
|
|
|
pub fn main() void {
|
|
|
|
// Here are the three "property" arrays:
|
|
|
|
// Here are the three "property" arrays:
|
|
|
|
const classes = [4]Class{ .wizard, .bard, .bard, .warrior };
|
|
|
|
const roles = [4]Role{ .wizard, .bard, .bard, .warrior };
|
|
|
|
const gold = [4]u16{ 25, 11, 5, 7392 };
|
|
|
|
const gold = [4]u16{ 25, 11, 5, 7392 };
|
|
|
|
const experience = [4]u8{ 40, 17, 55, 21 };
|
|
|
|
const experience = [4]u8{ 40, 17, 55, 21 };
|
|
|
|
|
|
|
|
|
|
|
|
// We would like to number our list starting with 1, not 0.
|
|
|
|
// We would like to number our list starting with 1, not 0.
|
|
|
|
// How do we do that?
|
|
|
|
// How do we do that?
|
|
|
|
for (classes, gold, experience, ???) |c, g, e, i| {
|
|
|
|
for (roles, gold, experience, ???) |c, g, e, i| {
|
|
|
|
const class_name = switch (c) {
|
|
|
|
const role_name = switch (c) {
|
|
|
|
.wizard => "Wizard",
|
|
|
|
.wizard => "Wizard",
|
|
|
|
.thief => "Thief",
|
|
|
|
.thief => "Thief",
|
|
|
|
.bard => "Bard",
|
|
|
|
.bard => "Bard",
|
|
|
@ -61,7 +61,7 @@ pub fn main() void {
|
|
|
|
|
|
|
|
|
|
|
|
std.debug.print("{d}. {s} (Gold: {d}, XP: {d})\n", .{
|
|
|
|
std.debug.print("{d}. {s} (Gold: {d}, XP: {d})\n", .{
|
|
|
|
i,
|
|
|
|
i,
|
|
|
|
class_name,
|
|
|
|
role_name,
|
|
|
|
g,
|
|
|
|
g,
|
|
|
|
e,
|
|
|
|
e,
|
|
|
|
});
|
|
|
|
});
|
|
|
|