Esempio n. 1
0
 public VisualTower(Panel panel, HanoiVisual visual, int blockCount)
 {
     this.panel      = panel;
     this.visual     = visual;
     this.blockCount = blockCount;
     CalculateYPositions();
 }
Esempio 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);
     }
 }
Esempio n. 3
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));
 }
Esempio n. 4
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;
 }