Design patterns for games

  • Authors:
  • Dung ("Zung") Nguyen;Stephen B. Wong

  • Affiliations:
  • Rice University, Houston, TX;Rice University, Houston, TX

  • Venue:
  • SIGCSE '02 Proceedings of the 33rd SIGCSE technical symposium on Computer science education
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Designing a two-person game involves identifying the game model to compute the best moves, the user interface (the "view") to play the game, and the controller to coordinate the model and the view. A crucial task is to represent the algorithms used in their highest abstract forms. This can prove to be a difficult and subtle endeavor. It is made easier however by the use of good object-oriented (OO) design principles to help maintain a high level abstract viewpoint during the design process. The state pattern is used to represent the game board and is coupled with the visitor pattern to provide state-dependent, variant behaviors. The min-max algorithm and its variants are implemented as the strategy pattern, which allows flexible and extensible computational capability. Careful analysis is performed to properly abstract the interactions between the model and the view. The command design pattern is used to provide callback services between the model and the view. Leading students through this design process enables them to learn algorithms and architectures that easily scale to full-sized applications.