summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-06-03 00:19:47 +0200
committeremkael <emkael@tlen.pl>2016-06-03 00:19:47 +0200
commit5395bb1cd5a259c94e7ebc6da02d4e822763a170 (patch)
tree2d8151f60105217b0c097fc6017677a698d80730 /src
parent45573593a6d64993212d2cdda96ce65a7ad98244 (diff)
* don't calculate defense if the contract doesn't make
Diffstat (limited to 'src')
-rw-r--r--src/ParContract.cs6
1 files changed, 3 insertions, 3 deletions
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<int> defendersIndexes = new List<int>();
defendersIndexes.Add((declarerIndex + 1) & 3);
defendersIndexes.Add((declarerIndex + 3) & 3);
List<ParContract> possibleDefense = new List<ParContract>();
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;