tshirtman/ultimate-smash-friends — Issue #12: Remove Hard-Coded calculations
Author: aspidites
Created: 2011-12-26 19:43:08+00:00
State: open

A lot of code is written with concrete "magic" numbers, which not only makes it difficult to update code, but makes it difficult to interpret existing code as well. These should be replaced with constants, and functions/methods that abstract the calculations so that algorithms may be changed when needed, without breaking the game.

A few examples (references using my fork):
* lines 94-97 in usf/game.py
* players_barycenter method of Game object in usf/game.py
* center_zoom_camera method of Game object in usf/game.py

This happens in plenty of other files as well, but as I was looking at the new camera implementation, it was easiest to point out the examples in game.py