Settings

Theme

Balatro Source Code Smell

twitter.com

3 points by felhr 2 years ago · 1 comment

Reader

idle_zealot 2 years ago

Implementing the logic for this sort of card game is quite tricky. Your natural inclination as a software dev will be to make some sort of effect enum, tag cards with their effects, and then have a generic "do this card" function that will look up handlers for each effect and execute them (or the object-oriented equivalent). This runs into issues with edge cases where actually you need particular effects to be aware of one another and change behavior accordingly, breaking you cleanly separated architecture. You start piling on and shoving in special handling logic with no clear home. The nature of these games invites spaghetti.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection