Added temporary sum
This commit is contained in:
14
WinGreed/ResultSum.cs
Normal file
14
WinGreed/ResultSum.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace WinGreed
|
||||||
|
{
|
||||||
|
public class ResultSum
|
||||||
|
{
|
||||||
|
public int NumSum { get; set; }
|
||||||
|
public string StrSum { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
43
WinGreed/frmPersonRound.Designer.cs
generated
43
WinGreed/frmPersonRound.Designer.cs
generated
@ -45,6 +45,9 @@
|
|||||||
this.txtTotalPoints = new System.Windows.Forms.TextBox();
|
this.txtTotalPoints = new System.Windows.Forms.TextBox();
|
||||||
this.lblRecentPoints = new System.Windows.Forms.Label();
|
this.lblRecentPoints = new System.Windows.Forms.Label();
|
||||||
this.btnCollect = new System.Windows.Forms.Button();
|
this.btnCollect = new System.Windows.Forms.Button();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.txtMaxPoints = new System.Windows.Forms.TextBox();
|
||||||
|
this.txtChosenPoints = new System.Windows.Forms.TextBox();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -59,7 +62,7 @@
|
|||||||
//
|
//
|
||||||
// btnThrow
|
// btnThrow
|
||||||
//
|
//
|
||||||
this.btnThrow.Location = new System.Drawing.Point(32, 71);
|
this.btnThrow.Location = new System.Drawing.Point(32, 81);
|
||||||
this.btnThrow.Name = "btnThrow";
|
this.btnThrow.Name = "btnThrow";
|
||||||
this.btnThrow.Size = new System.Drawing.Size(96, 23);
|
this.btnThrow.Size = new System.Drawing.Size(96, 23);
|
||||||
this.btnThrow.TabIndex = 1;
|
this.btnThrow.TabIndex = 1;
|
||||||
@ -181,7 +184,7 @@
|
|||||||
//
|
//
|
||||||
// txtTotalPoints
|
// txtTotalPoints
|
||||||
//
|
//
|
||||||
this.txtTotalPoints.Location = new System.Drawing.Point(350, 73);
|
this.txtTotalPoints.Location = new System.Drawing.Point(350, 51);
|
||||||
this.txtTotalPoints.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
this.txtTotalPoints.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
this.txtTotalPoints.Name = "txtTotalPoints";
|
this.txtTotalPoints.Name = "txtTotalPoints";
|
||||||
this.txtTotalPoints.Size = new System.Drawing.Size(110, 23);
|
this.txtTotalPoints.Size = new System.Drawing.Size(110, 23);
|
||||||
@ -191,7 +194,7 @@
|
|||||||
//
|
//
|
||||||
this.lblRecentPoints.AutoSize = true;
|
this.lblRecentPoints.AutoSize = true;
|
||||||
this.lblRecentPoints.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
this.lblRecentPoints.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
this.lblRecentPoints.Location = new System.Drawing.Point(172, 70);
|
this.lblRecentPoints.Location = new System.Drawing.Point(172, 48);
|
||||||
this.lblRecentPoints.Name = "lblRecentPoints";
|
this.lblRecentPoints.Name = "lblRecentPoints";
|
||||||
this.lblRecentPoints.Size = new System.Drawing.Size(158, 21);
|
this.lblRecentPoints.Size = new System.Drawing.Size(158, 21);
|
||||||
this.lblRecentPoints.TabIndex = 12;
|
this.lblRecentPoints.TabIndex = 12;
|
||||||
@ -199,7 +202,7 @@
|
|||||||
//
|
//
|
||||||
// btnCollect
|
// btnCollect
|
||||||
//
|
//
|
||||||
this.btnCollect.Location = new System.Drawing.Point(495, 71);
|
this.btnCollect.Location = new System.Drawing.Point(495, 49);
|
||||||
this.btnCollect.Name = "btnCollect";
|
this.btnCollect.Name = "btnCollect";
|
||||||
this.btnCollect.Size = new System.Drawing.Size(75, 23);
|
this.btnCollect.Size = new System.Drawing.Size(75, 23);
|
||||||
this.btnCollect.TabIndex = 13;
|
this.btnCollect.TabIndex = 13;
|
||||||
@ -207,11 +210,40 @@
|
|||||||
this.btnCollect.UseVisualStyleBackColor = true;
|
this.btnCollect.UseVisualStyleBackColor = true;
|
||||||
this.btnCollect.Click += new System.EventHandler(this.btnCollect_Click);
|
this.btnCollect.Click += new System.EventHandler(this.btnCollect_Click);
|
||||||
//
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.AutoSize = true;
|
||||||
|
this.label2.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||||
|
this.label2.Location = new System.Drawing.Point(172, 80);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(148, 21);
|
||||||
|
this.label2.TabIndex = 14;
|
||||||
|
this.label2.Text = "Maxpoints / Chosen";
|
||||||
|
//
|
||||||
|
// txtMaxPoints
|
||||||
|
//
|
||||||
|
this.txtMaxPoints.Location = new System.Drawing.Point(359, 82);
|
||||||
|
this.txtMaxPoints.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.txtMaxPoints.Name = "txtMaxPoints";
|
||||||
|
this.txtMaxPoints.Size = new System.Drawing.Size(48, 23);
|
||||||
|
this.txtMaxPoints.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// txtChosenPoints
|
||||||
|
//
|
||||||
|
this.txtChosenPoints.Location = new System.Drawing.Point(413, 82);
|
||||||
|
this.txtChosenPoints.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||||
|
this.txtChosenPoints.Name = "txtChosenPoints";
|
||||||
|
this.txtChosenPoints.Size = new System.Drawing.Size(48, 23);
|
||||||
|
this.txtChosenPoints.TabIndex = 16;
|
||||||
|
//
|
||||||
// frmPersonRound
|
// frmPersonRound
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 618);
|
this.ClientSize = new System.Drawing.Size(800, 618);
|
||||||
|
this.Controls.Add(this.txtChosenPoints);
|
||||||
|
this.Controls.Add(this.txtMaxPoints);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.btnCollect);
|
this.Controls.Add(this.btnCollect);
|
||||||
this.Controls.Add(this.lblRecentPoints);
|
this.Controls.Add(this.lblRecentPoints);
|
||||||
this.Controls.Add(this.txtTotalPoints);
|
this.Controls.Add(this.txtTotalPoints);
|
||||||
@ -252,5 +284,8 @@
|
|||||||
private Label lblRecentPoints;
|
private Label lblRecentPoints;
|
||||||
private Button btnCollect;
|
private Button btnCollect;
|
||||||
private ImageList imageList1;
|
private ImageList imageList1;
|
||||||
|
private Label label2;
|
||||||
|
private TextBox txtMaxPoints;
|
||||||
|
private TextBox txtChosenPoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16,6 +16,8 @@ namespace WinGreed
|
|||||||
int y = 79;
|
int y = 79;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
int tempMax = 0;
|
||||||
|
int tempChsn = 0;
|
||||||
bool maxHeatPoints = false;
|
bool maxHeatPoints = false;
|
||||||
private List<Button> _dice = new List<Button>();
|
private List<Button> _dice = new List<Button>();
|
||||||
private HandleThrow _ht;
|
private HandleThrow _ht;
|
||||||
@ -141,7 +143,7 @@ namespace WinGreed
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ok =AnalyseNumbers(Numbers, false);
|
ok = AnalyseNumbers(Numbers, false);
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -168,24 +170,30 @@ namespace WinGreed
|
|||||||
this.Controls.Add(txtRes);
|
this.Controls.Add(txtRes);
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
|
|
||||||
string outPut = CheckForDifferentOutCome(numbers);
|
var outPut = CheckForDifferentOutCome(numbers);
|
||||||
var actTxtBox = ((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault());
|
var actTxtBox = ((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault());
|
||||||
actTxtBox.Text = outPut;
|
actTxtBox.Text = outPut.StrSum;
|
||||||
actTxtBox.Refresh();
|
actTxtBox.Refresh();
|
||||||
if (numbers.Count > 0 && int.Parse(outPut.Trim()) == 0)
|
tempMax += outPut.NumSum;
|
||||||
|
txtMaxPoints.Text = tempMax.ToString();
|
||||||
|
if (numbers.Count > 0 && int.Parse(outPut.StrSum.Trim()) == 0)
|
||||||
{
|
{
|
||||||
btnThrow.Enabled = false;
|
btnThrow.Enabled = false;
|
||||||
btnCollect.Enabled = false;
|
btnCollect.Enabled = false;
|
||||||
MarkGrayAndDisable(row);
|
MarkGrayAndDisable(row);
|
||||||
|
txtMaxPoints.Text = "0";
|
||||||
|
txtChosenPoints.Text = "0";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string outPut = CheckForDifferentOutCome(numbers);
|
var outPut = CheckForDifferentOutCome(numbers);
|
||||||
var actTxtBox = ((TextBox)this.Controls.Find($"txtChosenValue{row}", true).FirstOrDefault());
|
var actTxtBox = ((TextBox)this.Controls.Find($"txtChosenValue{row}", true).FirstOrDefault());
|
||||||
actTxtBox.Text = outPut;
|
actTxtBox.Text = outPut.StrSum;
|
||||||
actTxtBox.Refresh();
|
actTxtBox.Refresh();
|
||||||
if(((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault()).Text == actTxtBox.Text
|
tempChsn += outPut.NumSum;
|
||||||
|
txtChosenPoints.Text = tempChsn.ToString();
|
||||||
|
if (((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault()).Text == actTxtBox.Text
|
||||||
&& int.Parse(actTxtBox.Text.Trim()) > 0
|
&& int.Parse(actTxtBox.Text.Trim()) > 0
|
||||||
&& _ht.Dices.Count(x => x.Chosen == true) == _ht.Dices.Count)
|
&& _ht.Dices.Count(x => x.Chosen == true) == _ht.Dices.Count)
|
||||||
{
|
{
|
||||||
@ -200,18 +208,19 @@ namespace WinGreed
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string CheckForDifferentOutCome(List<int> numbers)
|
private ResultSum CheckForDifferentOutCome(List<int> numbers)
|
||||||
{
|
{
|
||||||
var outPut = "";
|
var result = new ResultSum();
|
||||||
var sum = 0;
|
result.StrSum = "";
|
||||||
|
result.NumSum = 0;
|
||||||
maxHeatPoints = false;
|
maxHeatPoints = false;
|
||||||
numbers.Sort();
|
numbers.Sort();
|
||||||
sum = CheckForDoubleTriple(numbers);
|
result.NumSum = CheckForDoubleTriple(numbers);
|
||||||
sum += CheckForTripleDouble(numbers);
|
result.NumSum += CheckForTripleDouble(numbers);
|
||||||
sum += CheckForSerial(numbers);
|
result.NumSum += CheckForSerial(numbers);
|
||||||
sum += CheckForThreeOrMore(numbers);
|
result.NumSum += CheckForThreeOrMore(numbers);
|
||||||
outPut = sum.ToString();
|
result.StrSum = result.NumSum.ToString();
|
||||||
return outPut;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int CheckForSerial(List<int> numbers)
|
private int CheckForSerial(List<int> numbers)
|
||||||
@ -297,7 +306,7 @@ namespace WinGreed
|
|||||||
|
|
||||||
public int NumberCounts(int value, int nmbr)
|
public int NumberCounts(int value, int nmbr)
|
||||||
{
|
{
|
||||||
if (value > 2)
|
if (value > 2 && !maxHeatPoints)
|
||||||
{
|
{
|
||||||
var back = nmbr == 1 ? 1000 : nmbr * 100;
|
var back = nmbr == 1 ? 1000 : nmbr * 100;
|
||||||
|
|
||||||
|
|||||||
@ -65,7 +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