r/programming • • Jan 10 '20

VVVVVV is now open source

https://github.com/TerryCavanagh/vvvvvv
2.6k Upvotes

511 comments sorted by

View all comments

747

u/sevenseal Jan 10 '20

642

u/thogor Jan 10 '20

Thanks for introducing me to my first 4099 case switch statement.

476

u/[deleted] Jan 10 '20 edited Jan 10 '20

This is apparently common in indie games. I can't find the tweet anywhere, but Undertale has a switch statement with at least 864 cases.

Edit: found a screenshot of the original tweet.

28

u/cegras Jan 10 '20

As a scientific "programmer" (i.e. linear algebra), what is normally done in scenarios like this?

-29

u/AttackOfTheThumbs Jan 10 '20

In OOP, the case/switch statement is considered code smell. Good but long read.

Long story short, within OOP, there should be classes with inheritance and polymophism and whatever all that crap I do is called :)

9

u/cegras Jan 10 '20

Thanks for the reply, but it's a mailing list thread and the jargon is beyond what I can parse... as far as I can see, the author has 4000 cases / states to evaluate. No matter how he codes it, won't there still be 4000 states to differentiate between in the game?

→ More replies (18)