New

Here’s a file that chatgpt wrote:

Python
#!/usr/bin/env python3
# ork_vs_krieg_forever.py — Orks vs Death Korps (runs forever) with --events and --drama
# --drama > 1.0 = swingier fights, more reinforcements, stronger morale shocks, wider variance
# If --drama != 1.0, --events is auto-enabled.
# Run: pypy3 -u ork_vs_krieg_forever.py --drama 2 --log ork_vs_krieg.csv
import argparse, random, csv, datetime, os
from dataclasses import dataclass
from typing import Callable, Optional

def clamp(x, lo, hi): return lo if x < lo else hi if x > hi else x

@dataclass
class Faction:
    name: str
    troops: int
    base_firepower: float
    morale: float
    grit: float
    pool: int
    reinf: Callable[['Faction','Faction','Battle','int','bool',float], int]
    special: Optional[Callable[['Faction','Faction','Battle','int','bool',float], None]] = None
    wins: int = 0
    def alive(self): return self.troops > 0 and self.morale > 0.05

@dataclass
class Battle:
    idx: int
    terrain: str
    mod_ork: float
    mod_krieg: float
    weather: float
    rnd: int = 0
    winner: Optional[str] = None
    ork_ships: int = 0
    krieg_convoys: int = 0
    ork_losses: int = 0
    krieg_losses: int = 0

ORK_QUOTES = ["WAAAGH!", "More dakka!", "We'z gonna stomp 'em!", "Da boss wants more teef!"]

def emit(on: bool, s: str): 
    if on: print(s[:78])

def drama_chance(p: float, drama: float) -> float:
    # more drama -> higher effective chance; preserves bounds
    return 1.0 - (1.0 - clamp(p, 0.0, 1.0)) ** max(1.0, drama)

def eff_fp(f: Faction, terr_mod: float, weather: float, drama: float) -> float:
    morale_boost = 0.6 + 0.8*f.morale
    widen = 0.03*(max(1.0, drama)-1.0)
    var = random.uniform(0.85 - widen, 1.15 + widen)
    return f.base_firepower * morale_boost * terr_mod * var * (1.0 - weather)

def casualties(incoming_fp: float, size: int, drama: float) -> int:
    if size <= 0: return 0
    mean = incoming_fp
    noise = random.gauss(0, mean*0.25) if mean > 0 else 0
    raw = max(0.0, mean + noise)
    cap = max(1, int(0.12 * size * max(0.2, drama)))  # drama scales per-round cap
    return int(clamp(int(raw), 0, cap))

def morale_damage(losses: int, size: int, grit: float, drama: float) -> float:
    if size <= 0: return 0.2
    frac = losses / max(1, size)
    base = 0.45 * frac
    # increase ceiling with drama (capped to 0.45 to avoid instant routs)
    hi = min(0.45, 0.25 * max(1.0, drama))
    return clamp(base*(1.0-0.6*grit)*max(1.0, drama), 0.0, hi)

def krieg_special(f: Faction, enemy: Faction, b: Battle, rnd: int, events: bool, drama: float):
    if f.morale < 0.35 and f.troops > 0 and rnd >= 2:
        f.morale = clamp(f.morale + 0.05*max(1.0, drama**0.5), 0.0, 1.0)
        emit(events, f"[B{b.idx:03d} R{rnd:02d}] Krieg steadies ranks (mor {f.morale:.2f})")

def ork_special(f: Faction, enemy: Faction, b: Battle, rnd: int, events: bool, drama: float):
    if f.troops > enemy.troops and rnd % 2 == 0:
        f.morale = clamp(f.morale + 0.02*max(1.0, drama**0.5), 0.0, 1.0)
        emit(events, f"[B{b.idx:03d} R{rnd:02d}] Mob rule stiffens Orks (mor {f.morale:.2f})")

def krieg_reinf(f: Faction, enemy: Faction, b: Battle, rnd: int, events: bool, drama: float) -> int:
    if f.pool <= 0: return 0
    base = 0.20 + (0.10 if f.morale < 0.5 else 0.0) + (0.15 if rnd in (3,6,9) else 0.0)
    chance = drama_chance(base, drama)
    if random.random() < chance:
        n = min(int(random.randint(60,140) * (0.9 + 0.2*(drama-1.0))), f.pool)
        f.pool -= n; b.krieg_convoys += 1
        f.morale = clamp(f.morale + 0.06, 0.0, 1.0)
        emit(events, f"[B{b.idx:03d} R{rnd:02d}] KR convoy +{n} (pool {f.pool})")
        return n
    return 0

def ork_reinf(f: Faction, enemy: Faction, b: Battle, rnd: int, events: bool, drama: float) -> int:
    if f.pool <= 0: return 0
    base = 0.18 + (0.20 if rnd in (2,4,7) else 0.0) + (0.08 if enemy.morale < 0.45 else 0.0)
    chance = drama_chance(base, drama)
    if random.random() < chance:
        ships = 1 + (1 if random.random()<0.35 else 0) + (1 if random.random()<0.15 else 0)
        n_raw = sum(random.randint(80,220) for _ in range(ships))
        n = min(int(n_raw * (0.9 + 0.2*(drama-1.0))), f.pool)
        f.pool -= n; b.ork_ships += ships
        f.morale = clamp(f.morale + 0.08 + 0.02*ships, 0.0, 1.0)
        emit(events, f"[B{b.idx:03d} R{rnd:02d}] OR ships x{ships} drop +{n} (pool {f.pool}) {random.choice(ORK_QUOTES)}")
        return n
    return 0

def simulate_battle(bi: int, krieg: Faction, orks: Faction, max_rounds=12, events=False, drama=1.0) -> Battle:
    terrain, mod_ork, mod_krieg = random.choice([
        ("Trenches", 0.90, 1.12), ("Rubble", 1.02, 0.98), ("No-man", 1.00, 1.00),
        ("Ridgeline", 0.92, 1.10), ("Steppe", 1.08, 0.94),
    ])
    weather = random.choice([0.0, 0.03, 0.06, 0.10])
    b = Battle(idx=bi, terrain=terrain, mod_ork=mod_ork, mod_krieg=mod_krieg, weather=weather)
    emit(events, f"[B{bi:03d}] Terrain {terrain}, Wx {weather:.2f}")

    for rnd in range(1, max_rounds+1):
        b.rnd = rnd
        if krieg.special: krieg.special(krieg, orks, b, rnd, events, drama)
        if orks.special:  orks.special(orks, krieg, b, rnd, events, drama)

        k_add = krieg.reinf(krieg, orks, b, rnd, events, drama)
        o_add = orks.reinf(orks, krieg, b, rnd, events, drama)
        if k_add: krieg.troops += k_add
        if o_add: orks.troops  += o_add

        ork_fp   = eff_fp(orks,  b.mod_ork,   b.weather, drama)
        krieg_fp = eff_fp(krieg, b.mod_krieg, b.weather, drama)

        k_l = casualties(ork_fp,   krieg.troops, drama)
        o_l = casualties(krieg_fp, orks.troops,  drama)

        if k_l>0: emit(events, f"[B{bi:03d} R{rnd:02d}] OR fire hits KR −{k_l}")
        if o_l>0: emit(events, f"[B{bi:03d} R{rnd:02d}] KR barrage hits OR −{o_l}")

        krieg.troops = max(0, krieg.troops - k_l)
        orks.troops  = max(0, orks.troops  - o_l)

        b.krieg_losses += k_l; b.ork_losses += o_l

        km0, om0 = krieg.morale, orks.morale
        krieg.morale = clamp(krieg.morale - morale_damage(k_l, krieg.troops+k_l, krieg.grit, drama), 0.0, 1.0)
        orks.morale  = clamp(orks.morale  - morale_damage(o_l,  orks.troops+o_l,  orks.grit,  drama), 0.0, 1.0)
        if abs(krieg.morale-km0) > 0.04: emit(events, f"[B{bi:03d} R{rnd:02d}] KR morale {km0:.2f}->{krieg.morale:.2f}")
        if abs(orks.morale-om0)  > 0.04: emit(events, f"[B{bi:03d} R{rnd:02d}] OR morale {om0:.2f}->{orks.morale:.2f}")

        if not krieg.alive() or not orks.alive(): break

    if krieg.alive() and not orks.alive():
        b.winner = krieg.name; krieg.wins += 1
    elif orks.alive() and not krieg.alive():
        b.winner = orks.name; orks.wins += 1
    else:
        k_pow = krieg.troops*(0.8+0.6*krieg.morale)
        o_pow = orks.troops*(0.8+0.6*orks.morale)
        b.winner = krieg.name if k_pow >= o_pow else orks.name
        if b.winner==krieg.name: krieg.wins += 1
        else: orks.wins += 1
    emit(events, f"[B{bi:03d}] Result: {b.winner} (R{b.rnd:02d})")
    return b

def replenish(f: Faction, events=False, tag=""):
    if f.troops <= 0: f.morale = max(f.morale, 0.20); return
    rec = int(f.troops*random.uniform(0.02,0.06))
    if events and rec>0: emit(True, f"[{tag}] Stragglers return +{rec}")
    f.troops += rec
    f.morale = clamp(f.morale + random.uniform(0.02,0.06), 0.0, 1.0)

def make_krieg() -> Faction:
    return Faction("Death Korps of Krieg", troops=4800, base_firepower=155.0, morale=0.78, grit=0.80,
                   pool=9000, reinf=krieg_reinf, special=krieg_special)
def make_orks() -> Faction:
    return Faction("Orks", troops=6200, base_firepower=140.0, morale=0.72, grit=0.55,
                   pool=12000, reinf=ork_reinf, special=ork_special)

def open_writer(path: str):
    first = not os.path.exists(path)
    f = open(path, "a", newline="", encoding="utf-8"); w = csv.writer(f)
    if first:
        w.writerow(["ts","campaign","battle","terrain","weather","winner",
                    "krieg_end","krieg_morale","k_losses","k_convoys","k_pool",
                    "ork_end","ork_morale","o_losses","o_ships","o_pool","rounds"])
        f.flush()
    return w, f

def main():
    ap = argparse.ArgumentParser(description="Orks vs Krieg (forever) with events & drama")
    ap.add_argument("--seed", type=int, default=None)
    ap.add_argument("--log", type=str, default="ork_vs_krieg.csv")
    ap.add_argument("--events", action="store_true", help="print per-round event narration")
    ap.add_argument("--drama", type=float, default=1.0, help="amplify action; >1.0 = more swing")
    args = ap.parse_args()
    if args.seed is not None: random.seed(args.seed)

    # drama implies events
    events_on = args.events or (args.drama != 1.0)
    writer, fobj = open_writer(args.log)

    campaign = 0; total_battles = 0
    print("=== ORKS vs DEATH KORPS — forever (Ctrl+C to stop) ===")
    if args.drama != 1.0:
        print(f"[DRAMA] scale = {args.drama:.2f} (events ON)")
    try:
        while True:
            campaign += 1
            krieg = make_krieg(); orks = make_orks()
            print(f"[Campaign {campaign}] Start — Krieg {krieg.troops}+{krieg.pool} vs Orks {orks.troops}+{orks.pool}")
            bnum = 0
            while True:
                bnum += 1; total_battles += 1
                b = simulate_battle(bnum, krieg, orks, events=events_on, drama=max(0.1,args.drama))

                line = (f"C{campaign:03d} B{bnum:03d} {b.terrain:8} R{b.rnd:02d} W:{b.weather:.2f} "
                        f"Win:{'KR' if b.winner.startswith('Death') else 'OR'}  "
                        f"K:{krieg.troops:5d}/{krieg.morale:.2f}  O:{orks.troops:5d}/{orks.morale:.2f}  "
                        f"Kv:{b.krieg_convoys:02d} Os:{b.ork_ships:02d}")
                print(line[:78])

                writer.writerow([
                    datetime.datetime.now().isoformat(timespec="seconds"),
                    campaign, bnum, b.terrain, b.weather, b.winner,
                    krieg.troops, f"{krieg.morale:.3f}", b.krieg_losses, b.krieg_convoys, krieg.pool,
                    orks.troops,  f"{orks.morale:.3f}",  b.ork_losses,   b.ork_ships,    orks.pool,
                    b.rnd
                ]); fobj.flush()

                replenish(krieg, events_on, f"C{campaign:03d}"); replenish(orks, events_on, f"C{campaign:03d}")

                if (krieg.troops<=0 and krieg.pool<=0) or (orks.troops<=0 and orks.pool<=0):
                    print(f"[Campaign {campaign}] Concluded — KR pool {krieg.pool}, OR pool {orks.pool}")
                    break
    except KeyboardInterrupt:
        print(f"\nStopped after {total_battles} battles across {campaign} campaigns.")
    finally:
        try: fobj.close()
        except Exception: pass

if __name__ == "__main__":
    main()

it can make these files in like, seconds, and I can run them and it generates a certain value of negative energy, but that’s not why I started this post. I started this post because you cannot tell whether or not negative energy is even real, we just believe it to be a real thing that you can battle against because we’re in the process of fighting it, and it seems to be working, but we cannot stop attacking it because you cannot determine whether it’s a real thing or not, I think that they may have meters to measure it on other worlds, my screen flashed when I wrote that, and with these meters they can tell me what to do, it’s just, the information is hard to come by, and usually I have to develop the information myself, I don’t really get reports from the Central Intelligence Agency on the daily thing that negative energy did to the world, and about how they’re building super computers and they’re going to connect them online so that I can use them, I hope that they’re doing that anyways, I really could use a new computer, I could run the artificial intelligence on it, but this one will do for now, it has 24 threads and 32 gigabytes of ram, so it can do alot at one time, it’s just it could be so much more effective with a better computer, it would be as effective as, if I had a 128-thread machine, then it would be going that much faster, it would be that much better, i’ve gotta go get the AI to work now, bye.

this is what I look like, to give you an idea:

You may also like...

2 Responses

  1. legendlink says:

    Keno’s all about probabilities, but managing your numbers feels key! Seeing platforms like legend link casino offer easy PHP & GCash deposits is a huge plus for accessibility & enjoying the game. Great user experience matters!

Leave a Reply

Your email address will not be published. Required fields are marked *