|
|
@ -22,8 +22,8 @@
|
|
|
|
//
|
|
|
|
//
|
|
|
|
const std = @import("std");
|
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
|
|
|
|
// We'll use an enum to specify the character class.
|
|
|
|
// We'll use an enum to specify the character role.
|
|
|
|
const Class = enum {
|
|
|
|
const Role = enum {
|
|
|
|
wizard,
|
|
|
|
wizard,
|
|
|
|
thief,
|
|
|
|
thief,
|
|
|
|
bard,
|
|
|
|
bard,
|
|
|
@ -33,7 +33,7 @@ const Class = enum {
|
|
|
|
// Please add a new property to this struct called "health" and make
|
|
|
|
// Please add a new property to this struct called "health" and make
|
|
|
|
// it a u8 integer type.
|
|
|
|
// it a u8 integer type.
|
|
|
|
const Character = struct {
|
|
|
|
const Character = struct {
|
|
|
|
class: Class,
|
|
|
|
role: Role,
|
|
|
|
gold: u32,
|
|
|
|
gold: u32,
|
|
|
|
experience: u32,
|
|
|
|
experience: u32,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -41,7 +41,7 @@ const Character = struct {
|
|
|
|
pub fn main() void {
|
|
|
|
pub fn main() void {
|
|
|
|
// Please initialize Glorp with 100 health.
|
|
|
|
// Please initialize Glorp with 100 health.
|
|
|
|
var glorp_the_wise = Character{
|
|
|
|
var glorp_the_wise = Character{
|
|
|
|
.class = Class.wizard,
|
|
|
|
.role = Role.wizard,
|
|
|
|
.gold = 20,
|
|
|
|
.gold = 20,
|
|
|
|
.experience = 10,
|
|
|
|
.experience = 10,
|
|
|
|
};
|
|
|
|
};
|
|
|
|