Пример #1
0
        private static Line MoveLineLeft(int line)
        {
            var levels = BitBoardHandler.ToLevels((Line)line);

            for (int i = 0; i < 3; ++i)
            {
                int j = i + 1;
                while (j < 4 && levels[j] == 0)
                {
                    ++j;
                }
                if (j >= 4)
                {
                    break;
                }
                if (levels[i] == 0)
                {
                    levels[i] = levels[j];
                    levels[j] = 0;
                    --i;
                }
                else if (levels[i] == levels[j])
                {
                    if (levels[i] != LevelMask)
                    {
                        ++levels[i];
                    }
                    levels[j] = 0;
                }
            }
            return(BitBoardHandler.ToLine(levels));
        }
Пример #2
0
        private static void CacheLineScores(int line)
        {
            var levels = BitBoardHandler.ToLevels((Line)line);
            int score  = 0;

            for (int i = 0; i < 4; ++i)
            {
                int level = levels[i];
                if (level >= 2)
                {
                    score += (level - 1) * (1 << level);
                }
            }
            lineScores[line] = score;
        }