/// <summary>   Displays the game Board </summary>
        ///
        /// <remarks>   , 13/11/2017. </remarks>
        ///
        /// <param name="header">       The header. </param>
        /// <param name="connection">   The connection. </param>
        /// <param name="board">        The board. </param>

        public void GetBoard(PacketHeader header, Connection connection, Model.Board board)
        {
            //Console.WriteLine("TRUMP Value IN GET BOARD TYPE:" + board.Trump.Type + " VALUE :" + board.Trump.Val + "\n");
            Client.Board = board;
            Services.DisplayBoard(board);
            Services.DisplayHand(Client.Player);
        }
Exemple #2
0
		public MainViewModel()
        {
			////if (IsInDesignMode)
			////{
			////    // Code runs in Blend --> create design time data.
			////}
			////else
			////{
			////    // Code runs "for real"
			////}
			Instructions = Enum.GetNames(typeof(Instruction));
			Board = new Board();
			Droid1 = new Droid();
			Droid1.color = DroidColor.Yellow;
			Droid1.position = new Position(1, 1);
			Droid1.direction = Direction.Right;
			Droid1.Instructions.Add(Instruction.Move1);
			Droid1.Instructions.Add(Instruction.Move1);
			//Board.boardElements.Add(Droid1);
			Board.Droids.Add(Droid1);

			ExecutePhaseCommand = new RelayCommand(() => ExecutePhaseButtonAction());

			Droid1AddInstructionCommand = new RelayCommand(
				() => {
					//MessageBox.Show(String.Format("You you want add this instruction: {0}", Droid1SelectedInstruction));
					Droid1.Instructions.Add(Droid1SelectedInstruction);
				},
				() => Droid1.Instructions.Count < 5)
				;
		}
Exemple #3
0
 public Game(int xSize, int ySize)
 {
     _board = new Board(xSize, ySize);
     _board.BoardFilled += (s, e) =>
     {
         if (Winner != null)
         {
             Winner(s, new WinEventArgs
             {
                 TimeCompleted = DateTime.Now,
                 TimeStarted = _timeOfFirstMove,
                 Turns = Turns,
                 FilledEvent = e
             });
         }
     };
 }
 public override SuggestedMoves ChooseColor(Color[,] board)
 {
     Color currentColor = board[0, 0];
     Color bestColor = Color.Red;
     int greatestSurfaceArea = 0;
     //test every color
     foreach (Color color in Enum.GetValues(typeof(Color)).Cast<Color>())
     {
         if (color != currentColor) //the current color won't change anything
         {
             //model picking that color
             Board boardLogic = new Board(board);
             boardLogic.Pick(color);
             int surfaceArea = EdgeCoverage(boardLogic.GetCopyOfBoard());
             if (surfaceArea > greatestSurfaceArea)
             {
                 greatestSurfaceArea = surfaceArea;
                 bestColor = color;
             }
         }
     }
     return new SuggestedMoves ( bestColor );
 }