Gamified input-output tables (no GUI).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

71 lines
1.4 KiB

const std = @import("std");
const root = @import("root");
const util = root.util;
pub const Range = util.Range;
pub const Start = struct {
pub const Product = struct {
pub const Cost = struct {
labor: Range = .{},
number: Range = .{}, //number of products required
quantity: Range = .{}, //quantity of those inputs
};
number: Range, //number of products
cost: Cost = .{},
necessity: Range,
};
pub const Agent = struct {
number: Range,
funds: Range,
age: Range,
health: Range,
happiness: Range,
consumption: Range,
prefs: Range,
pref_threshold: f32,
};
pub const Task = struct {};
seed: u64,
average_agent_labor: f32,
initial_stock_days: f32,
task: Task = .{},
agent: Agent,
primary: Product,
secondary: Product,
tertiary: Product,
script: []const u8, //path to the file
};
pub const Run = struct {
pub const Task = struct {
pub const Unspent = enum {
destroy,
keep,
remove,
};
unspent: Unspent = .keep,
};
task: Task = .{},
};
start: Start,
run: Run,
pub fn load(alloc: std.mem.Allocator, path: []const u8) !@This() {
@setEvalBranchQuota(10000);
const file = try util.readFileAlloc(alloc, path);
return try std.json.parseFromSliceLeaky(@This(), alloc, file, .{});
}