Skip to content

Instantly share code, notes, and snippets.

View RandoPerso's full-sized avatar

JiaJian Zeng RandoPerso

View GitHub Profile
@RandoPerso
RandoPerso / NDBall_4-function.nds
Last active October 29, 2021 05:25
NDBall code designed to be a 4-function calculator. This first input is the operation of choice. The other inputs are the numbers to be used. Since NDBall can only handle integers from 0-255, division rounds down.
/Ask for operation and send the ball to the proper coordinate on the (0-indexed) 2nd dimension.
/First, move the ball out of the way into a safe place.
(0) >4
{4,1} >0
{0,1|4,1} $
/Checks if the input is "*" or anything with a lower ASCII value (which is an invalid input). If it is, send the ball to the multiplication calculator, else send the ball to the next check.
{0,2|4,1} Y[43,>2,>0]
(2,0,3,0,1) <0
(0,0,3,0,1) <4
{2,3} >3