public override void Initialize() { // Initialize grid of blocks blocks = new Block[NUM_ROWS][]; for (int i = 0; i < NUM_ROWS; i++) { blocks[i] = new Block[NUM_COLS]; } // Set the cursor position cursor = new Cursor(0, 0); // Fill the spaces with blocks FillBoard(); base.Initialize (); }
/// <summary> /// Helper method that checks to see if there are three blocks in a /// row that are in a NORMAL state that match. /// </summary> /// <returns> /// True if all three blocks match, false if any pair do not. /// </returns> public static bool ThreeBlocksMatch(Block block1, Block block2, Block block3) { return (block1 != null && block2 != null && block3 != null && block1.State == BlockState.NORMAL && block2.State == BlockState.NORMAL && block3.State == BlockState.NORMAL && block1.Type == block2.Type && block2.Type == block3.Type); }