Creating a Basketball Simulation App With Swift: Part 2
Let’s keep building basketball.
Welcome back to the basketball app project. You can catch up on Part 1 here.
If you remember where we left off last time, we had successfully created Player, Team, and Game classes which were used to simulate a basketball games. Games consisted on a series of possessions by both teams, where they had a chance to score. We’re able to play some matches and receive a final box score:
But, there’s still a lot of work to do. Here are some questions that came to my mind afterwards:
- Can we personalize our teams with names? Can we name our players too?
- Could we build a box score, to see who’s scoring the points, and how many points is each player scoring?
- Going off these next two features, what else do we need to begin building out a league of some sort? Can we keep track of the results of each game, and present stats at the end of a “season”?
These are the primary goals to complete for this part. Before we dive in, I’ll address a really cool suggestion someone made to support three-point field goals in a simulated possession. This block of code comes courtesy of Aaron A: