Ejemplo n.º 1
0
 private void InitGame()
 {
     hanoiVisual?.ClearExcess();
     hanoiPlayer?.Stop();
     hanoiSolver             = null;
     hanoiGame               = new HanoiGame(blockCount);
     hanoiVisual             = new HanoiVisual(hanoiGame, tower1, tower2, tower3, gamePanel);
     hanoiPlayer             = new HanoiPlayer(hanoiGame, tower1, tower2, tower3, hanoiVisual);
     moveScroller            = new MoveScroller(hanoiGame, hanoiVisual, scrollForward, scrollBack, scrollIndicator);
     hanoiGame.GameFinished += FinishGame;
     //hanoiVisual.Visualize(new HanoiGame.MoveInfo(hanoiGame.towers));
 }
Ejemplo n.º 2
0
 public HanoiPlayer(HanoiGame game, Panel towerA, Panel towerB, Panel towerC, HanoiVisual visual)
 {
     this.game   = game;
     this.visual = visual;
     Panel[] panels = new Panel[3] {
         towerA, towerB, towerC
     };
     for (int i = 0; i < 3; i++)
     {
         towerPanels[i] = new TowerPanel(panels[i], TowerClicked, i);
     }
 }
Ejemplo n.º 3
0
 public MoveScroller(HanoiGame game, HanoiVisual visual, Button forwardButton, Button backwardButton, Label indicator)
 {
     this.game             = game;
     this.forwardButton    = forwardButton;
     this.backwardButton   = backwardButton;
     this.visual           = visual;
     this.indicator        = indicator;
     indicator.Text        = "0/0";
     forwardButton.Click  += (sender, e) => ChangeScroll(1);
     backwardButton.Click += (sender, e) => ChangeScroll(-1);
     game.BlockMoved      += (moveInfo) => ScrollIndex = game.moves.Count - 1;
 }
Ejemplo n.º 4
0
 public HanoiVisual(HanoiGame hanoiGame, Panel panelA, Panel panelB, Panel panelC, Panel gameArea)
 {
     game          = hanoiGame;
     panels        = new Panel[3];
     this.gameArea = gameArea;
     panels[0]     = panelA;
     panels[1]     = panelB;
     panels[2]     = panelC;
     CalculateSize();
     CreateTowers();
     CreateBlocks();
     SetupBlocks();
     currentMove = game.originTowers;
     //game.BlockMoved += Visualize;
 }