Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,18 @@
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
var hash_map = std.StringHashMap(f64).init(allocator);
defer hash_map.deinit();
try hash_map.put("pi", 3.14159265);
try hash_map.put("e", 2.71828183);
try hash_map.put("phi", 1.61803399);
try stdout.print("{d}\n", .{hash_map.get("pi").?});
try stdout.print("{d}\n", .{hash_map.get("e").?});
try stdout.print("{d}\n", .{hash_map.get("phi").?});
}

View file

@ -0,0 +1,23 @@
const std = @import("std");
const Entity = struct {
name: []const u8,
hp: i32,
};
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
const allocator = gpa.allocator();
var hash_map = std.AutoHashMap(u32, Entity).init(allocator);
defer hash_map.deinit();
try hash_map.put(123, .{ .name = "Zombie", .hp = 20 });
try hash_map.put(456, .{ .name = "Bat", .hp = 6 });
try hash_map.put(789, .{ .name = "Pig", .hp = 10 });
try stdout.print("{s:6}: HP = {d:3}\n", hash_map.get(123).?);
try stdout.print("{s:6}: HP = {d:3}\n", hash_map.get(456).?);
try stdout.print("{s:6}: HP = {d:3}\n", hash_map.get(789).?);
}