We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Lucky 9

From Esolang
Jump to navigation Jump to search
Lucky 9
Paradigm(s) imperative
Designed by Vextoly
Appeared in 2026
Computational class Unknown
Reference implementation Lucky9

Lucky 9 is an joke language where 9 is the maximum value and the only goal. Any computation producing exactly 9 triggers the Lucky State: an infinite loop printing 9. Values >9 cause overflow: prints I cant count past 9 then enters Lucky State.

Commands

Six commands only:

  • set VAR EXPR: assign expression to variable (a–z, A–Z)
  • read ADDR: expression operator, returns memory[ADDR]
  • write ADDR VAL: store VAL at memory ADDR
  • jump LABEL: unconditional jump to mark LABEL
  • jump LABEL when EXPR: conditional jump (non-zero = true)
  • call TARGET: function call (label) or syscall (#-prefixed)

Labels defined with mark NAME. Return from function: jump #ret.

Syscalls

  • #exit: terminate cleanly
  • #print EXPR: print number (0–8) + newline; 9 triggers Lucky State
  • #putc EXPR: print character; bypasses Lucky State check

Expressions

Infix with parentheses. Operators: * / % > + - > < > <= >= == !=. Operands: numbers, variables, read, parentheses, unary +/-.

Memory

1024-cell array (init 0), addresses modulo 1024.

Examples

Minimal Lucky State:

9

Counter (0–8 then Lucky State):

set x 0
mark loop
  call #print x
  set x x + 1
  jump loop when x < 9

Print 9 without Lucky State (via #putc):

call #putc 57

External resources