User:FrankPujo/Circle

From Esolang
Jump to navigation Jump to search

The Circle is a concept for a new esoteric Data Type.

Note that the following code (explicative to how a Circle would work as a Class) is not created in any particular programming language but rather a simplified version of an imaginary one (somewhat similar to Python?) to make it easily readable to all.

 pi = 3.14159
 Circle():
    angle = 0
    values = {}
    function add( value ):
       values.angle = value
    function opposite():
       angle = (angle + pi / 2) % pi
    function get():
       return values.angle
    function reset()
       angle = 0
    function turn( add_angle ):
       angle = (angle + add_angle) % pi
    function get_opposite()
       self.opposite()
       value = self.get()
       self.opposite()
       return value
    function get_ternary()
       old_angle = angle
       value1 = get()
       angle = angle + pi * 2 / 3
       value2 = get()
       angle = angle + pi * 2 / 3
       value3 = get()
       angle = old_angle
       return value1, value2, value3