You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

Your worst programming fails

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/PC, Mac & Vintage Computers publicado por u/Dream of Omnimaga 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,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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]]->[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).
Inicia sesión o crea una cuenta para dejar un comentario
u/Yuki February 17, 2015, 02:47:17 AM
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.
u/Dream of Omnimaga 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.
u/Unicorn 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.
Last Edit: February 17, 2015, 05:57:05 AM by Unicorn
u/James Oldiges 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.
u/Keoni29 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.
u/Hayleia 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...
u/Snektron 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)
Last Edit: February 17, 2015, 02:28:41 PM by Cumred_Snektron
u/Hayleia 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
u/Dream of Omnimaga 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.
Last Edit: February 17, 2015, 03:39:04 PM by DJ Omnimaga
u/Snektron 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?
u/DarkestEx February 17, 2015, 04:52:14 PM
Pressing "No" when being asked for Garbage Collect, compiling Axe code.
u/Duke "Tape" Eiyeron February 17, 2015, 05:06:06 PM
Programming anything, because it'll fail.
u/matrefeytontias February 17, 2015, 07:53:53 PM
This. It gave me nightmares when it came to releasing nKaruga.

u/Dream of Omnimaga 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.
Start a Discussion

b/PC, Mac & Vintage Computers

Computer programming discussion and project showcase

132
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal