public TurnManager(Direction direction, Board board, IUpdater updater, TileAdder adder, GameOverChecker gameOverChecker, Tracker tracker, DecisionTreeModel model)
 {
     this.GameBoard       = board;
     this.Swiper          = direction;
     this.Updater         = updater;
     this.Adder           = adder;
     this.GameOverChecker = gameOverChecker;
     this.Tracker         = tracker;
     this.Model           = model;
 }
 public void Update(Board board, Direction direction, TileAdder adder)
 {
     SetConfiguration(board, direction, adder);
     this.BoardChanged = false;
     foreach (Tuple <int, int> tile in GetNextElementToUpdate())
     {
         TryToMoveTile(tile);
     }
     this.TileAdder.AddTile();
 }
 static void Train(DecisionTreeModel model = null)
 {
     for (int i = 0; i <= 100; i++)
     {
         Board           board     = new Board();
         Direction       direction = new Direction();
         TileAdder       adder     = new TileAdder(board);
         IUpdater        updater   = new Updater(board, direction, adder);
         GameOverChecker checker   = new GameOverChecker(board, direction, updater);
         Tracker         tracker   = new Tracker(15);
         TurnManager     manager   = new TurnManager(direction, board, updater, adder, checker, tracker, model);
         manager.Play();
         Uploader uploader = new Uploader();
         uploader.Upload(manager.GetTracker().GetTrainData());
     }
 }
        protected void SetConfiguration(Board board, Direction direction, TileAdder adder)
        {
            this.Board        = board;
            this.TileAdder    = adder;
            this.BoardChanged = false;
            Tuple <int, int> swipe = direction.GetSwipe();

            if (swipe.Equals(direction.GetUp()))
            {
                this.StartRow       = 0;
                this.StartColumn    = 0;
                this.UpIncrement    = swipe.Item1;
                this.RightIncrement = 1;
                this.MovementPlane  = Plane.Vertical;
            }
            else if (swipe.Equals(direction.GetRight()))
            {
                this.StartRow       = 0;
                this.StartColumn    = 3;
                this.UpIncrement    = 1;
                this.RightIncrement = swipe.Item2;
                this.MovementPlane  = Plane.Horizontal;
            }
            else if (swipe.Equals(direction.GetDown()))
            {
                this.StartRow       = 3;
                this.StartColumn    = 0;
                this.UpIncrement    = swipe.Item1;
                this.RightIncrement = 1;
                this.MovementPlane  = Plane.Vertical;
            }
            else if (swipe.Equals(direction.GetLeft()))
            {
                this.StartRow       = 0;
                this.StartColumn    = 0;
                this.UpIncrement    = 1;
                this.RightIncrement = swipe.Item2;
                this.MovementPlane  = Plane.Horizontal;
            }
        }
 public Updater(Board board, Direction direction, TileAdder adder)
 {
     SetConfiguration(board, direction, adder);
 }