CodeWalrus

Development => PC, Mac & Vintage Computers => Topic started by: Dream of Omnimaga on February 17, 2015, 02:15:23 AM

Title: Your worst programming fails
Post by: Dream of Omnimaga on February 17, 2015, 02:15:23 AM
We all gotta start somewhere. I don't think we should feel ashamed of our past coding mistakes as a result, providing you don't still do those mistakes. :P Anyway, does anybody here have funny or ridiculous coding mishaps from their past to share?

I start this topic because since I am porting a 2002 game to the CSE I just realized how much of a disaster the code in this game can be. For example, the map engine is about 35% of the entire game size despite being very rudimentary.

Anyway, here I start with something I just found after the title screen, which slipped by when I started remaking the game but went unnoticed until now for odd reasons:

If Z=13:Goto 1
Lbl 1


The following is a sign that the game in question is IN DIRE NEED of a map engine rewrite <_<:
If [A](PV,PMT)=11
[[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1]]->[B]
If [A](PV,PMT)=12
[[1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->[B]
If [A](PV,PMT)=13
[[1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,0,0,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1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1]]->[B]
If [A](PV,PMT)=10
[[1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1][1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]->[B]
ClrHome
prgmMFMR
If (PV=10 and PMT=10 and FV=8) or (FV=5 and PV=1 and M=0) or (PV=1 and PMT=1 and FV=1 and I=0) or (PV=2 and PMT=5 and FV=2 and J=0) or (PV=1 and FV=3 and K=0) or (PV=4 and PMT=5 and L=0 and FV=4) or (PV=4 and PMT=14 and L1(5)=7 and N=0
Output(5,8,"o"


The following had different values for Z because the controls were changed in this version, but you can still see relics of the past:
Repeat (Z>=11 and Z<=22) or Z=31 or (Z=23 and I+J+K+L+M+N>4
getKey->Z
If Z=11
1->L1(5
If Z=12
2->L1(5
If Z=13
3->L1(5
If Z=14
4->L1(5
If Z=15
5->L1(5
If Z=21
6->L1(5
If Z=22
7->L1(5
If Z=23 and I+J+K+L+M+N>4
8->L1(5
End


I am sure I had even worse stuff before, though. One example I remember is Hinkel from the Omnimaga Pack, which uses Lbl/Gotos to move the snake around. When the game was merged with several other games, this resulted in massive lag when pressing keys (half a second).
Title: Re: Your worst programming fails
Post by: Yuki on February 17, 2015, 02:47:17 AM
Just yesterday (https://github.com/juju2143/walrusirc/commit/a6bd438946e1962c30c323e806782a029bab991a), I wondered during a full day why the smiley thing didn't work and tried all the imaginable stuff in the hopes it would work. Turns out I initialized my array that holds the smileys with [] instead of {}. Although it's not the first time (https://github.com/juju2143/EeeZorBot-scripts/commit/7507e89b0d700396861b1a15ee2e6fbb26c5c2d5) I call myself idiot in a git commit.
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 17, 2015, 05:23:55 AM
I think I had something similar happen in HP PPL with FILLPOLY_P >.<.  My most common mistake back then though was omitting an End or using inverted boolean signs (eg < instead of >). But those tend to be common even among more experienced coders I think.
Title: Re: Your worst programming fails
Post by: Unicorn on February 17, 2015, 05:53:00 AM
When I was first learning TI Basic I typed this out using Alpha :p

Clrhome
Disp A
Pause


I was so puzzled when I realized that nothing was happening.
Title: Re: Your worst programming fails
Post by: James Oldiges on February 17, 2015, 08:34:57 AM
I think we can all say out worst fail was not backing up before running faulty code + ram clear.
Title: Re: Your worst programming fails
Post by: Keoni29 on February 17, 2015, 10:07:04 AM
Yesterday I tried to debug a loader program and I could not figure out what was causing it to fail. It turned out that I ran it from the wrong start address. There was just one absolute jump used in the program, so most of it worked except for this one jump. That made it hard to find out my mistake.
Title: Re: Your worst programming fails
Post by: Hayleia on February 17, 2015, 11:50:48 AM
It was some time ago so I don't recall what it was about exactly. But I had a program that worked quite well, except for one little bug when exiting. I thought "lol, I just forgot to put that command at the end of the program". So I added that command, compiled again, ran again... and the bug was still there. In fact, nothing seemed to have changed. I checked, I really added that line that was supposed to solve the bug.

It took me at least 10 minutes to figure out it would of course never be executed if I put it after the final Return...
Title: Re: Your worst programming fails
Post by: Snektron on February 17, 2015, 02:20:42 PM
I don't recall my worst mistake, but this happens sometimes to me >.<:

if (x);
{
     //code
}


(the ';' returns the if block causing "code" to run everytime)
Title: Re: Your worst programming fails
Post by: Hayleia on February 17, 2015, 02:41:03 PM
Lol, that can be hard to detect indeed :P
And glad you mentionned it, I'll add that to my list of reasons why I think the opening bracket should be at the end of the line with the if and not alone on its line :P
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 17, 2015, 03:33:49 PM
Oh wow, I do that often on the HP Prime Cumred >.<. Also I still sometimes forget semicolons at the end of some lines and since the HP Prime always throw Syntax Error no matter the error, it can get extremely hard to find out. In CSS it isn't a problem for me though (although CSS isn't really programming lol) because I use the SMF CSS editor which previews the result in real-time.
Quote from: James Oldiges on February 17, 2015, 08:34:57 AM
I think we can all say out worst fail was not backing up before running faulty code + ram clear.
^This. Although on the CSE I noticed that sometimes when the screen messes up it doesn't necessarily mean a RAM clear. Sometimes you just have to turn the calc OFF (although you can't see anything, so be careful to not launch another program) then ON again to fix it.
Title: Re: Your worst programming fails
Post by: Snektron on February 17, 2015, 04:50:31 PM
Quote from: James Oldiges on February 17, 2015, 08:34:57 AM
I think we can all say out worst fail was not backing up before running faulty code + ram clear.
Thank science for Axe Backup amirite?
Title: Re: Your worst programming fails
Post by: DarkestEx on February 17, 2015, 04:52:14 PM
Pressing "No" when being asked for Garbage Collect, compiling Axe code.
Title: Re: Your worst programming fails
Post by: Duke "Tape" Eiyeron on February 17, 2015, 05:06:06 PM
Programming anything, because it'll fail.
Title: Re: Your worst programming fails
Post by: matrefeytontias on February 17, 2015, 07:53:53 PM
This. It gave me nightmares when it came to releasing nKaruga.

(http://img.ourl.ca/stoopidMe.png)
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 17, 2015, 08:36:36 PM
Quote from: DarkestEx on February 17, 2015, 04:52:14 PM
Pressing "No" when being asked for Garbage Collect, compiling Axe code.
i remember when people did that regularly. As for Axe backups I never relied on them because in 2011 or so some people reported that they often corrupted easily.

One CSE thing that can result into crashes is if you run Assemblybandit's apps via Doors CSE 8.1. It usually results into a bad crash on exit. The problem is that in DCSE it's very easy to enter the APPS menu by accident since it's the first item in the list, but it's very hard to exit if you forgot the keypad shortcut.
Title: Re: Your worst programming fails
Post by: Yuki on February 18, 2015, 01:07:44 AM
I think your worst nightmare would be variable collisions. That is, you decide to name a variable the same as another variable (maybe in a global-er scope) you forgot about. Sometimes it works because you no longer use the old variable (sometimes you'd actually want to do that), sometimes it just fails for apparently no reason. You rename it, woops it now magically works again.
Title: Re: Your worst programming fails
Post by: Snektron on February 18, 2015, 01:31:30 AM
Quote from: Juju on February 18, 2015, 01:07:44 AM
You rename it, woops it now magically works again.
Html is that you?
Title: Re: Your worst programming fails
Post by: Adriweb on February 18, 2015, 01:34:09 AM
Little things like writing '<' instead of '>' (or vice-versa), such that it breaks the whole project... (well, makes it do the opposite :P)

Here (https://github.com/adriweb/micrOCR/blob/master/src/projet.c#L1300) or here (https://github.com/adriweb/Projet_Biometrie/blob/master/src/Bio_LBP.c#L502), I don't remember which, but it's the same thing, kinda.

For an OCR project, well, one is supposed to compare to known things and keep the best candidate every iteration, not the worst one....
It took a bit of time to debug... But oh boy did I facepalm.
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 18, 2015, 03:32:20 AM
Quote from: Juju on February 18, 2015, 01:07:44 AM
I think your worst nightmare would be variable collisions. That is, you decide to name a variable the same as another variable (maybe in a global-er scope) you forgot about. Sometimes it works because you no longer use the old variable (sometimes you'd actually want to do that), sometimes it just fails for apparently no reason. You rename it, woops it now magically works again.
Yeah that's why for complex programs I now write down what variables I have used so far or comment my code when possible. I had this happen sometimes to me.


EDIT: O.O

If R=1
Output(2,10,"Q
If R=2
Output(2,10,"*
If R=3
Output(2,10,"c
If R=4
Output(2,10,"x
If R=5
Output(2,10,"Z


Good thing I learned how to use the sub() command after making that game...
Title: Re: Your worst programming fails
Post by: Travis on February 19, 2015, 04:17:23 AM
Some stuff from my first TI-81 programs written in a notebook:


:Lbl A
[display a menu]
:Input θ
:If θ=1
:Goto A
:If θ=2
:Goto B
:If θ=3
:Goto C
[...]
:Lbl C
:0→H
:Goto A


And:


:Lbl B
[...]
:If M<1
:Goto 3
:Goto 4
:Lbl 3
:Disp "EMPTY FUEL TANK"
:Goto 5
:Lbl 4
:Disp M
:Lbl 5
[...]
:Goto B


Mmm, spaghetti.

From an 8-ball program:


:IPart(Rand*100)→R
:If R≥80
:Goto 1
:If R≥60
:Goto 2
[...]
:Lbl 1
:Disp "ASK AGAIN LATER"
:End
:Lbl 2
:Disp "YES, OF COURSE"
:End
[...]


Obviously could have gotten rid of all the End and eliminated Lbl/Goto altogether because each Disp is only one instruction. (The 81 didn't have If-Then so some Lbl/Goto were justified. But not here. :P)

Also, the notebook itself is sort of fail because I wrote one column of code per page, using only the left quarter of it and wasting the rest. And several programs had missing/wrong code, because of course I didn't bother double-checking that I copied them down correctly. Oops.

When I got the TI-82 and finally figured out the Goto memory leak, this was my first approach to working around it:


:For/While/Repeat/If-Then
[stuff]
:Goto A
:End
:Lbl B
[...]
:Lbl A
[more stuff]
:End
:Goto B


Hey, it worked. ;)
Title: Re: Your worst programming fails
Post by: tr1p1ea on February 19, 2015, 04:39:07 AM
Not finishing most of the projects that I started ... then losing all my info in a series of PC crashes.
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 19, 2015, 05:05:58 AM
tr1p1ea Well I really meant bad programming mistakes as in the code in this topic, but yeah I wish you had done backups of your stuff D: (especially since you lost stuff three times in 9 years). I have the issue of not finishing most of my projects as well since the last decade or so too, although in recent years when this happened I usually released what I had or even entire folders of projects.
Quote from: Travis on February 19, 2015, 04:17:23 AM
Some stuff from my first TI-81 programs written in a notebook:

To circumvent the lack of Then/Else/End limitation on the 81, I just used an extra sub-program :P
Title: Re: Your worst programming fails
Post by: Travis on February 19, 2015, 10:13:03 AM
Quote from: DJ Omnimaga on February 19, 2015, 05:05:58 AMTo circumvent the lack of Then/Else/End limitation on the 81, I just used an extra sub-program :P

Haha yeah, I tended to shy away from that because it didn't feel right cluttering up my programs list with programs that wouldn't be useful to run on their own. On the 82/85 I eventually started using subprograms but started their names with Greek letters so they would stay at the end of the list and out of the way.
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 19, 2015, 05:00:09 PM
I had no choice to use them because 2400 bytes of user RAM is just barely enough to store an RPG. O.O (unless maybe I decided to go with the Input command trick and made a point and click game?)
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 28, 2015, 04:32:10 AM
The return instruction at the end of this sub-program tops all of my programming fails >.<:

If R=108
randInt(1,2->theta
If R=1 or R=104
Goto 1
If R=2 or R=101
Then
If 1=randInt(1,2
Then
Return
Else
Goto 1
End
End
If R=3 or R=103 or R=105 or (R=108 and theta=1
Then
If 1=randInt(1,5
Then
Goto 2
Else
Goto 1
End
End
If R=4 or R=102
Then
If 1=randInt(1,3
Then
Goto 2
Else
Return
End
End
If R=5 or R=107 or (R=108 and theta=2
Then
If 1=randInt(1,5
Then
Goto 3
Else
Goto 1
End
End
Lbl 2
For(Z,0,40
Output(randInt(5,7),randInt(5,7),"W
End
ClrHome
9O->S
Goto D
Lbl 3
For(Z,0,50
Output(randInt(1,8),randInt(1,16),"theta
End
ClrHome
36O->S
Goto D
Lbl 1
ClrHome
prgmMFT
For(Z,6,9
Output(6,6,"/
For(Z,0,100
End
int((O/2)^^2->S
Goto D
Lbl D
If S>=9999
9999->S
B-S->B
For(Z,7,6,~1
Output(Z,5,S
For(theta,0,15
End
Output(Z,5,"   
prgmMFT
End
For(Z,5,7
Output(Z,5,S
For(theta,0,25
End
Output(Z,5,"   
prgmMFT
End
Return
Title: Re: Your worst programming fails
Post by: aetios on February 28, 2015, 07:35:18 PM
Needs more context really, I don't understand what the code does at all :P
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on February 28, 2015, 07:43:59 PM
Same :P, but more seriously this is the enemy attack code in Mana Force and First Fantasy: Mana Force.
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on March 24, 2015, 04:46:08 AM
Guess what this is:

{~1,0,1,0,~1,0,0,0,0,0,0,0,0,1->L5


Answer: This was used with Getkey for character movement. Element 1 and 3 were for getkey value 24 and 26 (left and right arrows) and -1 meant the character moved to the left while 1 meant it moved to the right. Element 5 and 14 were used for getkey values 25 and 34 (up and down arrow) Although some might consider this trick clever due to taking less space in the walking engine, I ended up wasting 90 bytes of RAM with 10 list elements that never were used and that I could have easily used for other things. It also makes the code hard to follow.
Title: Re: Your worst programming fails
Post by: Snektron on March 24, 2015, 03:23:41 PM
The least you can do is divide the key value by 2 :P
Title: Re: Your worst programming fails
Post by: alexgt on March 24, 2015, 11:55:14 PM
The worst fail that I remember happened today. I was bug squashing on Jarvis and I wonder why iit was not displaying text.... I was clearing that part of the screen in the next line of code <_< *sighs
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on March 25, 2015, 03:31:53 AM
Haha that happens >.<. More recently, my fails mostly involved using the + sing instead of - and vice-versa. I was wondering why Mana Force was only doing collision detection on one half of the screen then found out why XD.
Title: Re: Your worst programming fails
Post by: gtemples31415 on March 25, 2015, 08:23:54 PM
One of my codes was to make a program to tell you what codon corresponded to what amino acid... I used variables for each letter, so if you put in, like,  CUG, you would also get the results for CGU ad UGC and GUC and so on... Yeah, I really should've used strings...
Title: Re: Your worst programming fails
Post by: 123outerme on March 25, 2015, 08:46:11 PM
I know a number of times I've accidentally cleared a line then replaced it from memory, and it didn't work.
Also, one time, something in my code was being skipped (can't remember what), so I just put in 0/0 on the line after the one I wanted it to read, and it fixed. I don't remember why that fixed it. It didn't even throw an ERR: DIV BY 0.
Title: Re: Your worst programming fails
Post by: Snektron on March 25, 2015, 09:17:53 PM
That's the wonders of TI probably :P
Title: Re: Your worst programming fails
Post by: Duke "Tape" Eiyeron on March 26, 2015, 08:14:49 AM
Quote from: 123outerme on March 25, 2015, 08:46:11 PM
I know a number of times I've accidentally cleared a line then replaced it from memory, and it didn't work.
God praise On+^ from zStart for that.
Title: Re: Your worst programming fails
Post by: Dream of Omnimaga on March 26, 2015, 03:00:46 PM
Quote from: 123outerme on March 25, 2015, 08:46:11 PM
I know a number of times I've accidentally cleared a line then replaced it from memory, and it didn't work.
Also, one time, something in my code was being skipped (can't remember what), so I just put in 0/0 on the line after the one I wanted it to read, and it fixed. I don't remember why that fixed it. It didn't even throw an ERR: DIV BY 0.
For the first error do you mean the 2nd+Enter thing? I hated when I replaced an entire line of code (sometimes 2 KB long when I was using map data) with the latest homescreen entry. TI should add an option to disable 2nd+Enter in the program editor or a confirm box. Same for when you clear large lines of code.

As for your 2nd problem this sounds like an End instruction was missing somewhere or you forgot to use Then, Else and stuff. I had similar things happen to me for that reason. However, I remember that in OS 1.12, there was also a glitch with  Then that caused ERR:SYNTAX if you added : before that instruction.

So this code would work:
If A=2
Then
B+1->B:0->A
End

But the following would not:
If A=2
:Then
B+1->B:0->A
End

While you are not supposed to use two : symbols in succession, that error was inconsistent because it worked fine with everything else. This was also annoying when our programs were still not finished and in progress, because sometimes we move code around and when debugging we would rather not have strange errors like this come in the way. Another oddity that still remains is how omitting : after a Delvar still works, but I hope TI won't fix that one since it lets us save some bytes.