|
|
@ -410,6 +410,11 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
|
|
|
|
|
|
|
|
int score = cellsPlayed.Count;
|
|
|
|
int score = cellsPlayed.Count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cellsPlayed.Count == 6)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
score += 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int cellsX = cellsPlayed[0].GetX;
|
|
|
|
int cellsX = cellsPlayed[0].GetX;
|
|
|
|
int cellsY = cellsPlayed[0].GetY;
|
|
|
|
int cellsY = cellsPlayed[0].GetY;
|
|
|
|
|
|
|
|
|
|
|
@ -462,17 +467,17 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
int dx = adjacentCell.GetX - cell.GetX;
|
|
|
|
int dx = adjacentCell.GetX - cell.GetX;
|
|
|
|
int dy = adjacentCell.GetY - cell.GetY;
|
|
|
|
int dy = adjacentCell.GetY - cell.GetY;
|
|
|
|
|
|
|
|
|
|
|
|
score += CalculateLineScore(cell, dx, dy, b, cellsX, cellsY);
|
|
|
|
score += CalculateLineScore(cell, dx, dy, b, cellsX, cellsY, cellsPlayed.Count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return score;
|
|
|
|
return score;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int CalculateLineScore(Cell cell, int dx, int dy, Board b, int cellsX, int cellsY)
|
|
|
|
public int CalculateLineScore(Cell cell, int dx, int dy, Board b, int cellsX, int cellsY, int nbCellsPlayed)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int score = 0;
|
|
|
|
int score = 0;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < 7; i++)
|
|
|
|
for (int i = 1; i < 6; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var extendedCell = b.GetCell(cell.GetX + i * dx, cell.GetY + i * dy);
|
|
|
|
var extendedCell = b.GetCell(cell.GetX + i * dx, cell.GetY + i * dy);
|
|
|
|
|
|
|
|
|
|
|
@ -481,6 +486,11 @@ namespace QwirkleClassLibrary.Games
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dx != 0 && cellsY != -1 && nbCellsPlayed + i == 6 || dy != 0 && cellsX != -1 && nbCellsPlayed + i == 6)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
score += 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
score++;
|
|
|
|
score++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|