예제 #1
0
파일: QueenAlgo.cs 프로젝트: dadaday/Queens
    public QueenAlgo(int numberOfQueens, QueenScript qs)
    {
        qScript = qs;
        nQueens = numberOfQueens;

        queensPositions = new int[numberOfQueens];
        currentQpos     = new int[numberOfQueens];
        isBlue          = new bool[numberOfQueens];

        rows  = new int[numberOfQueens];
        diag1 = new int[2 * numberOfQueens - 1];
        diag2 = new int[2 * numberOfQueens - 1];

        for (int i = 0; i < numberOfQueens; ++i)
        {
            currentQpos[i]     = -1;
            queensPositions[i] = -1;
            rows[i]            = 0;
            isBlue [i]         = true;
        }

        for (int i = 0; i < 2 * numberOfQueens - 1; ++i)
        {
            diag1[i] = 0;
            diag2[i] = 0;
        }

        stk = new Stack <int>();
        stk.Push(-1);
    }
예제 #2
0
 private void Start()
 {
     queen       = FindObjectOfType <QueenScript>();
     startHealth = queen.startHealth;
     health      = startHealth;
 }