Talk:Newton
What are the conditional flow controls? --Zzo38 (talk) 18:21, 3 July 2014 (UTC)
There isn't any... yet. Lucasieks (talk) 03:03, 27 November 2014 (UTC)
This is wonderful DoggianoMaster (talk) 10:21, 30 March 2021 (UTC)
I made a interpreter
I (Grs (talk)) made an interpreter for this in Python. To enter a program, enter it line by line. Type run and press enter to run your code. Type exit and press enter to exit. It will only 1000 iterations of your code, because there is no stopping otherwise. Before running, remove the REMOVE_THIS texts, but do NOT remove the apostrophe characters!
The code:
def run(input_code): # region CONVERT INPUT TO TABLE longest_line_length = 0 for i in range(len(input_code)): if len(input_code[i]) > longest_line_length: longest_line_length = len(input_code[i]) code = [] for y in range(len(input_code)): code.append('REMOVE_THIS') for x in range(longest_line_length): if x < len(input_code[y]): code[y] += input_code[y][x] else: code[y] += ' ' # endregion # region FIND LAUNCH POINT (&) for y in range(len(code)): for x in range(len(code[y])): if code[y][x] == '&': X_char = x Y_line = y break # endregion direction = 2 # LAUNCH DIRECTION: down VARIABLE = 0 for i in range(1000): # you can change this line to while True: if you do not want the program to end # region MOVE APPLE (@) if direction == 0 and Y_line-1 >= 0: # up Y_line -= 1 elif direction == 1 and X_char+1 < len(code[Y_line]): # right X_char += 1 elif direction == 2 and Y_line < len(code): # down Y_line += 1 elif direction == 3 and X_char-1 >= 0: # left X_char -= 1 # endregion command = code[Y_line][X_char] if command == '+': VARIABLE += 1 elif command == '-': VARIABLE -= 1 elif command == '#': if type(VARIABLE) == type(1): print(chr(VARIABLE),end='REMOVE_THIS') else: print(VARIABLE,end='REMOVE_THIS') elif command == '$': VARIABLE = input('$ ') elif command == '|': if direction == 1: direction = 3 elif direction == 3: direction = 1 elif command == '_': if direction == 0: direction = 2 elif direction == 2: direction = 0 elif command == '/': if direction == 0: direction = 1 elif direction == 1: direction = 0 elif direction == 2: direction = 3 else: direction = 2 elif command == '\\': if direction == 0: direction = 3 elif direction == 1: direction = 2 elif direction == 2: direction = 1 else: direction = 0 def main(): run_program = True code = [] while run_program: userinput = input('> ') if userinput == 'exit': run_program = False elif userinput == 'run': run(code) else: code.append(userinput) if __name__ == '__main__': main()
Hello World!
& \++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#\ /#+++##+++++++#+++++++++++++++++++++++++++++ / \-------------------------------------------------------------------------------#\ /#+++++++++++++++++++++++++++++++++++++++++++++++++++++++ / \++++++++++++++++++++++++#+++#------#--------#-------------------------------------------------------------------#\ / / \ \ | /
Add these three
When an apple crosses Newton
N
the apple is deleted.
When an apple crosses fertile land
F
it duplicates the apple and sends the duplicate perpendicular to the original.
When an apple crosses a fork
♘
it will be sent to its left if it's negative, forward if zero, and right if it's positive.
(if you can't tell, the fork is a chess knight)
—CreeperBomb (talk) 04:30, 1 May 2023 (UTC)