Exemplo n.º 1
1
 static void Main(string[] args)
 {
     Parser p = new Parser();
     if(args.Length > 0)
     {
         Parser.ReadFile(args[0]);
     }
     else
     {
         askingForFile();
     }
     Game chess = new Game();
     chess.PlacePieces(p.GetValidPlacements(),p.GetEnglishEquivalent());
     chess.PlayGame();
     //            chess.PlayGame(p.GetValidMoves(),p.GetEnglishEquivalent(), p.GetValidPlacements().Count);
     //            chess.SquaresWithPieces();
 }
Exemplo n.º 2
0
 // constructor that show the graphic interface to users
 public Graphics(Game g)
     : base(Gtk.WindowType.Toplevel)
 {
     Build ();
       int scale = 10;
       if (Screen.Height < 1000)
     scale = 5;
       this.game = g;
       VBox gridWrapper = new VBox ();
       HBox box = new HBox ();
       this.status = new Label ("");
       this.chooser = new Popup (this, this.game.getChooseableFigures(), handleChooser, scale);
       this.mainGrid = new GridWidget (this.game, clickHandler, scale);
       gridWrapper.PackStart (status, false, false, 0);
       gridWrapper.PackStart (this.mainGrid, false, false, 0);
       this.sidebarLeft = new SidebarWidget (g.getRemovedFigures (), "black", scale);
       box.PackStart (new HBox ());
       box.PackStart (this.sidebarLeft);
       box.PackStart (gridWrapper, false, false, 0);
       this.sidebarRight = new SidebarWidget (g.getRemovedFigures (), "white", scale);
       box.PackEnd (this.sidebarRight);
       box.PackStart (new HBox ());
       box.ShowAll ();
       this.Add (box);
       updateGui (this.game.initialState ());
       this.Show ();
 }
Exemplo n.º 3
0
        private coord tileSize; // Size of a tile

        #endregion Fields

        #region Constructors

        // Constructor
        public GridWidget(Game game, Cb callback, int scale)
            : base((uint)game.getSize ().x, (uint)game.getSize ().y, true)
        {
            this.callback = callback;
              this.clicked = false;
              this.game = game;
              this.tileSize = new coord (10 * scale, 10 * scale);
        }
Exemplo n.º 4
0
 public static void Main(string[] args)
 {
     Application.Init ();
       //Create game
       Game g = new Game ();
        //Create the graphic interface for the game
       new Graphics (g);
       Application.Run ();
 }
Exemplo n.º 5
0
        public StartingANewGame()
        {
            var output = new TestOutput();
            _app = new ChessApp(output);

            _app.Handle(new CreateGameAppCommand());
            _latestGameName = output.LatestGameName;
            _newGame = _app.GetGame(_latestGameName);
        }
Exemplo n.º 6
0
 public void OnPlayerJoiningGame(IPlayer player, Game game)
 {
 }
Exemplo n.º 7
0
 public void OnNewGameStarted(Game newGame)
 {
     LatestGameName = newGame.Id;
 }
Exemplo n.º 8
0
 public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game)
 {
     NumberOfColourTakenCannotJoinGameErrors++;
 }
Exemplo n.º 9
0
 public void OnPlayerJoiningGame(IPlayer player, Game game)
 {
     Console.WriteLine("Player {0} joined {1}.", player.Name, game.Id);
 }
Exemplo n.º 10
0
 public void OnNewGameStarted(Game newGame)
 {
     Games.Add(newGame);
     Console.WriteLine("New game: {0}", newGame.Id);
 }
Exemplo n.º 11
0
 public void OnColourTakenCannotJoinGameError(PlayerColour playerColour, Game game)
 {
     throw new NotImplementedException();
 }