3 ms·
> Ball is a terrible name for the list of the positions of the players. From a code maintainability point of view, yes. I would never write code like this for
by randomdata 15y ago
> Ball is a terrible name for the list of the positions of the players.
From a code maintainability point of view, yes. I would never write code like this for a real application. However, for analogizing the game in code, I have to strongly disagree.
Ball is not a list of players. It is, just as in the game, a pointer to a location in space. Players may or may not occupy that space. If the player does, a hit occurs. The hit test is based on the intersection of the location in space and the occupation of that space.
I chose to represent my code in a C-like manner because it makes that spacial representation easy to write. People are not thinking about the game in terms of lists and objects, that I am sure.