Ez program

2

was8bit 2022-08-29 05:49

For those new to LowRes or programming in general ... :)

Prog 101b.nx | Open in app
2022-08-29 05:55
Prog 101.nx | Open in app
2022-08-29 05:49

was8bit 2022-08-29 05:56

For those interested, in the first version, if you win or lose your face disappears without actually moving towards what it hit...

In the second version, I corrected this, moving the face BEFORE deciding if player has won or lost...


was8bit 2022-08-29 05:58

So, anyone can make mistakes... the key is to Test your program frequently, so as to be able to find a mistake and fix it quickly before adding more stuff to your game ;)


SP4CEBAR 2022-08-29 09:41 (Edited)

You can simplify
IF LEFT(0) THEN MX=-1 ELSE IF RIGHT(0) THEN MX=1 ELSE MX=0
With
MX=LEFT(0)-RIGHT(0)


was8bit 2022-08-29 09:57

That is quite clever :)

... as i am often programming while sleepy, i try to keep it more readable... math tricks made incorrectly are the ones i never seem to catch :/

Example, i might do right-left and never figure out the error with sleepy brains ;)


SP4CEBAR 2022-08-29 13:07

I'm usually not that worried about getting a value with the wrong sign (+/-), it usually moves the opposite way or something like that, whenever I see something like that, I invert it, (or a variable based on it), and usually that works just fine


was8bit 2022-08-29 15:59

Makes perfect sense :) but sometimes when sleepy my brain works in mysterious ways ;)

Also, the more math layers added to something the harder my brain has to work to understand it... i mean, for example yes i got the highest score in advanced calculus final exam, but also i took the longest time... typical time was 1-2 hours, i used the whole day, over 8 hours...

i have to break things down to their simplest steps with layered math.. so for example...

X/2=5
(X/2)*2=5*2
X*(2/2)=5*2
X*1=5*2
X=10

... where everyone else would have simply said
X=10

... could also be because i am a little dyslexic, so i might initially do
X/2=5
(X/2)*2=5*10
X*(2/2)=5*10
X*1=5*10
X=50

Which, actually, i actually did HERE just above, caught it, and fixed it, before i hit the POST button... and i can actually read thru the second incorrect one a few times before i realize my mistake...

Had i simply jumped to x=50, i would have never caught my mistake... my brain repeats the error as if it was still ok ....

Anyways, i have great respect for people who can get their math into tight little packages :)


McPepic 2022-08-29 16:57

@was8bit, kind of ironic that you happened to type 2 in binary instead of decimal.


was8bit 2022-08-29 17:27

:D


SP4CEBAR 2022-08-30 09:18 (Edited)

I'm a little slow with math too, but that is mostly caused by me double-checking every step of each calculation
Getting math right in programming is pretty hard sometimes, yesterday I spent quite a while debugging one line of code with a bunch of multiplications to try to get my multi-celled characters to go to the next line


was8bit 2022-08-30 12:28

Thats why i do a lot of testing as i add code... TRACE is wonderful :)


SP4CEBAR 2022-08-30 19:49

It really is


Log in to reply.