Alternatively, join us on Discord.

Your worst programming fails

Started by DJ Omnimaga, February 17, 2015, 02:15:23 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DJ Omnimaga

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,0,0,0][1,1,1,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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).

Juju

Just yesterday, 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 I call myself idiot in a git commit.
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

DJ Omnimaga

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.

Unicorn

February 17, 2015, 05:53:00 am #3 Last Edit: February 17, 2015, 05:57:05 am by Unicorn
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.



??? ??? ??? ??? ???

James Oldiges

I think we can all say out worst fail was not backing up before running faulty code + ram clear.

Keoni29

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.
If you like my work, why not give me an internet?

Hayleia

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...

Snektron

February 17, 2015, 02:20:42 pm #7 Last Edit: February 17, 2015, 02:28:41 pm by Cumred_Snektron
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)
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Hayleia

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

DJ Omnimaga

February 17, 2015, 03:33:49 pm #9 Last Edit: February 17, 2015, 03:39:04 pm by DJ Omnimaga
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.

Snektron

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?
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


DarkestEx

Pressing "No" when being asked for Garbage Collect, compiling Axe code.

Duke "Tape" Eiyeron

Programming anything, because it'll fail.

matrefeytontias

This. It gave me nightmares when it came to releasing nKaruga.

My TI games (some got their own article on non-calc websites !) : http://www.ticalc.org/archives/files/authors/112/11202.html

My moozik (100% free metal) : http://www.soundcloud.com/matrefeytontias

DJ Omnimaga

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.

Powered by EzPortal