2015-05-02 22:49:43 +03:00
|
|
|
package com.iluwatar;
|
|
|
|
|
|
|
|
public class App {
|
|
|
|
|
|
|
|
public static void main( String[] args ) {
|
2015-05-02 23:37:26 +03:00
|
|
|
// create model, view and controller
|
|
|
|
GiantModel giant = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED);
|
|
|
|
GiantView view = new GiantView();
|
|
|
|
GiantController controller = new GiantController(giant, view);
|
|
|
|
// initial display
|
|
|
|
controller.updateView();
|
|
|
|
// controller receives some interactions that affect the giant
|
|
|
|
controller.setHealth(Health.WOUNDED);
|
|
|
|
controller.setNourishment(Nourishment.HUNGRY);
|
|
|
|
controller.setFatigue(Fatigue.TIRED);
|
|
|
|
// redisplay
|
|
|
|
controller.updateView();
|
2015-05-02 22:49:43 +03:00
|
|
|
}
|
|
|
|
}
|