Esempio n. 1
0
 public Board()
 {
     players = new Player[5];
     blocks = new Block[10, 10];
     for (int a = 0; a < 10; a++)
     {
         for (int b = 0; b < 10; b++)
         {
             blocks[a, b] = new Block(a, b);
         }
     }
 }
Esempio n. 2
0
 public AI(Block[,] blocks, int size, String player_id)
 {
     this.blocks = blocks;
     this.grid_size = size;
     this.player_id = player_id;
     grid = new Node[size, size];
     // initializing grid for the  a strat algorithm
     for (int i = 0; i < size; i++)
     {
         for (int j = 0; j < size; j++)
         {
             grid[i, j] = new Node();
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            #region text objects initializing
            // creating the title
            title_position = new Vector2(0, 0);
            title_text = "                                                                Black Panther ";
            title_color = Color.Black;

            // scoreboard title
            int title_left = 820;
            score_title_color = Color.Black;
            score_title_position = new Vector2(title_left, 100);
            score_title_text = "Score Board";

            // player details

            player_1_color = Color.Black;
            player_1_position = new Vector2(title_left, 240);
            player_1_text = "";

            player_2_color = Color.Black;
            player_2_position = new Vector2(title_left, 280);
            player_2_text = "";

            player_3_color = Color.Black;
            player_3_position = new Vector2(title_left, 320);
            player_3_text = "";

            player_4_color = Color.Black;
            player_4_position = new Vector2(title_left, 360);
            player_4_text = "";

            #endregion

            #region grid

            blocks = new Block[grid_size, grid_size];
            // creating the block
            for (int i = 0; i < grid_size; i++)
            {
                for (int j = 0; j < grid_size; j++)
                {
                    blocks[i, j] = new Block(new Vector2(i * block_pixel_size, j * block_pixel_size + 30));
                }
            }

            #endregion

            #region event handling
            ai = new AI(blocks, grid_size, player_id);
            ai.listenToMessages(this);

            _timer = new System.Timers.Timer(500);
            _timer.Elapsed += new ElapsedEventHandler(run_game);
            _timer.Enabled = true;

            #endregion
            base.Initialize();
        }