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.lblRecentPoints = new System.Windows.Forms.Label();
|
||||
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();
|
||||
//
|
||||
// label1
|
||||
@ -59,7 +62,7 @@
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(96, 23);
|
||||
this.btnThrow.TabIndex = 1;
|
||||
@ -181,7 +184,7 @@
|
||||
//
|
||||
// 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.Name = "txtTotalPoints";
|
||||
this.txtTotalPoints.Size = new System.Drawing.Size(110, 23);
|
||||
@ -191,7 +194,7 @@
|
||||
//
|
||||
this.lblRecentPoints.AutoSize = true;
|
||||
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.Size = new System.Drawing.Size(158, 21);
|
||||
this.lblRecentPoints.TabIndex = 12;
|
||||
@ -199,7 +202,7 @@
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCollect.TabIndex = 13;
|
||||
@ -207,11 +210,40 @@
|
||||
this.btnCollect.UseVisualStyleBackColor = true;
|
||||
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
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
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.lblRecentPoints);
|
||||
this.Controls.Add(this.txtTotalPoints);
|
||||
@ -252,5 +284,8 @@
|
||||
private Label lblRecentPoints;
|
||||
private Button btnCollect;
|
||||
private ImageList imageList1;
|
||||
private Label label2;
|
||||
private TextBox txtMaxPoints;
|
||||
private TextBox txtChosenPoints;
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,8 @@ namespace WinGreed
|
||||
int y = 79;
|
||||
int x = 0;
|
||||
int row = 0;
|
||||
int tempMax = 0;
|
||||
int tempChsn = 0;
|
||||
bool maxHeatPoints = false;
|
||||
private List<Button> _dice = new List<Button>();
|
||||
private HandleThrow _ht;
|
||||
@ -44,7 +46,7 @@ namespace WinGreed
|
||||
|
||||
|
||||
Button btn = null;
|
||||
if (MarkGrayAndDisable(row))
|
||||
if (MarkGrayAndDisable(row))
|
||||
{
|
||||
result = _ht.Throw();
|
||||
}
|
||||
@ -141,7 +143,7 @@ namespace WinGreed
|
||||
}
|
||||
}
|
||||
}
|
||||
ok =AnalyseNumbers(Numbers, false);
|
||||
ok = AnalyseNumbers(Numbers, false);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -168,24 +170,30 @@ namespace WinGreed
|
||||
this.Controls.Add(txtRes);
|
||||
this.Refresh();
|
||||
|
||||
string outPut = CheckForDifferentOutCome(numbers);
|
||||
var outPut = CheckForDifferentOutCome(numbers);
|
||||
var actTxtBox = ((TextBox)this.Controls.Find($"txtMaxValue{row}", true).FirstOrDefault());
|
||||
actTxtBox.Text = outPut;
|
||||
actTxtBox.Text = outPut.StrSum;
|
||||
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;
|
||||
btnCollect.Enabled = false;
|
||||
MarkGrayAndDisable(row);
|
||||
txtMaxPoints.Text = "0";
|
||||
txtChosenPoints.Text = "0";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string outPut = CheckForDifferentOutCome(numbers);
|
||||
var outPut = CheckForDifferentOutCome(numbers);
|
||||
var actTxtBox = ((TextBox)this.Controls.Find($"txtChosenValue{row}", true).FirstOrDefault());
|
||||
actTxtBox.Text = outPut;
|
||||
actTxtBox.Text = outPut.StrSum;
|
||||
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
|
||||
&& _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 sum = 0;
|
||||
var result = new ResultSum();
|
||||
result.StrSum = "";
|
||||
result.NumSum = 0;
|
||||
maxHeatPoints = false;
|
||||
numbers.Sort();
|
||||
sum = CheckForDoubleTriple(numbers);
|
||||
sum += CheckForTripleDouble(numbers);
|
||||
sum += CheckForSerial(numbers);
|
||||
sum += CheckForThreeOrMore(numbers);
|
||||
outPut = sum.ToString();
|
||||
return outPut;
|
||||
result.NumSum = CheckForDoubleTriple(numbers);
|
||||
result.NumSum += CheckForTripleDouble(numbers);
|
||||
result.NumSum += CheckForSerial(numbers);
|
||||
result.NumSum += CheckForThreeOrMore(numbers);
|
||||
result.StrSum = result.NumSum.ToString();
|
||||
return result;
|
||||
}
|
||||
|
||||
private int CheckForSerial(List<int> numbers)
|
||||
@ -297,7 +306,7 @@ namespace WinGreed
|
||||
|
||||
public int NumberCounts(int value, int nmbr)
|
||||
{
|
||||
if (value > 2)
|
||||
if (value > 2 && !maxHeatPoints)
|
||||
{
|
||||
var back = nmbr == 1 ? 1000 : nmbr * 100;
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAEZTeXN0ZW0uV2luZG93cy5Gb3JtcywgQ3VsdHVyZT1uZXV0cmFs
|
||||
LCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5BQEAAAAmU3lzdGVtLldpbmRvd3MuRm9ybXMu
|
||||
SW1hZ2VMaXN0U3RyZWFtZXIBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAnhUAAAJNU0Z0AUkBTAIBAQYB
|
||||
AAEYAQABGAEAASABAAEgAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMAAYADAAFAAwABAQEAAQgG
|
||||
AAFIAQABSAEAASABAAEgAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMAAYADAAFAAwABAQEAAQgG
|
||||
AAEgGAABgAIAAYADAAKAAQABgAMAAYABAAGAAQACgAIAA8ABAAHAAdwBwAEAAfABygGmAQABMwUAATMB
|
||||
AAEzAQABMwEAAjMCAAMWAQADHAEAAyIBAAMpAQADVQEAA00BAANCAQADOQEAAYABfAH/AQACUAH/AQAB
|
||||
kwEAAdYBAAH/AewBzAEAAcYB1gHvAQAB1gLnAQABkAGpAa0CAAH/ATMDAAFmAwABmQMAAcwCAAEzAwAC
|
||||
|
||||
Reference in New Issue
Block a user