alias sensor d0 alias vent d2 alias heater d3 alias cooler d4 alias led d5 alias wantHeat r1 alias wantCool r2 # wiki says 15<C<50 define toocold 290 # 16.85C define toohot 305 # 31.85C define pressureHigh 138 define pressureLow 100 move wantHeat 0 move wantCool 0 start: yield l r0 sensor Temperature add r9 toocold wantHeat # some hysteresis slt wantHeat r0 r9 bdns heater maybecool s heater On wantHeat maybecool: sub r9 toohot wantCool # some hysteresis sgt wantCool r0 r9 bdns cooler maybeled s cooler On wantCool maybeled: bdns led maybeVent sub r4 r0 273.15 s led Setting r4 # color 2=green, 0=blue, 3=orange mul r3 wantHeat 2 sub r3 2 r3 add r3 r3 wantCool s led Color r3 jal maybeVent j start maybeVent: bdns vent ra l r0 sensor Pressure blt r0 pressureHigh notTooHighP s vent Mode 1 #pump gas from room to pipe s vent PressureExternal pressureHigh s vent On 1 j ra notTooHighP: bgt r0 pressureLow notTooLowP s vent Mode 0 #pump gas from pipe to room s vent PressureExternal pressureLow s vent On 1 j ra notTooLowP: s vent On 0 j ra |
MIPS is the programming language used by IC (integrated circuits) in the game Stationeers. Stationeering web site has a MIPS emulator with syntax highlighting and error detection.