From 450c2095aad6ec8346042219bf761a730df65f90 Mon Sep 17 00:00:00 2001 From: "jules.lascret" Date: Fri, 17 May 2024 14:04:26 +0200 Subject: [PATCH] enhanced score --- Qwirkle/QwirkleClassLibrary/Game.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Qwirkle/QwirkleClassLibrary/Game.cs b/Qwirkle/QwirkleClassLibrary/Game.cs index 0d618b8..14a4f1e 100644 --- a/Qwirkle/QwirkleClassLibrary/Game.cs +++ b/Qwirkle/QwirkleClassLibrary/Game.cs @@ -428,8 +428,17 @@ namespace QwirkleClassLibrary int dx = adjacentCell.GetX - cell.GetX; int dy = adjacentCell.GetY - cell.GetY; + + if (adjacentCell.GetX == cell.GetX) + { + score += CalculateLineScore(cell, dx, 1, b); + + } + else + { + score += CalculateLineScore(cell, 1, dy, b); - score += CalculateLineScore(cell, dx, dy, b); + } } return score; @@ -439,13 +448,13 @@ namespace QwirkleClassLibrary { int score = 0; - for (int i = 1; i < b.Rows; i++) + for (int i = 1; i < 7; i++) { var extendedCell = b.GetCell(cell.GetX + i * dx, cell.GetY + i * dy); if (extendedCell?.GetTile == null) { - break; + continue; } score++;