An introduction to the case study scenario together with the first approach to a basic solution for a simple passable/impassable terrain context.
A Java program with a class modeling a tiled map is presented, requiring you to review this in terms of values, variables, types, fields and program execution.
Applies good programming practice to the case study by comparing the program presented in the previous chapter with a more acceptable implementation. Introduces the use of enumerations to represent terrain tile values in the case study.
Investigates design issues through defining the current model as an interface and encapsulating as a class. The case study requirements are re-visited and model behaviour extended to incorporate border and subarea setting; the latter also acting as a vehicle for further consideration of coding design issues, including random generation.
A strategy pattern is introduced in the map model to enable flexible map rendering behaviour on different devices with different terrain type representations. Console and audio devices are used to exemplify this approach.
In this chapter the strategy pattern adopted for rendering a map is used to include the use of a JPanelRenderer rendering engine class to draw an image of a map using coloured squares on a JPanel.