rf/_input/posts/best-bug.md
2019-06-12 13:59:42 +12:00

2.2 KiB

title published
Best Bug 2019-05-21

my pal and i accidentally introduced a bug in our code that sorta took up a personality of its own, heres the story.

the setting

at university comp sci, me and my buddy entered a programming contest that was run by a health company. it was free, and we thought we might be able to get some of the prizes.

the goal was to create an engine to play last card, and all the entries would be run against each other and ranked.

this was in about two hours in one of the uni labs.

pretty boring stuff

it had that yellow glow of the lights as well, because it was getting dark outside.

the fun

we started implementing a pretty basic card counting thing, and to pass the time a bit were talking about our 'ai'

its super good at card games, even the basic ones

its like outta yugioh, its kaiba or something

yeah jojos poses every turn, better than the rest

etc etc

so we finished up after...

having to deal with whatever maven is

i still dont understand the hundred different package management things, why do they have to keep changing? /rant over

uh oh

we ended up placing second, losing to the guy that already worked for the company running the event.

we lost points because we didnt understand the state format correctly, but i believe we understand it right.

what theyd done is super gross logically wrong had any collection of cards as the java version of Maybe Cards such that rather than an empty list being [], the whole thing was a Nothing.

a collection of cards that has zero cards in it is still a set, and therefore should be represented by [] or equivilent. /rant over

the affect of this on ol` kaiba boi (aka kAIba which added to the charm) was that if it was the first player of a game, it would crash, timeout and the game manager would default to a pass.

neato bug

this cemented the persona of this bug to be a kaiba-esque dramatic dickhead, threatening to fall off buildings if he loses, but saying:

huh! first player advantage? thats for noobs, you take it

and yeeting the other player first turn.

fin

memorable bugs are the best kind of bugs, and have a life all of their own. part of the magic of programmation is finding these so you gotta pay attention.

:wq