CMU 15-110: Principles of Computing
2d Board Games
In class today, we will review board-game-starter-code.py and then board-game-basic-example.py.
- This is an example of the MVC (Model-View-Controller) design pattern
- Model: the values in
dataand the code to manipulate that data
- View: the code to present or view the model to the user (in our code, in
- Controller: the code to respond to events by updating the model (in our code, in
- These classes:
- This function:
- These functions:
getCellBounds(and why it is aka
getCell(and why it is aka
- The Model:
data.boardGame-- why it is a
BoardGameinstance and how it is used.
data.boardGame.board-- why it is a 2d List and how it is used to store the cells, and the counts inside each cell.
data.selection-- why it is a
Cellinstance and how it is used.
- The View:
- The Controller: