From 5395bb1cd5a259c94e7ebc6da02d4e822763a170 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 3 Jun 2016 00:19:47 +0200 Subject: * don't calculate defense if the contract doesn't make --- src/ParContract.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ParContract.cs b/src/ParContract.cs index 9a6c500..313f5b9 100644 --- a/src/ParContract.cs +++ b/src/ParContract.cs @@ -173,15 +173,15 @@ namespace BCDD public ParContract GetDefense(int[,] ddTable, bool vulnerable) { - if (this.Level != 0) + int declarerIndex = Array.IndexOf(BCalcWrapper.PLAYERS, this.Declarer); + int denominationIndex = Array.IndexOf(BCalcWrapper.DENOMINATIONS, this.Denomination); + if (this.Level != 0 && this.Level + 6 <= ddTable[declarerIndex, denominationIndex]) { - int declarerIndex = Array.IndexOf(BCalcWrapper.PLAYERS, this.Declarer); List defendersIndexes = new List(); defendersIndexes.Add((declarerIndex + 1) & 3); defendersIndexes.Add((declarerIndex + 3) & 3); List possibleDefense = new List(); int scoreSquared = this.Score * this.Score; - int denominationIndex = Array.IndexOf(BCalcWrapper.DENOMINATIONS, this.Denomination); for (int i = 0; i < 5; i++) { int level = this.Level; -- cgit v1.2.3