Nopfunge Solid

From Esolang
Jump to navigation Jump to search

Nopfunge Solid is a fungeoid that is a simplification of Nopfunge (designed by Hubert Lamontagne in 2015), invented by Keymaker in 2023.

Program and execution

As the language is a simplification of Nopfunge it retains, on purpose, a significant amount of Nopfunge's charasteristics and functionality.

Executing one cycle of Nopfunge Solid consists of first altering (or not altering) the pointer's direction, based on whether the current cell is an arrow (<>v^) or a space ( ), then moving the pointer one step into its current direction. The pointer always moves to another cell on every cycle.

As in Nopfunge, the program is a two-dimensional playfield consisting of spaces and arrows. The reason Nopfunge Solid was made in the first place was this realization: There is no need to have a complex system (complex as in compared to this alternative) of four sections of the program, as it is in Nopfunge. It is possible to replace all the program sections with a small change in the behaviour of the instruction pointer when it reaches the topmost edge or the leftmost edge. In Nopfunge, moving up on the topmost row of the topmost copies, the pointer would enter the border section on the top. In Nopfunge Solid the pointer is set to 'right' and moves one step to right (as if bouncing off the solid edge into a different direction). Similarly for the leftmost row of the leftmost copies, in Nopfunge the pointer would enter the left border section, in Nopfunge Solid the pointer gets its direction set to 'down' and moves one step down. As in Nopfunge, the pointer can always move to right and down, there are infinite copies of the program in those directions.

The program never halts, but interpreters may use instruction extensions such as . to halt.

Initially the pointer begins in 0,0 (the leftmost, topmost cell) of the 0,0-copy, and its direction is 'right'.

Computational class

The language is Turing-complete, which is proven via Minsky Machine to Nopfunge Solid translation. (See link for translator in external resources.)

An example translation

This Minsky Machine program halts, with A=0 and B=3.

1 inc A 2
2 inc A 3
3 dec A 4 6
4 inc B 5
5 inc B 3
6 dec B 7 7
7 halt

It translates into this Nopfunge Solid program which halts (if instruction extension is used) in 0,3-copy of the program, meaning that the pointer is in copy that has location 0 on x-axis and location 3 on y-axis. (If the halting extension is not used, the program will remain in infinite loop which is easy to detect.)

v                 v          
> v                   <      
     v                 <     
        v               <    
           v             <   
              v           <  
                 v         < 
                    v       <
 v>                          
 >                     ^     
                             
    v>                       
    >                   ^    
                             
        <v                   
         >               ^   
>                          ^ 
                             
          >               ^  
          v<                 
                             
             >          ^    
             v<              
                ^<           
                >           ^
                  >         ^
                    v        
                    .        
                    ^        

Variations

Nopfunge Intangible

Nopfunge Intangible is a minor variation of Nopfunge Solid, created by User:ais523 in 2024.

Nopfunge Intangible is similar to Nopfunge Solid, with two changes:

  • If the pointer moves above the top edge of the program, or to the left of the left edge, it reverses direction (rather than rotating 90° along the edge);
  • The <, >, ^ and v instructions only have an effect if they are "at right angles" to the pointer; this does not make a difference if they are hit "from behind" (the pointer continues moving in the same direction in both languages), but if they are hit head-on, in Nopfunge Intangible the pointer continues moving in its previous direction (whereas in Nopfunge Solid it would reverse direction).

Nopfunge Intangible is equivalent under simple translation to Nopfunge Solid, and thus the two languages have the same computational class:

Nopfunge IntangibleNopfunge Solid

 

v v
   
>  

<

v v
 <<
>  

^

v v
 ^ 
>^ 

>

v v
   
>>>

v

v v
  v
> v
 ^<  
 >   
v   <
<  v^
 >^  

 

 ^<  
 >v  
v <<<
<  v^
 >^  

<

>^<  
^>   
^  <<
<  v^
 >^  

^

 ^<  
 >>  
v ^<<
<  v^
 >^  

>

 ^<  
 >v  
v >v<
<  v^
 >^  

v

The general principle behind the translation is to separate the various directions of movement into different rows and columns. In the Nopfunge Solid translation of Nopfunge Intangible, upwards movement uses the second column and downwards movement uses the third; likewise, leftwards movement uses the second row and rightwards movement the third. In the Nopfunge Intangible translation of Nopfunge Solid, upwards movement uses the second column and downwards movement the fourth; likewise, rightwards movement uses the second row and leftwards movement the fourth. In the Nopfunge Solid translation of Nopfunge Intangible, the first row and column are used to detect the top and left edges of the program (which are the only situations in which the pointer will move along the first row or column). In the Nopfunge Intangible translation of Nopfunge Solid, the first, third and fifth row and column are used to give room to route crossing paths past each other (in particular, to separate the path the pointer takes after reflecting off a map edge from the path it took to get there).

External resources

  • Nopfunge Solid page (detailed explanations of the language, translator program, interpreter in Python)

See also