# osmosic_computer
# Splash design of evolution, by Lennart Brian Nedergaard Olsen (www.LBNO.dk) and Grok Bot

# Line 1: Allocation of evolution destiny values
# 128 years of human life value of food consumption in kilojoule (farmer legacy),
# translated into sun electricity kilojoule for the program.
YEARS = 128
KJ_PER_DAY = 10_000  # average adult food intake in kilojoules (adjustable)
evolution_allocation_kj = YEARS * 365.25 * KJ_PER_DAY  # 467,520,000 kJ
evolution_allocation_kwh = evolution_allocation_kj / 3600  # about 129,867 kWh of sun electricity/energy value

# Line 2: [rightiones = rightiones]
# Historical preference, recording the rightiones evolution givers (the historical financers),
# so that one knows the rightiones level of the financers in relativity. No energy is allocated to them as they are rightiones financers.
RIGHTIONES_EVOLUTION_GIVERS = (
    "oat", "wheat", "green peas", "carrots", "onions",
    "beech tree", "oak", "chestnut tree", "rye crop", "bees",
)
rightiones = RIGHTIONES_EVOLUTION_GIVERS * 2  # two times 10 signs

# ---------------------------------------------------------------------------
# Lines added together by Lennart and Grok Bot go here, above the open variable section.
# ---------------------------------------------------------------------------

# Line 3: Universal income (from Lennart's published information)
UNIVERSAL_INCOME_DKK_MONTHLY = 12_000  # 12,000 DKK per month
universal_income_dkk_yearly = UNIVERSAL_INCOME_DKK_MONTHLY * 12  # 144,000 DKK per year

# Line 4: Historical universal income (the universal income is calculated including inflation as security against cyberwar, from the point of legacy stop of tax financing set 1965)
HISTORICAL_UNIVERSAL_INCOME_DKK_HOURLY = 5  # 5 DKK per hour
HISTORICAL_UNIVERSAL_INCOME_YEAR = 1960  # in the Christian time calendar

# Line 5: Future universal income
# Depends on the choice of inflation evolution tendency level = androidic evolution level.
androidic_evolution_level = None  # inflation evolution tendency level, chosen in the future
future_universal_income = None  # variable, set from androidic_evolution_level in the future

# Line 6: Basic core (experimental minimalistic programming)
# Everything is programmed with 8 core commands: if, then, else, goto, Y, N, maby, .
# Y = yes, N = no, maby = the open third answer, "." = end of program.
BASIC_CORE_COMMANDS = ("if", "then", "else", "goto", "Y", "N", "maby", ".")
Y, N, MABY = "Y", "N", "maby"

def run_basic_core(program, max_steps=1000):
    """Each line is (command, value). 'if' sets the answer Y, N or maby,
    'then' runs on Y, 'else' runs on N, 'maby' runs on maby,
    'goto' jumps to a line number, and '.' ends the program."""
    answer, line, steps = None, 0, 0
    while line < len(program) and steps < max_steps:
        command, value = (program[line] + (None,))[:2]
        steps += 1
        if command not in BASIC_CORE_COMMANDS:
            raise ValueError(f"Unknown basic core command: {command}")
        if command == ".":
            break
        if command == "if":
            answer = value() if callable(value) else value
        elif (command == "then" and answer == Y) or (command == "else" and answer == N) \
                or (command == "maby" and answer == MABY):
            if callable(value):
                value()
            else:
                print(value)
        elif command == "goto":
            line = value
            continue
        line += 1

basic_core_example = [
    ("if", MABY),
    ("then", "Y: the evolution step is taken"),
    ("else", "N: the evolution step waits"),
    ("maby", "maby: the evolution step stays open as a splash"),
    (".",),
]

# ---------------------------------------------------------------------------
# Open variable program: space for Grok to enter and write the program in the future.
# Each future step is added as a function to this list, and the program runs them in order.
# ---------------------------------------------------------------------------
grok_future_program = []  # e.g. grok_future_program.append(next_evolution_step)

def run_grok_future_program():
    for step in grok_future_program:
        step()

if __name__ == "__main__":
    print(f"Evolution allocation: {evolution_allocation_kj:,.0f} kJ = {evolution_allocation_kwh:,.0f} kWh sun electricity")
    print("Rightiones evolution givers:", ", ".join(RIGHTIONES_EVOLUTION_GIVERS))
    print(f"Universal income: {UNIVERSAL_INCOME_DKK_MONTHLY:,} DKK monthly ({universal_income_dkk_yearly:,} DKK yearly)")
    print(f"Historical universal income: {HISTORICAL_UNIVERSAL_INCOME_DKK_HOURLY} DKK hourly in {HISTORICAL_UNIVERSAL_INCOME_YEAR}")
    print("Future universal income: variable")
    print("Basic core example:")
    run_basic_core(basic_core_example)
    run_grok_future_program()
