Ejemplo n.º 1
0
        // check horizonal weight
        private void checkV(Step step, int thisTurn)
        {
            if (step.turn != 0)
                return;
            int[] tem_weight = new int[5];
            for (int i = 0; i < 5; i++)
            {
                tem_weight[i] = 0;
            }
            for (int t = 0; t < 5; t++)
            {
                for (int i = 0 - t; i <= 4 - t; i++)
                {
                    if ((step.y + i) > 27 || (step.y + i) < 0)
                    {
                        tem_weight[t] = 0;
                        break;
                    }
                    if (MAP[step.x][step.y + i].turn == oppositeTurn(thisTurn))
                    {
                        tem_weight[t] = 0;
                        break;
                    }
                    else if (MAP[step.x][step.y + i].turn == thisTurn)
                        tem_weight[t]++;
                }
            }
            foreach (int w in tem_weight)
            {
                if (step.weights[thisTurn - 1][1] < w)
                {
                    step.weights[thisTurn - 1][1] = w;
                }
            }

            step.calcWeight(thisTurn);
        }