Join us on Discord!
You can help CodeWalrus stay online by donating here.

Your worst programming fails

Started by Dream of Omnimaga, February 17, 2015, 02:15:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yuki

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.
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
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

Snektron

Quote from: Juju on February 18, 2015, 01:07:44 AM
You rename it, woops it now magically works again.
Html is that you?
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Adriweb

Little things like writing '<' instead of '>' (or vice-versa), such that it breaks the whole project... (well, makes it do the opposite :P)

Here or here, 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.
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

#18
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...
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Travis

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. ;)
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

tr1p1ea

Not finishing most of the projects that I started ... then losing all my info in a series of PC crashes.

Dream of Omnimaga

#21
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
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Travis

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.
  • Calculators owned: TI-81, TI-82, TI-85, TI-86, TI-89, TI-89 Titanium, 2 × HP 50g

Dream of Omnimaga

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?)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dream of Omnimaga

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
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

aetios

Needs more context really, I don't understand what the code does at all :P
ceci n'est pas une signature

Dream of Omnimaga

Same :P, but more seriously this is the enemy attack code in Mana Force and First Fantasy: Mana Force.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dream of Omnimaga

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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

The least you can do is divide the key value by 2 :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


alexgt

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
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Powered by EzPortal