File size: 19,575 Bytes
6da8440 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | """Procedural Roblox-native builds: correct by construction, unlimited, free.
These teach Bloxy real Roblox scale (doors 7 studs, floors 12 studs, rails at
waist height), clean structure (walls with openings, gable roofs, supports) and
sectioned, readable build code. Each generator returns (user prompt, answer).
"""
from __future__ import annotations
import math
import random
from .common import pascal
from .luau_build import Build, Part, answer
WALLS = [
("Brick", ["9c4a35", "8a3f2c", "b2694e", "6e3b2b"], "brick"),
("WoodPlanks", ["b8945f", "7a5a34", "d7c185", "4f3218"], "wooden"),
("Concrete", ["c8c8c8", "e8e2d4", "a3a2a5", "d9cfc1"], "concrete"),
("Cobblestone", ["7a7a7a", "8a8478"], "stone"),
("Sandstone", ["d9cb94", "c9b47a"], "sandstone"),
("SmoothPlastic", ["f2f3f3", "e0d6c3", "a5c8e1", "c9e4c5"], "modern"),
]
ROOFS = [("Slate", "4d4d50"), ("WoodPlanks", "6b4a2b"), ("Brick", "7b2e1f"), ("Metal", "6e7378"),
("Concrete", "3f4247"), ("Fabric", "a12722")]
FLOORS = [("WoodPlanks", "b8945f"), ("Concrete", "a3a2a5"), ("Marble", "ebe5de"),
("Slate", "5b5b5e"), ("WoodPlanks", "7a5a34")]
def _r(rng, a, b, step=1):
return rng.randrange(int(a / step), int(b / step) + 1) * step
def _wall_x(name, x0, x1, y0, y1, z, t, mat, col, openings=()):
"""Wall along X from x0..x1 at depth z, with rectangular openings (ox0, ox1, oy0, oy1)."""
parts = []
xs = sorted({x0, x1, *[o[0] for o in openings], *[o[1] for o in openings]})
for a, b in zip(xs, xs[1:]):
mid = (a + b) / 2
holes = [o for o in openings if o[0] <= mid <= o[1]]
ys = [(y0, y1)]
for o in holes:
new = []
for s, e in ys:
if o[2] > s:
new.append((s, min(e, o[2])))
if o[3] < e:
new.append((max(s, o[3]), e))
ys = new
for s, e in ys:
if e - s > 0.01 and b - a > 0.01:
parts.append(Part(name, (b - a, e - s, t), (mid, (s + e) / 2, z), mat, col))
return parts
def _wall_z(name, z0, z1, y0, y1, x, t, mat, col, openings=()):
out = []
for p in _wall_x(name, z0, z1, y0, y1, 0, t, mat, col, openings):
out.append(Part(p.name, (t, p.size[1], p.size[0]), (x, p.pos[1], p.pos[0]), mat, col))
return out
def house(rng: random.Random):
wmat, wcols, wword = rng.choice(WALLS)
wcol = rng.choice(wcols)
rmat, rcol = rng.choice(ROOFS)
fmat, fcol = rng.choice(FLOORS)
w, d, h, t = _r(rng, 16, 32, 2), _r(rng, 16, 28, 2), rng.choice([12, 12, 14]), 1
size_word = "small" if w * d < 400 else ("big" if w * d > 650 else "")
roof_kind = rng.choice(["gable", "gable", "flat"])
windows = rng.random() < 0.85
door_w, door_h = 4, 7
b = Build(pascal(f"{wword} house"))
b.section("Floor", [Part("Floor", (w, 1, d), (0, 0.5, 0), fmat, fcol)])
win = lambda c: (c - 2, c + 2, 4, 8) # noqa: E731
front_open = [(-door_w / 2, door_w / 2, 1, 1 + door_h)]
if windows and w >= 20:
front_open += [win(-w / 4 - 1), win(w / 4 + 1)]
side_open = [win(0)] if windows else []
walls = []
walls += _wall_x("FrontWall", -w / 2, w / 2, 1, 1 + h, -d / 2 + t / 2, t, wmat, wcol, front_open)
walls += _wall_x("BackWall", -w / 2, w / 2, 1, 1 + h, d / 2 - t / 2, t, wmat, wcol,
[win(0)] if windows else [])
walls += _wall_z("SideWall", -d / 2 + t, d / 2 - t, 1, 1 + h, -w / 2 + t / 2, t, wmat, wcol, side_open)
walls += _wall_z("SideWall", -d / 2 + t, d / 2 - t, 1, 1 + h, w / 2 - t / 2, t, wmat, wcol, side_open)
b.section("Walls (front wall has the door opening)", walls)
if windows:
glass = []
for o in front_open[1:]:
glass.append(Part("Window", (4, 4, 0.2), ((o[0] + o[1]) / 2, 6, -d / 2 + t / 2), "Glass", "c0e4ec", None, 0.6))
glass.append(Part("Window", (4, 4, 0.2), (0, 6, d / 2 - t / 2), "Glass", "c0e4ec", None, 0.6))
for x in (-w / 2 + t / 2, w / 2 - t / 2):
glass.append(Part("Window", (0.2, 4, 4), (x, 6, 0), "Glass", "c0e4ec", None, 0.6))
b.section("Windows", glass)
top = 1 + h
if roof_kind == "flat":
b.section("Roof", [
Part("Roof", (w + 2, 1, d + 2), (0, top + 0.5, 0), rmat, rcol),
Part("Trim", (w + 2, 1, 1), (0, top + 1.5, -d / 2 - 0.5), rmat, rcol),
Part("Trim", (w + 2, 1, 1), (0, top + 1.5, d / 2 + 0.5), rmat, rcol),
])
roof_desc = "a flat roof"
else:
ang = rng.choice([25, 30, 35])
a = math.radians(ang)
s = w / 2 + 1.5
length = s / math.cos(a)
rise = s * math.tan(a)
cy = top + rise / 2 + 0.5
roof = [
Part("RoofLeft", (length, 1, d + 3), (-s / 2, cy, 0), rmat, rcol, (0, 0, ang)),
Part("RoofRight", (length, 1, d + 3), (s / 2, cy, 0), rmat, rcol, (0, 0, -ang)),
]
# stepped gable ends fill the triangle under the roof
steps = 3
for i in range(steps):
frac = (i + 0.5) / steps
gw = max(1.0, (w - t * 2) * (1 - frac))
gh = (rise - 0.5) / steps
y = top + gh * i + gh / 2
for z in (-d / 2 + t / 2, d / 2 - t / 2):
roof.append(Part("Gable", (round(gw, 2), round(gh, 2), t), (0, round(y, 2), z), wmat, wcol))
b.section(f"Gable roof ({ang} degree pitch)", roof)
roof_desc = f"a {ang} degree gable roof"
name = " ".join(x for x in [size_word, wword, "house"] if x)
prompts = [
f"Build a {name}.",
f"Make a {name} with a door{' and windows' if windows else ''}.",
f"build me a {name}",
f"Create a {w} by {d} stud {wword} house with {roof_desc}.",
f"I need a {name} for my town map.",
]
intro = (f"Here's a {name}: {w}x{d} studs, {h}-stud walls, a 4x7 door in the front"
f"{', glass windows on every side' if windows else ''} and {roof_desc}.")
return rng.choice(prompts), answer(intro, b)
def tower(rng):
wmat, wcols, wword = rng.choice(WALLS[:5])
wcol = rng.choice(wcols)
s, floors = _r(rng, 10, 18, 2), rng.randint(2, 5)
fh = 12
h = floors * fh
b = Build(pascal(f"{wword} tower"))
door = [(-2, 2, 0, 7)]
walls = []
walls += _wall_x("Wall", -s / 2, s / 2, 0, h, -s / 2 + 0.5, 1, wmat, wcol, door)
walls += _wall_x("Wall", -s / 2, s / 2, 0, h, s / 2 - 0.5, 1, wmat, wcol)
walls += _wall_z("Wall", -s / 2 + 1, s / 2 - 1, 0, h, -s / 2 + 0.5, 1, wmat, wcol)
walls += _wall_z("Wall", -s / 2 + 1, s / 2 - 1, 0, h, s / 2 - 0.5, 1, wmat, wcol)
b.section("Walls", walls)
b.section("Floors", [Part("Floor", (s - 2, 1, s - 2), (0, i * fh + 0.5, 0), "WoodPlanks", "7a5a34")
for i in range(floors)])
crenel = []
n = max(2, int(s // 4))
step = s / n
for i in range(n):
x = -s / 2 + step * (i + 0.5)
crenel += [Part("Merlon", (step / 2, 3, 1), (x, h + 1.5, -s / 2 + 0.5), wmat, wcol),
Part("Merlon", (step / 2, 3, 1), (x, h + 1.5, s / 2 - 0.5), wmat, wcol),
Part("Merlon", (1, 3, step / 2), (-s / 2 + 0.5, h + 1.5, x), wmat, wcol),
Part("Merlon", (1, 3, step / 2), (s / 2 - 0.5, h + 1.5, x), wmat, wcol)]
crenel.append(Part("Roof", (s - 2, 1, s - 2), (0, h + 0.5, 0), wmat, wcol))
b.section("Battlements", crenel)
name = f"{wword} tower"
p = rng.choice([f"Build a {floors}-floor {name}.", f"Make a castle {name} with battlements.",
f"build a {name} about {h} studs tall", f"Create a {s}x{s} {name}."])
return p, answer(f"Here's a {s}x{s} {name}, {floors} floors ({h} studs) high, with a doorway and battlements on top.", b)
def fence(rng):
mat, col = rng.choice([("WoodPlanks", "b8945f"), ("WoodPlanks", "7a5a34"), ("Metal", "3e4447"), ("Concrete", "e8e2d4")])
length, gap = _r(rng, 16, 60, 4), rng.choice([4, 6, 8])
n = int(length // gap) + 1
b = Build("Fence")
b.section("Posts", [Part("Post", (1, 4, 1), (-length / 2 + i * gap, 2, 0), mat, col) for i in range(n)])
b.section("Rails", [Part("Rail", (length, 0.5, 0.4), (0, y, 0), mat, col) for y in (1.5, 3.2)])
word = "metal" if mat == "Metal" else ("white" if col == "e8e2d4" else "wooden")
return (rng.choice([f"Build a {word} fence {length} studs long.", f"make a {word} fence", f"Add a {length}-stud {word} fence with posts every {gap} studs."]),
answer(f"Here's a {length}-stud {word} fence: {n} posts {gap} studs apart, 4 studs tall, with two rails.", b))
def stairs(rng):
mat, col = rng.choice(FLOORS + [("Cobblestone", "7a7a7a"), ("Concrete", "c8c8c8")])
n, w, rise, run = rng.randint(6, 16), rng.choice([4, 6, 8]), 1, rng.choice([1.5, 2])
b = Build("Staircase")
b.section("Steps", [Part("Step", (w, rise * (i + 1), run), (0, rise * (i + 1) / 2, i * run + run / 2), mat, col) for i in range(n)])
if rng.random() < 0.5:
L = n * run
ang = math.degrees(math.atan2(n * rise, L))
hyp = math.hypot(L, n * rise)
b.section("Handrail", [Part("Handrail", (0.4, 0.4, hyp), (s * (w / 2 + 0.3), n * rise / 2 + 3, L / 2), "Metal", "6e7378", (-ang, 0, 0)) for s in (-1, 1)])
return (rng.choice([f"Build a staircase with {n} steps.", f"make stairs going up {n} studs", f"Create {w}-stud wide stairs."]),
answer(f"Here's a {w}-stud wide staircase with {n} steps, each {rise} stud up and {run} studs deep (top at {n * rise} studs).", b))
def bridge(rng):
deck_mat, deck_col = rng.choice([("WoodPlanks", "7a5a34"), ("Cobblestone", "7a7a7a"), ("Concrete", "a3a2a5")])
L, w, hgt = _r(rng, 24, 60, 4), rng.choice([6, 8, 10]), rng.choice([4, 6, 8])
b = Build("Bridge")
b.section("Deck", [Part("Deck", (w, 1, L), (0, hgt + 0.5, 0), deck_mat, deck_col)])
rails = []
for x in (-w / 2 + 0.25, w / 2 - 0.25):
rails.append(Part("Railing", (0.5, 0.5, L), (x, hgt + 4, 0), deck_mat, deck_col))
for i in range(int(L // 4) + 1):
rails.append(Part("Baluster", (0.5, 3, 0.5), (x, hgt + 2.5, -L / 2 + i * 4), deck_mat, deck_col))
b.section("Railings", rails)
b.section("Supports", [Part("Pillar", (2, hgt, 2), (x, hgt / 2, z), deck_mat, deck_col)
for z in (-L / 2 + 1, 0, L / 2 - 1) for x in (-w / 2 + 1, w / 2 - 1)])
return (rng.choice([f"Build a bridge {L} studs long.", "make a bridge with railings", f"Create a {w}-wide bridge over a river."]),
answer(f"Here's a {L}-stud bridge, {w} studs wide, {hgt} studs above the ground with railings and support pillars.", b))
def tree(rng):
h, r = rng.randint(8, 18), rng.choice([4, 6, 8])
leaf = rng.choice(["3f7b2d", "4b8f32", "2f6b2a", "e3b3ad"])
trunk = rng.choice(["6b5130", "3b2711", "d5d0c4"])
b = Build("Tree")
b.section("Trunk", [Part("Trunk", (2, h, 2), (0, h / 2, 0), "Wood", trunk)])
leaves = [Part("Leaves", (r * 2, r, r * 2), (0, h + r / 2 - 1, 0), "LeafyGrass", leaf)]
leaves.append(Part("Leaves", (r * 2 - 2, r / 2 + 1, r * 2 - 2), (0, h + r + 0.25, 0), "LeafyGrass", leaf))
for _ in range(rng.randint(1, 3)):
ox, oz = rng.choice([-1, 1]) * (r - 1), rng.choice([-1, 1]) * (r - 1)
leaves.append(Part("Leaves", (r, r - 1, r), (ox, h + r / 2 - 1.5, oz), "LeafyGrass", leaf))
b.section("Leaves", leaves)
kind = "cherry blossom tree" if leaf == "e3b3ad" else ("birch tree" if trunk == "d5d0c4" else "tree")
return (rng.choice([f"Build a {kind}.", f"make a {kind}", f"Add a {h + r}-stud tall {kind}."]),
answer(f"Here's a {kind}, about {h + r} studs tall with a blocky leaf canopy {r * 2} studs wide.", b))
def lamp(rng):
h = rng.choice([10, 12, 14])
glow = rng.choice(["f8d98c", "ffffff", "acdcd6"])
b = Build("StreetLamp")
b.section("Pole", [Part("Base", (2, 1, 2), (0, 0.5, 0), "Metal", "3e4447"),
Part("Pole", (0.6, h, 0.6), (0, h / 2 + 1, 0), "Metal", "3e4447"),
Part("Arm", (3, 0.4, 0.4), (1.2, h + 0.8, 0), "Metal", "3e4447")])
b.section("Light", [Part("LampHead", (1.6, 0.6, 1.6), (2.5, h + 0.6, 0), "Metal", "3e4447"),
Part("Bulb", (1.2, 0.4, 1.2), (2.5, h + 0.1, 0), "Neon", glow)])
return (rng.choice(["Build a street lamp.", "make a lamp post", f"Create a {h + 1}-stud street light."]),
answer(f"Here's a {h + 1}-stud street lamp with a metal pole, an arm and a glowing neon bulb. Add a PointLight to the Bulb if you want it to light the area.", b))
def table_set(rng):
mat, col = rng.choice([("WoodPlanks", "b8945f"), ("WoodPlanks", "4f3218"), ("SmoothPlastic", "f2f3f3")])
tw, td, chairs = rng.choice([6, 8]), rng.choice([4, 6]), rng.choice([2, 4])
b = Build("TableSet")
tbl = [Part("TableTop", (tw, 0.5, td), (0, 3.25, 0), mat, col)]
for sx in (-1, 1):
for sz in (-1, 1):
tbl.append(Part("TableLeg", (0.5, 3, 0.5), (sx * (tw / 2 - 0.5), 1.5, sz * (td / 2 - 0.5)), mat, col))
b.section("Table", tbl)
ch = []
spots = [(0, -td / 2 - 2, 0), (0, td / 2 + 2, 180), (-tw / 2 - 2, 0, 90), (tw / 2 + 2, 0, -90)][:chairs]
for x, z, ry in spots:
ch.append(Part("ChairSeat", (2, 0.4, 2), (x, 2, z), mat, col))
bx, bz = x + (0 if ry in (0, 180) else (-1 if ry == 90 else 1)), z + (-1 if ry == 0 else (1 if ry == 180 else 0))
size = (2, 3, 0.4) if ry in (0, 180) else (0.4, 3, 2)
ch.append(Part("ChairBack", size, (bx, 3.6, bz), mat, col))
for lx in (-0.8, 0.8):
for lz in (-0.8, 0.8):
ch.append(Part("ChairLeg", (0.3, 1.8, 0.3), (x + lx, 0.9, z + lz), mat, col))
b.section("Chairs", ch)
return (rng.choice([f"Build a table with {chairs} chairs.", "make a dining table set", f"Create a {tw}x{td} table and chairs."]),
answer(f"Here's a {tw}x{td}-stud table (3.5 studs tall) with {chairs} chairs facing it.", b))
def obby(rng):
n = rng.randint(5, 10)
cols = ["f8c527", "35399d", "70b919", "ed8dac", "3aafd9", "f07613"]
b = Build("ObbyStage")
b.section("Start", [Part("StartPad", (10, 1, 10), (0, 0.5, 0), "SmoothPlastic", "70b919")])
plats, z, y, kills = [], 5.0, 0.5, []
for i in range(n):
gap = rng.choice([4, 5, 6])
size = rng.choice([4, 5, 6])
z += gap + size / 2
y += rng.choice([0, 1, 1, 2])
x = rng.choice([-3, 0, 3])
plats.append(Part(f"Jump{i + 1}", (size, 1, size), (x, y, z), "SmoothPlastic", rng.choice(cols)))
if rng.random() < 0.3:
kills.append(Part("KillBrick", (size, 0.4, gap), (x, y - 3, z - size / 2 - gap / 2), "Neon", "d92525"))
z += size / 2
b.section("Jumps", plats)
if kills:
b.section("Kill bricks (connect a Touched script that sets Humanoid.Health = 0)", kills)
b.section("Finish", [Part("FinishPad", (10, 1, 10), (0, y, z + 7), "SmoothPlastic", "f8c527")])
return (rng.choice([f"Build an obby stage with {n} jumps.", "make an obby", "Create a simple parkour course."]),
answer(f"Here's an obby stage: a start pad, {n} jumps with 4-6 stud gaps (all reachable with the default JumpPower) and a finish pad.", b))
def arch(rng):
wmat, wcols, wword = rng.choice(WALLS[:5])
col = rng.choice(wcols)
span, h, t = rng.choice([8, 10, 12, 16]), rng.choice([10, 12, 16]), rng.choice([2, 3])
b = Build("Archway")
b.section("Pillars", [Part("Pillar", (t, h, t), (x, h / 2, 0), wmat, col) for x in (-span / 2 - t / 2, span / 2 + t / 2)])
b.section("Top", [Part("Lintel", (span + t * 2 + 2, 2, t + 1), (0, h + 1, 0), wmat, col),
Part("Cap", (span + t * 2 + 3, 0.5, t + 2), (0, h + 2.25, 0), wmat, col)])
return (rng.choice([f"Build a {wword} archway.", f"make a gate arch {span} studs wide", "Create an entrance arch."]),
answer(f"Here's a {wword} archway with a {span}-stud wide, {h}-stud tall opening.", b))
def pyramid(rng):
mat, col = rng.choice([("Sandstone", "d9cb94"), ("Cobblestone", "7a7a7a"), ("Brick", "9c4a35")])
layers, step = rng.randint(4, 10), rng.choice([2, 3, 4])
base = layers * step * 2
b = Build("Pyramid")
b.section("Layers", [Part("Layer", (base - i * step * 2, step, base - i * step * 2), (0, step * i + step / 2, 0), mat, col) for i in range(layers)])
return (rng.choice(["Build a pyramid.", f"make a {mat.lower()} pyramid", f"Create a stepped pyramid {layers} layers tall."]),
answer(f"Here's a stepped pyramid: {layers} layers, {base}x{base} studs at the base and {layers * step} studs tall.", b))
def well(rng):
b = Build("Well")
r = rng.choice([2, 3, 4])
smat, scol, sword = rng.choice([("Cobblestone", "7a7a7a", "cobblestone"), ("Brick", "966253", "brick"),
("Sandstone", "d9cb94", "sandstone"), ("Slate", "5b5b5e", "slate")])
ring = [Part("Wall", (r * 2 + 2, 3, 1), (0, 1.5, z), smat, scol) for z in (-r - 0.5, r + 0.5)]
ring += [Part("Wall", (1, 3, r * 2), (x, 1.5, 0), smat, scol) for x in (-r - 0.5, r + 0.5)]
ring.append(Part("Water", (r * 2, 0.4, r * 2), (0, 1.8, 0), "Glass", "3f76e4", None, 0.4))
b.section("Stone ring", ring)
ang = 30
s = r + 1.5 # roof half-span
L = s / math.cos(math.radians(ang))
rise = s * math.tan(math.radians(ang))
top = 9
b.section("Roof", [Part("Post", (0.8, top - 2.5, 0.8), (x, 3 + (top - 2.5) / 2, 0), "Wood", "6b5130") for x in (-r - 0.5, r + 0.5)]
+ [Part("RoofLeft", (round(L, 2), 0.5, r * 2 + 3), (-s / 2, round(top + rise / 2, 2), 0), "WoodPlanks", "7a5a34", (0, 0, ang)),
Part("RoofRight", (round(L, 2), 0.5, r * 2 + 3), (s / 2, round(top + rise / 2, 2), 0), "WoodPlanks", "7a5a34", (0, 0, -ang)),
Part("Crank", (r * 2 + 1, 0.4, 0.4), (0, 7, 0), "Wood", "3b2711")])
return (rng.choice([f"Build a {sword} well.", "make a well with a roof", "Create a village well.", f"build a {r * 2 + 2}x{r * 2 + 2} well"]),
answer(f"Here's a {sword} well, {r * 2 + 2}x{r * 2 + 2} studs, with water inside, two wooden posts, a crank and a 30 degree roof.", b))
def castle_wall(rng):
L, h = _r(rng, 24, 64, 4), rng.choice([12, 16, 20])
gate = rng.random() < 0.6
b = Build("CastleWall")
opens = [(-4, 4, 0, 10)] if gate else []
b.section("Wall", _wall_x("Wall", -L / 2, L / 2, 0, h, 0, 3, "Cobblestone", "7a7a7a", opens)
+ [Part("Walkway", (L, 1, 3), (0, h + 0.5, 0), "Slate", "5b5b5e")])
n = int(L // 4)
b.section("Battlements", [Part("Merlon", (2, 3, 1), (-L / 2 + 1 + i * 4, h + 2.5, -1), "Cobblestone", "7a7a7a") for i in range(n)])
if gate:
b.section("Gate", [Part("Gate", (8, 10, 0.5), (0, 5, -1.5), "Metal", "3e4447", None, 0.3)])
return (rng.choice([f"Build a castle wall {L} studs long{' with a gate' if gate else ''}.", "make a castle wall", f"Create a {h}-stud tall stone wall with battlements."]),
answer(f"Here's a {L}-stud cobblestone castle wall, {h} studs tall and 3 thick, with a walkway and battlements{', plus an 8x10 gate' if gate else ''}.", b))
GENERATORS = [(house, 6), (tower, 2), (fence, 1), (stairs, 1), (bridge, 1), (tree, 2), (lamp, 1),
(table_set, 1), (obby, 2), (arch, 1), (pyramid, 1), (well, 1), (castle_wall, 1)]
def generate(n: int, seed: int = 0):
rng = random.Random(seed)
pool = [g for g, w in GENERATORS for _ in range(w)]
for _ in range(n):
g = rng.choice(pool)
yield g.__name__, g(rng)
|