Package pdp.scrabble.game.impl

Source Code of pdp.scrabble.game.impl.AbstractEngine

package pdp.scrabble.game.impl;

import pdp.scrabble.game.GameEngine;
import pdp.scrabble.game.GameEnvironment;
import pdp.scrabble.ihm.GameStatisticsModel;
import pdp.scrabble.ihm.GameStatisticsModelImpl;

public abstract class AbstractEngine implements GameEngine {

    protected GameEnvironment gameEnv;
    protected int globalTurn;   
    protected Thread gameThread;
    protected boolean running;
    protected GameStatisticsModel stats;

    public AbstractEngine(GameEnvironment env) {
  gameEnv = env;
  globalTurn = 0;
  gameThread = new GameThread(this);
  stats = new GameStatisticsModelImpl();
    }

    @Override
    public void setEnvironment(GameEnvironment env) {
  this.gameEnv = env;
    }

    @Override
    public GameStatisticsModel getStatsModel() {
  return stats;
    }

    @Override
    public abstract void increaseTurn();

    @Override
    public abstract int getPlayerTurn();

    @Override
    public int getGlobalTurn() {
  return this.globalTurn;
    }

    @Override
    public void terminate() {
  this.running=false
    }

    @Override
    public void start() {
  this.running=true;
  gameThread.start();
    }

    @Override
    public void reset() {
  this.running=false;
  this.gameEnv.reset();
  this.stats.clear();
    }

    @Override
    public abstract void play() ;

}
TOP

Related Classes of pdp.scrabble.game.impl.AbstractEngine

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.