public bool IsMoveValid(int dx, int dy, int dr) { Block temp = new Block(m_theGame); temp.Clone(m_theGame.CurrentBlock); temp.X += dx; temp.Y += dy; temp.Rotation = (temp.Rotation + 4 + dr) % 4; // get coordinates float[] x = new float[4]; float[] y = new float[4]; temp.ToVirtualCoordinates(ref x, ref y); // validate... for (int i = 0; i < 4; i++) { // out of horizontal border if (x[i] < 0 || x[i] >= Game.Width) { return false; } // out of vertical border if (y[i] < 0) { return false; } if (y[i] >= Game.Height) { return true; } // on another block if (m_theGame.Block[(int)x[i], (int)y[i]] != 0) { return false; } } // indicate success return true; }