Lists 1 and 2 show methods for constructing game scenes for the CUI and for the GUI, respectively. Lists 2 use the Waiting abstract class instead of the Player abstract class. The Player abstract class, which asks users for the player information, is unnecessary for AI programs because AI programs provide the player information through getter methods. Moreover, the Waiting abstract class allows users to control the timing for starting the game. In this way, we improved the state design pattern by utilizing the mixin feature in Scala.
List 1. Scala code constructing console game with user manipulation