Exemplo n.º 1
0
 private void BoardsListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (BoardsListView.SelectedItem != null)
     {
         Board board = (Board)BoardsListView.SelectedItem;
         BoardViewer.Draw(board);
         UpdateDetailsTextBlock(board);
     }
 }
Exemplo n.º 2
0
    /*
     * Constructor
     * param boardViewer Reference to its viewer
     */
    public BoardPresenter(BoardViewer boardViewer)
    {
        model  = new BoardModel();
        viewer = boardViewer;
        turn   = BoardModel.SquareType.CROSS;

        // Starts robot as opposite player
        robot = new RobotPlayer(BoardModel.swapType(GameSettings.Instance.humanSide));
    }
Exemplo n.º 3
0
        public Game()
        {
            chessBoard = new ChessBoard();
            viewer = new BoardViewer();
            while (true)
            {
                viewer.Show(chessBoard.Board);
                makeMove(viewer.getMoveInput());

            }
        }
Exemplo n.º 4
0
        private void NextButton_Click(object sender, RoutedEventArgs e)
        {
            if (BoardsListView.SelectedItem != null)
            {
                Board board = (Board)BoardsListView.SelectedItem;
                allFutureBoards = new List <Board>()
                {
                    board
                };
                allFutureBoards.AddRange(board.GetFutures(allianceScenario, futuresAlgorithm));

                BoardViewer.Draw(board);
                UpdateDetailsTextBlock(board);
                BoardsListView.ItemsSource = allFutureBoards;
            }
        }
Exemplo n.º 5
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SetupBoard();
            SetupAllianceScenario();
            //initialBoard = Board.GetInitialBoard();
            allFutureBoards = new List <Board>()
            {
                initialBoard
            };
            allFutureBoards.AddRange(initialBoard.GetFutures(allianceScenario, futuresAlgorithm));

            BoardViewer.Draw(initialBoard);
            UpdateDetailsTextBlock(initialBoard);
            AllianceScenarioGraphControl.Draw(allianceScenario, Powers.None);
            BoardsListView.ItemsSource = allFutureBoards;
        }
Exemplo n.º 6
0
        public App()
        {
            Startup += (sndr, evt) =>
            {
                var board = new BoardViewer();
                var cell = Cell.CreateDeadCell(() => board.DarkenButton(), () => board.LightenButton());
                board.OnCellToggle(cell.ToggleLife);
                board.Show();

                cell.NeighborRevived();
                cell.NeighborRevived();
                cell.NeighborRevived();

                cell.MomentPassed();

                cell.NeighborRevived();
                cell.NeighborRevived();

                cell.MomentPassed();
            };
        }
Exemplo n.º 7
0
        public MainWindow()
        {
            InitializeComponent();

            Board board = Board.GetInitialBoard();
            //1901 Spring
            BoardMove moves = new BoardMove();

            moves.Add(board.GetMove("bud", "ser"));
            moves.Add(board.GetMove("edi", "nth"));
            moves.Add(board.GetMove("lvp", "wal"));
            moves.Add(board.GetMove("mar", "spa"));
            moves.Add(board.GetMove("par", "bur"));
            moves.Add(board.GetMove("ber", "kie"));
            moves.Add(board.GetMove("kie", "den"));
            moves.Add(board.GetMove("mun", "ruh"));
            moves.Add(board.GetMove("nap", "ion"));
            moves.Add(board.GetMove("rom", "apu"));
            //A Ven H ? SUCCEEDS
            moves.Add(board.GetMove("mos", "stp"));
            moves.Add(board.GetMove("sev", "rum"));
            moves.Add(board.GetMove("stp_sc", "fin"));
            moves.Add(board.GetMove("war", "lvn"));
            moves.Add(board.GetMove("ank", "con"));
            moves.Add(board.GetMove("con", "bul"));
            //A Smy H ? SUCCEEDS
            moves.FillHolds(board);
            board.ApplyMoves(moves, true);
            board.EndTurn();

            //1901 Fall
            moves = new BoardMove();
            moves.Add(board.GetMove("bul", "gre"));
            moves.Add(board.GetMove("tri", "adr"));
            moves.Add(board.GetMove("vie", "tri"));
            moves.Add(board.GetMove("lon", "nth"));
            moves.Add(board.GetMove("nth", "nwg"));
            moves.Add(board.GetMove("wal", "yor"));
            moves.Add(board.GetMove("bre", "mao"));
            moves.Add(board.GetMove("bur", "bel"));
            //A Spa H ? SUCCEEDS
            moves.Add(board.GetMove("den", "swe"));
            moves.Add(board.GetMove("kie", "mun"));
            moves.Add(board.GetMove("ruh", "hol"));
            moves.Add(board.GetConvoyMove("apu", "tun", "ion"));
            //A Ven H ? SUCCEEDS
            moves.Add(board.GetMove("fin", "bot"));
            //A Lvn H ? SUCCEEDS
            //F Rum H ? SUCCEEDS
            moves.Add(board.GetMove("stp", "nwy"));
            moves.Add(board.GetMove("con", "bul_sc"));
            moves.Add(board.GetMove("smy", "ank"));
            moves.FillHolds(board);
            board.ApplyMoves(moves, true);
            board.EndTurn();

            // 1901 Winter
            moves = new BoardMove();
            moves.Add(board.GetBuildMove("vie", UnitType.Army));
            moves.Add(board.GetBuildMove("bre", UnitType.Fleet));
            moves.Add(board.GetBuildMove("mar", UnitType.Fleet));
            moves.Add(board.GetBuildMove("ber", UnitType.Fleet));
            moves.Add(board.GetBuildMove("kie", UnitType.Fleet));
            moves.Add(board.GetBuildMove("nap", UnitType.Fleet));
            moves.Add(board.GetBuildMove("mos", UnitType.Army));
            moves.Add(board.GetBuildMove("stp_nc", UnitType.Fleet));
            moves.Add(board.GetBuildMove("smy", UnitType.Fleet));
            moves.Add(board.GetBuildMove("con", UnitType.Fleet));
            moves.FillHolds(board);
            board.ApplyMoves(moves, true);
            board.EndTurn();

            //moves.Clear();
            //moves.Add(board.GetMove("bot", "swe"));
            //moves.Add(board.GetMove("kie", "hol"));
            //moves.Add(board.GetMove("ruh", "bel"));
            //moves.FillHolds(board);
            //board.ApplyMoves(moves);
            //board.EndTurn();

            FeatureToolCollection toolCollection = new FeatureToolCollection();

            toolCollection.Add(new RelativeTerritoryStrengths());
            FeatureMeasurementCollection measurements = toolCollection.GetMeasurements(board);

            BoardViewer.Draw(board, measurements);
        }
Exemplo n.º 8
0
 private void SaveGraphButton_Click(object sender, RoutedEventArgs e)
 {
     BoardViewer.SaveGraph();
 }