private void AddStep(int x, int y, bool isPawnAtack = false) //isPawnAtack = true in case of a pawn move-attack { if (x < ChessConfig.size && x >= 0 && y < ChessConfig.size && y >= 0) { string newType = ChessConfig.GetFieldType(x, y); //Calculation the difference between the power of the piece before step and after int score = ChessConfig.GetPiecePower(newType) - ChessConfig.GetPiecePower(type); posibleSteps.Add(new StepData(x * 8 + y, this.x * 8 + this.y, score, isPawnAtack)); } }
private void FillLocation() { validPos[0, 0] = startPos; fields[0, 0] = new Field(0, 0, ChessConfig.GetFieldType(0, 0)); for (int i = 0; i < size; i++) { for (int j = 1; j < size; j++) { validPos[i, j] = validPos[i, j - 1] + offsetY; fields[i, j] = new Field(i, j, ChessConfig.GetFieldType(i, j)); desk[i, j] = ' '; } if (i < 7) { validPos[i + 1, 0] = validPos[i, 0] + offsetX; fields[i + 1, 0] = new Field(i + 1, 0, ChessConfig.GetFieldType(i + 1, 0)); } } }