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.

Foton

From Esolang
Jump to navigation Jump to search

Foton is a very simple esolang/cellular automaton themed around light beams made by User:QuantumV.

Commands

/, \	Reflect beam
+	Split beam into two
#	Absorb beam
$D	Emit a beam when a beam touches it
*D	Emit beam (D = direction)
1, 0	Sensor: Toggle on hit
u,n,[,]	Emit a beam if the sensor behind it is 1  (for example 1[ )
!	Skip instruction 
<,>,^,V - Two mirrors in one character (for example going into a > from above or bottom will do what you expect 
but going forwards will make it reflect two times (180 degrees) and going backwards will do nothing) 
Beams colliding means they get destroyed

Sample Programs

Full Adder

 
            /_\           
C           / >____________# SUM
1[__________+//         
            ___\1[\     
             ! \__\\ 1  
  /_\       _/     | n  
A / >_______+  /__/$R\\ 
1[+//       ___/1[/   | 
  ___\1[\             \\
   ! \__\\ 1           |   
B _/     | n           $R__# CARRY
1[+  /__/$R\___________/ 
  ___/1[/         

NAND


   1[\/\   
1[___\/|                  INPUT 1
       |    
1[___/\$R___________#      INPUT 2 (AND OUTPUT)
   1[/\/ 
      


Interpreters

The official interpreter written by User:QuantumV: https://github.com/QuantumV2/Foton