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.

OW-1

From Esolang
Jump to navigation Jump to search

OW-1 is a two-dimensional programming language invented on 12 June 2022 by User:Potato Imaginator. It is inspired from Befunge and Assembly_language. OW abbreviates for "Old Woman".

Description

This is a Case Sensitive Language and works well with American Keyboard Layout.

Inputs are given as either numbers 0-9 , specific alphabets or special commands.

It has two cells A and B and a Buffer called C.

All three cells can only store numbers ( Positive , Negative , Decimal ) .

Operations Performed on A and B are stored in C.

There is a Pointer that is either at Position A or Position B. The Pointer is moved by calling " . " Command.

Current Pointer Position has Light Blue Background.

Commands

Hitting ' z ' key will Pause / Play the Program.

Press ' r ' to Reset.

Press ' o ' to Enable / Disable Output Display.

In edit mode , Press Arrow keys to move position and enter below commands.

Press " Delete " or " Backspace " Key to delete command at a position.

Command Description
^ Changes Direction to Up.
v Changes Direction to Down.
< Changes Direction to Left.
> Changes Direction to Right.
. Changes Current Pointer Position. Switches between A and B
? Changes Direction to Random Direction. ( Up / Down / Left / Right )
+ Stores A + B into C.
- Stores A - B into C.
* Stores A * B into C.
/ Stores A / B into C.
e Power Function : Stores A ^ B into C.
% Modulo Function: Stores A % B into C.
S Swaps value between Current Pointer and C.
s Swaps A and B values.
c Copies Current Pointer Value into C.
p Pastes C Value into Current Pointer Variable.
i Increment Current Pointer Value by 1.
d Decrement Current Pointer Value by 1.
# Prints C value to Output Display.
x End Program.
T If C = 0 then move in same Direction , else Rotate Direction by 90 ( Clockwise ).
0-9 Assign value of 0-9 to Current Pointer.

Examples

Sum of Natural Numbers

>i.p+#.v
^      <

Factorial

6.1>*p.dSTS#x
         S
         .
   ^     <

Change starting value of 6 to any number to get it's Factorial.

Fibonacci_sequence

1c.1c#.#>p+.#v
              
        ^    <

Another one:

1c>#+.pv
  ^    <

Prime_numbers_generator

2c#i.2>%T.i.v
        i     
        -     
      ^ T     
      2 c     
        #     
        .     
        i     
        .     
      ^ <   <

Factors of a Number

1c#6.8*2.p.>%TS#S-Tx
             i    i  
           ^ <    <

Above prints Factors of 48

Square Root

>5.p+.p.5d-p/.p#v
                 
^               <

Change all values of 5 to any number to get it's Square Root.


Another one is:

1c>p.p*pi/p.7i*#v
  ^             <

Change all values of 7 to any number to get it's Square Root.

Random_number_generator

v  >+v
.  1 .
> >?<>p.2/.p.9i*.p.9i*.v
   0 .                 p
   >+^                 .
                       1
  ^ .p./i9.p./i9.#p.-p%<

Absolute Difference of Two Numbers

5.8.>c T.c#x
       d
       .
       c
    ^.dT
       .
       i
       c
       #
       x

Here A = 5 and B = 8

Prints Absolute Difference of A and B .i.e; | A - B |

Minimum of Two Numbers

9.6.>d.dSiS.STS#x
             S
             .
             S
    ^       ST
             S
             #
             x

Maximum of Two Numbers

7.4.>d.dSiS.STSp+#x
             S
             .
             S
    ^       ST
             S
             p
             +
             #
             x

Mathematical Constants

Golden Ratio

1.1>/p.1+.p#v
   ^        <

Golden Ratio φ = 1.618033988749....

Computational class

It is Turing complete as 2-register Minsky machine could be translated into it

Syntax of Minsky machine

INC Rx Lx - increment Rx and jump to Lx
DEC Rx Ls Lf - if Rx is zero jump to Lf, else decrement and jump to Ls
HALT - halts the program

Translation

How jumps are translated is explained below

  • INC A Lx:
>iv
  Lx
  • INC B Lx
>.i.v
    Lx
  • DEC A Ls Lf
>T dv
 Lf   
    Ls
  • DEC B Ls Lf
>.T d.v
  Lf   
      Ls
  • HALT
>x

If jumps of multiple instructions overlap they should be on different lines. Jumps are translated by having a > (for forward jumps) or < (for backward jumps) below v or T and ^ at destination, with jumps if zero for B having a single . between them.

Here is the sample program (with 0-based line numbers) which multiplies 3 by 2 , stores it in A and halts:

0 INC A 1
1 INC A 2
2 INC A 3
3 INC B 4
4 INC B 5
5 DEC B 6 7
6 INC A 5
7 HALT

Which becomes this OW-1 program (which is not minimized for showcase purposes):

>iv>iv>iv>.i.v>.i.v>.Td.v>iv>x
  >^ >^ >^   >^   >^    >^  
                     >.     ^
                   ^       <

External Resources

  • Run Here - A TIC-80 Program to run OW-1.
  • Playlist - Playlist Containing Everything created with OW-1