diff options
author | emkael <emkael@tlen.pl> | 2016-06-03 00:19:47 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-03 00:19:47 +0200 |
commit | 5395bb1cd5a259c94e7ebc6da02d4e822763a170 (patch) | |
tree | 2d8151f60105217b0c097fc6017677a698d80730 | |
parent | 45573593a6d64993212d2cdda96ce65a7ad98244 (diff) |
* don't calculate defense if the contract doesn't make
-rw-r--r-- | src/ParContract.cs | 6 |
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;
|