summaryrefslogtreecommitdiff
path: root/Analizator9000
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2012-11-16 09:58:48 +0000
committeremkael <emkael@tlen.pl>2012-11-16 09:58:48 +0000
commitca2a01d9319ad350c9497f02eaa6239b8defb630 (patch)
tree59254866ea0d879a756ce45dc3571d8a67598550 /Analizator9000
parent8e6274676dc8199fcc37c77e8adf466e47dd005f (diff)
* analysis results acummulation
git-svn-id: https://svn.emkael.info/an9k@9 05ec0d5d-773b-4d93-9e23-c81a7ac79feb
Diffstat (limited to 'Analizator9000')
-rw-r--r--Analizator9000/Analizator9000/Accumulator.cs196
-rw-r--r--Analizator9000/Analizator9000/Analizator9000.csproj2
-rw-r--r--Analizator9000/Analizator9000/BCalcWrapper.cs101
-rw-r--r--Analizator9000/Analizator9000/DealerParser.cs5
-rw-r--r--Analizator9000/Analizator9000/DealerWrapper.cs12
-rw-r--r--Analizator9000/Analizator9000/Form1.Designer.cs563
-rw-r--r--Analizator9000/Analizator9000/Form1.cs145
-rw-r--r--Analizator9000/Analizator9000/Utils.cs15
8 files changed, 917 insertions, 122 deletions
diff --git a/Analizator9000/Analizator9000/Accumulator.cs b/Analizator9000/Analizator9000/Accumulator.cs
new file mode 100644
index 0000000..304954d
--- /dev/null
+++ b/Analizator9000/Analizator9000/Accumulator.cs
@@ -0,0 +1,196 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+
+namespace Analizator9000
+{
+ class Accumulator
+ {
+ private Dictionary<int, Dictionary<int, long[]>> sums;
+ private long analyzed = 0;
+ private long toAnalyze = 0;
+ private Stack<String> deals;
+ private Form1 form;
+ private Dictionary<int, List<int>> contracts;
+ private StreamWriter outputFile;
+ private String filename;
+
+ public Accumulator(String[] deals, List<Tuple<int, int>> contracts, Form1 form)
+ {
+ this.deals = new Stack<String>(deals);
+ this.toAnalyze = deals.LongLength;
+ this.form = form;
+ this.sums = new Dictionary<int, Dictionary<int, long[]>>();
+ for (int den = 0; den < BCalcWrapper.denominations.Length; den++)
+ {
+ this.sums.Add(den, new Dictionary<int,long[]>());
+ for (int hand = 0; hand < BCalcWrapper.table.Length; hand++)
+ {
+ if (contracts.Contains(new Tuple<int, int>(den, hand)))
+ {
+ this.sums[den].Add(hand, new long[] { 0, 0, 0 });
+ }
+ else
+ {
+ this.sums[den].Add(hand, new long[] { -1, -1, 0 });
+ }
+ }
+ }
+ this.contracts = new Dictionary<int, List<int>>();
+ foreach (Tuple<int, int> contract in contracts)
+ {
+ if (!this.contracts.ContainsKey(contract.Item1))
+ {
+ this.contracts.Add(contract.Item1, new List<int>());
+ }
+ this.contracts[contract.Item1].Add(contract.Item2);
+ }
+ this.filename = Utils.getFilename("result");
+ this.outputFile = new StreamWriter(@"files\"+this.filename);
+ }
+
+ private int portionSize;
+ private int threadsRunning;
+ public int run(int portionSize = 0)
+ {
+ if (portionSize > 0)
+ {
+ this.portionSize = portionSize;
+ }
+ this.threadsRunning = Math.Min(this.portionSize, this.deals.Count);
+ for (int i = 0; i < this.threadsRunning; i++)
+ {
+ Action<String> worker = this.analyzeDeal;
+ worker.BeginInvoke(this.deals.Pop(), this.endAnalyze, worker);
+ }
+ return this.deals.Count;
+ }
+
+ private void analyzeDeal(String deal)
+ {
+ try
+ {
+ this.form.addStatusLine(deal);
+ BCalcWrapper solver = new BCalcWrapper(deal);
+ foreach (KeyValuePair<int, List<int>> row in this.contracts)
+ {
+ try
+ {
+ solver.setTrump(row.Key);
+ }
+ catch (Exception ex)
+ {
+ this.form.addStatusLine("Błąd: " + ex.Message);
+ }
+ foreach (int entry in row.Value)
+ {
+ try
+ {
+ BCalcResult result = solver.run(entry);
+ String line = "#" + result.dealNo + ", " + result.declarer + " gra w " + result.trumpSuit + ", lew: " + result.tricks;
+ this.update(result);
+ this.form.setResult(this.getString());
+ this.form.addStatusLine(line);
+ this.outputFile.WriteLine(line);
+ }
+ catch (Exception ex)
+ {
+ this.form.addStatusLine("Błąd: " + ex.Message);
+ }
+ }
+ }
+ solver.destroy();
+ }
+ catch (Exception ex)
+ {
+ this.outputFile.WriteLine(ex.Message);
+ this.form.addStatusLine("Błąd: " + ex.Message);
+ }
+ }
+
+ private bool abort = false;
+ public void abortAnalysis()
+ {
+ this.abort = true;
+ }
+
+ private void endAnalyze(IAsyncResult methodResult)
+ {
+ ((Action<String>)methodResult.AsyncState).EndInvoke(methodResult);
+ bool finished = false;
+ if (this.abort)
+ {
+ this.form.setProgress(0);
+ this.form.addStatusLine("Analiza przewana. Częściowe wyniki w pliku: " + this.filename);
+ finished = true;
+ }
+ else
+ {
+ this.threadsRunning--;
+ this.analyzed++;
+ this.form.setProgress((int)(100 * this.analyzed / this.toAnalyze));
+ if (threadsRunning == 0)
+ {
+ if (this.deals.Count > 0)
+ {
+ this.run();
+ }
+ else
+ {
+ this.form.setProgress(100);
+ this.form.addStatusLine("Analiza zakończona. Wyniki w pliku: " + this.filename);
+ finished = true;
+ }
+ }
+ }
+ if (finished)
+ {
+ try
+ {
+ this.outputFile.WriteLine(this.getString());
+ this.outputFile.Close();
+ }
+ catch (Exception) { };
+ this.form.endAnalysis();
+ }
+ }
+
+ private String getString()
+ {
+ StringWriter sw = new StringWriter();
+ sw.WriteLine(" N E S W");
+ foreach (KeyValuePair<int, Dictionary<int, long[]>> row in this.sums)
+ {
+ sw.Write(BCalcWrapper.denominations[row.Key]+" ");
+ foreach (KeyValuePair<int, long[]> entry in row.Value)
+ {
+ if (entry.Value[0] >= 0)
+ {
+ double mean = (entry.Value[2] != 0) ? (double)entry.Value[0] / entry.Value[2] : 0.0;
+ double stdDev = (entry.Value[2] != 0) ? Math.Sqrt((double)entry.Value[1] / entry.Value[2] - mean * mean) : 0.0;
+ sw.Write(" {0,5:0.00} ± {1,5:0.00} ", mean, stdDev);
+ }
+ else
+ {
+ sw.Write(" ");
+ }
+ }
+ sw.WriteLine();
+ }
+ sw.Close();
+ return sw.ToString();
+ }
+
+ private void update(BCalcResult result)
+ {
+ int tricks = result.tricks;
+ int suit = BCalcWrapper.denominations.IndexOf(result.trumpSuit);
+ int player = BCalcWrapper.table.IndexOf(result.declarer);
+ this.sums[suit][player][0] += tricks;
+ this.sums[suit][player][1] += tricks * tricks;
+ this.sums[suit][player][2] ++;
+ }
+ }
+}
diff --git a/Analizator9000/Analizator9000/Analizator9000.csproj b/Analizator9000/Analizator9000/Analizator9000.csproj
index cb9e123..51fd483 100644
--- a/Analizator9000/Analizator9000/Analizator9000.csproj
+++ b/Analizator9000/Analizator9000/Analizator9000.csproj
@@ -65,6 +65,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Accumulator.cs" />
<Compile Include="BCalcWrapper.cs" />
<Compile Include="DealerParser.cs" />
<Compile Include="DealerWrapper.cs" />
@@ -76,6 +77,7 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Utils.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
diff --git a/Analizator9000/Analizator9000/BCalcWrapper.cs b/Analizator9000/Analizator9000/BCalcWrapper.cs
index 65628c8..c176117 100644
--- a/Analizator9000/Analizator9000/BCalcWrapper.cs
+++ b/Analizator9000/Analizator9000/BCalcWrapper.cs
@@ -3,49 +3,108 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
-using System.Windows.Forms;
+using System.Text.RegularExpressions;
namespace Analizator9000
{
+ struct BCalcResult
+ {
+ public char trumpSuit;
+ public char declarer;
+ public int tricks;
+ public long dealNo;
+ public BCalcResult(char a, char b, int c, long d)
+ {
+ trumpSuit = a;
+ declarer = b;
+ tricks = c;
+ dealNo = d;
+ }
+ };
class BCalcWrapper
{
- [DllImport("bin\\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport(@"bin\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bcalcDDS_new(IntPtr format, IntPtr hands, Int32 trump, Int32 leader);
- [DllImport("bin\\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport(@"bin\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern Int32 bcalcDDS_getTricksToTake(IntPtr solver);
- [DllImport("bin\\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport(@"bin\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr bcalcDDS_getLastError(IntPtr solver);
- [DllImport("bin\\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
+ [DllImport(@"bin\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void bcalcDDS_delete(IntPtr solver);
- private static String table = "NESW";
- private static String trumps = "CDHSN";
- public static int runDeal(String deal, char trumpSuit, char declarer)
+ [DllImport(@"bin\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern void bcalcDDS_setTrumpAndReset(IntPtr solver, Int32 trump);
+
+ [DllImport(@"bin\libbcalcdds.dll", CallingConvention = CallingConvention.Cdecl)]
+ private static extern void bcalcDDS_setPlayerOnLeadAndReset(IntPtr solver, Int32 player);
+
+ public static String table = "NESW";
+ public static String denominations = "CDHSN";
+
+ private IntPtr solver;
+ private String deal;
+ private long dealNo;
+ private int trumps;
+ public BCalcWrapper(String deal)
+ {
+ try
+ {
+ Match dealMatch = Regex.Match(deal, @"^(\d+): (.*)$");
+ if (!dealMatch.Success) {
+ throw new Exception();
+ }
+ this.deal = dealMatch.Groups[2].Value;
+ this.dealNo = Convert.ToInt64(dealMatch.Groups[1].Value);
+ }
+ catch (Exception)
+ {
+ throw new Exception("Nie można wczytać rozdania: " + deal);
+ }
+ this.solver = BCalcWrapper.bcalcDDS_new(Marshal.StringToHGlobalAnsi(BCalcWrapper.table), Marshal.StringToHGlobalAnsi(this.deal), 0, 0);
+ this.errorCheck();
+ }
+
+ public void setTrump(int trumpSuit)
{
- int decl = BCalcWrapper.table.IndexOf(declarer);
- if (decl < 0)
+ if (trumpSuit < 0)
{
- throw new Exception("Nieprawidłowy rozgrywający");
+ throw new Exception("Nieprawidłowe miano: " + trumpSuit);
}
- int leader = (decl + 1) % 4;
- int trump = BCalcWrapper.trumps.IndexOf(trumpSuit);
- if (trump < 0)
+ BCalcWrapper.bcalcDDS_setTrumpAndReset(solver, trumpSuit);
+ this.errorCheck();
+ this.trumps = trumpSuit;
+ }
+
+ public BCalcResult run(int declarer)
+ {
+ if (declarer < 0)
{
- throw new Exception("Nieprawidłowe miano");
+ throw new Exception("Nieprawidłowy rozgrywający: " + declarer);
}
- IntPtr solver = BCalcWrapper.bcalcDDS_new(Marshal.StringToHGlobalAnsi(BCalcWrapper.table), Marshal.StringToHGlobalAnsi(deal), trump, leader);
- IntPtr error = BCalcWrapper.bcalcDDS_getLastError(solver);
+ int l = (declarer + 1) % 4;
+ BCalcWrapper.bcalcDDS_setPlayerOnLeadAndReset(solver, l);
+ this.errorCheck();
+ int result = BCalcWrapper.bcalcDDS_getTricksToTake(this.solver);
+ this.errorCheck();
+ return new BCalcResult(BCalcWrapper.denominations[this.trumps], BCalcWrapper.table[declarer], 13 - result, this.dealNo);
+ }
+
+ public void destroy() {
+ BCalcWrapper.bcalcDDS_delete(this.solver);
+ }
+
+ private void errorCheck()
+ {
+ IntPtr error = BCalcWrapper.bcalcDDS_getLastError(this.solver);
String eStr = Marshal.PtrToStringAnsi(error);
if (eStr != null)
{
- throw new Exception("bcalc", (new Exception(eStr)));
+ throw new Exception(eStr);
}
- int ret = 13 - BCalcWrapper.bcalcDDS_getTricksToTake(solver);
- BCalcWrapper.bcalcDDS_delete(solver);
- return ret;
}
+
}
}
diff --git a/Analizator9000/Analizator9000/DealerParser.cs b/Analizator9000/Analizator9000/DealerParser.cs
index f638aa3..80031fd 100644
--- a/Analizator9000/Analizator9000/DealerParser.cs
+++ b/Analizator9000/Analizator9000/DealerParser.cs
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
-using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace Analizator9000
@@ -110,8 +109,8 @@ namespace Analizator9000
}
public String saveFile()
{
- String filename = "an9k-" + DateTime.Now.ToString("yyyyMMddHHmmssFFF") + ".dealer";
- StreamWriter file = new StreamWriter("files\\" + filename);
+ String filename = Utils.getFilename("dealer");
+ StreamWriter file = new StreamWriter(@"files\" + filename);
String predealStr = "";
String suitLetters = "SHDC";
foreach (KeyValuePair<String, String[]> pre in this.predeal)
diff --git a/Analizator9000/Analizator9000/DealerWrapper.cs b/Analizator9000/Analizator9000/DealerWrapper.cs
index ac00e6e..4184d8e 100644
--- a/Analizator9000/Analizator9000/DealerWrapper.cs
+++ b/Analizator9000/Analizator9000/DealerWrapper.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
-using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
@@ -44,11 +43,12 @@ namespace Analizator9000
String[] dataLines = data.Split('\n');
foreach (String line in dataLines)
{
- Match lineMatch = Regex.Match(line.Trim(), "^n\\s*(\\S*)\\s*e\\s*(\\S*)\\s*s\\s*(\\S*)\\s*w\\s*(\\S*)$");
+ Match lineMatch = Regex.Match(line.Trim(), @"^n\s*(\S*)\s*e\s*(\S*)\s*s\s*(\S*)\s*w\s*(\S*)$");
if (lineMatch.Success)
{
- this.outputFile.WriteLine(lineMatch.Result("${1} ${2} ${3} ${4}"));
this.lineCount++;
+ this.outputFile.Write(this.lineCount);
+ this.outputFile.WriteLine(lineMatch.Result(": ${1} ${2} ${3} ${4}"));
}
}
int progress = ((int)(100 * this.lineCount / this.produce));
@@ -71,10 +71,10 @@ namespace Analizator9000
{
this.running = true;
this.lineCount = 0;
- String filename = "an9k-" + DateTime.Now.ToString("yyyyMMddHHmmssFFF") + ".deals";
- this.outputFile = new StreamWriter("files\\"+filename);
+ String filename = Utils.getFilename("deals");
+ this.outputFile = new StreamWriter(@"files\"+filename);
ProcessStartInfo pInfo = new ProcessStartInfo();
- pInfo.FileName = "bin\\dealer.exe";
+ pInfo.FileName = @"bin\dealer.exe";
pInfo.WindowStyle = ProcessWindowStyle.Hidden;
pInfo.CreateNoWindow = true;
pInfo.Arguments = "\"" + this.scriptname + "\"";
diff --git a/Analizator9000/Analizator9000/Form1.Designer.cs b/Analizator9000/Analizator9000/Form1.Designer.cs
index 73f609f..cdbc86a 100644
--- a/Analizator9000/Analizator9000/Form1.Designer.cs
+++ b/Analizator9000/Analizator9000/Form1.Designer.cs
@@ -65,12 +65,38 @@
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.generateFileNameTextBox = new System.Windows.Forms.TextBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.analyzeButton = new System.Windows.Forms.Button();
- this.contractList = new System.Windows.Forms.ComboBox();
- this.declarerList = new System.Windows.Forms.ComboBox();
+ this.analyzeGroup = new System.Windows.Forms.GroupBox();
+ this.contractTable = new System.Windows.Forms.TableLayoutPanel();
+ this.label21 = new System.Windows.Forms.Label();
+ this.label17 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
+ this.checkBox1 = new System.Windows.Forms.CheckBox();
+ this.checkBox2 = new System.Windows.Forms.CheckBox();
+ this.checkBox3 = new System.Windows.Forms.CheckBox();
+ this.checkBox4 = new System.Windows.Forms.CheckBox();
+ this.checkBox5 = new System.Windows.Forms.CheckBox();
+ this.checkBox6 = new System.Windows.Forms.CheckBox();
+ this.checkBox7 = new System.Windows.Forms.CheckBox();
+ this.checkBox8 = new System.Windows.Forms.CheckBox();
+ this.checkBox9 = new System.Windows.Forms.CheckBox();
+ this.checkBox10 = new System.Windows.Forms.CheckBox();
+ this.checkBox11 = new System.Windows.Forms.CheckBox();
+ this.checkBox12 = new System.Windows.Forms.CheckBox();
+ this.checkBox13 = new System.Windows.Forms.CheckBox();
+ this.checkBox14 = new System.Windows.Forms.CheckBox();
+ this.checkBox15 = new System.Windows.Forms.CheckBox();
+ this.checkBox16 = new System.Windows.Forms.CheckBox();
+ this.checkBox17 = new System.Windows.Forms.CheckBox();
+ this.checkBox18 = new System.Windows.Forms.CheckBox();
+ this.checkBox19 = new System.Windows.Forms.CheckBox();
+ this.checkBox20 = new System.Windows.Forms.CheckBox();
this.label14 = new System.Windows.Forms.Label();
+ this.label16 = new System.Windows.Forms.Label();
+ this.label18 = new System.Windows.Forms.Label();
+ this.label19 = new System.Windows.Forms.Label();
+ this.label20 = new System.Windows.Forms.Label();
+ this.label22 = new System.Windows.Forms.Label();
+ this.analyzeButton = new System.Windows.Forms.Button();
this.label13 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.analyzeFileNameTextBox = new System.Windows.Forms.TextBox();
@@ -78,10 +104,13 @@
this.progressBar = new System.Windows.Forms.ProgressBar();
this.statusListBox = new System.Windows.Forms.ListBox();
this.analyzeFileDialog = new System.Windows.Forms.OpenFileDialog();
- this.textBox22 = new System.Windows.Forms.TextBox();
+ this.resultTextBox = new System.Windows.Forms.TextBox();
+ this.abortButton = new System.Windows.Forms.Button();
+ this.button3 = new System.Windows.Forms.Button();
this.generateGroup.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
- this.groupBox2.SuspendLayout();
+ this.analyzeGroup.SuspendLayout();
+ this.contractTable.SuspendLayout();
this.SuspendLayout();
//
// generateGroup
@@ -129,7 +158,7 @@
this.produceBox.Name = "produceBox";
this.produceBox.Size = new System.Drawing.Size(224, 20);
this.produceBox.TabIndex = 9;
- this.produceBox.Text = "100000";
+ this.produceBox.Text = "1000";
this.produceBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label12
@@ -147,7 +176,7 @@
this.generateBox.Name = "generateBox";
this.generateBox.Size = new System.Drawing.Size(224, 20);
this.generateBox.TabIndex = 7;
- this.generateBox.Text = "10000000";
+ this.generateBox.Text = "100000";
this.generateBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label11
@@ -208,6 +237,7 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(497, 116);
this.tableLayoutPanel1.TabIndex = 3;
//
@@ -496,81 +526,381 @@
this.generateFileNameTextBox.Size = new System.Drawing.Size(419, 20);
this.generateFileNameTextBox.TabIndex = 0;
//
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.analyzeButton);
- this.groupBox2.Controls.Add(this.contractList);
- this.groupBox2.Controls.Add(this.declarerList);
- this.groupBox2.Controls.Add(this.label15);
- this.groupBox2.Controls.Add(this.label14);
- this.groupBox2.Controls.Add(this.label13);
- this.groupBox2.Controls.Add(this.button2);
- this.groupBox2.Controls.Add(this.analyzeFileNameTextBox);
- this.groupBox2.Location = new System.Drawing.Point(531, 12);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(513, 179);
- this.groupBox2.TabIndex = 1;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "Analiza";
- //
- // analyzeButton
- //
- this.analyzeButton.Location = new System.Drawing.Point(7, 133);
- this.analyzeButton.Name = "analyzeButton";
- this.analyzeButton.Size = new System.Drawing.Size(497, 40);
- this.analyzeButton.TabIndex = 11;
- this.analyzeButton.Text = "ANALIZUJ";
- this.analyzeButton.UseVisualStyleBackColor = true;
- this.analyzeButton.Click += new System.EventHandler(this.analyzeButton_Click);
- //
- // contractList
- //
- this.contractList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.contractList.FormattingEnabled = true;
- this.contractList.Items.AddRange(new object[] {
- "Wszystkie",
- "Bez atu",
- "Piki",
- "Kiery",
- "Kara",
- "Trefle"});
- this.contractList.Location = new System.Drawing.Point(89, 101);
- this.contractList.Name = "contractList";
- this.contractList.Size = new System.Drawing.Size(121, 21);
- this.contractList.TabIndex = 6;
- //
- // declarerList
- //
- this.declarerList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.declarerList.FormattingEnabled = true;
- this.declarerList.Items.AddRange(new object[] {
- "Wszyscy",
- "N",
- "E",
- "S",
- "W"});
- this.declarerList.Location = new System.Drawing.Point(89, 73);
- this.declarerList.Name = "declarerList";
- this.declarerList.Size = new System.Drawing.Size(121, 21);
- this.declarerList.TabIndex = 5;
+ // analyzeGroup
+ //
+ this.analyzeGroup.Controls.Add(this.contractTable);
+ this.analyzeGroup.Controls.Add(this.analyzeButton);
+ this.analyzeGroup.Controls.Add(this.label13);
+ this.analyzeGroup.Controls.Add(this.button2);
+ this.analyzeGroup.Controls.Add(this.analyzeFileNameTextBox);
+ this.analyzeGroup.Location = new System.Drawing.Point(531, 12);
+ this.analyzeGroup.Name = "analyzeGroup";
+ this.analyzeGroup.Size = new System.Drawing.Size(513, 179);
+ this.analyzeGroup.TabIndex = 1;
+ this.analyzeGroup.TabStop = false;
+ this.analyzeGroup.Text = "Analiza";
+ //
+ // contractTable
+ //
+ this.contractTable.ColumnCount = 6;
+ this.contractTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
+ this.contractTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
+ this.contractTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
+ this.contractTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
+ this.contractTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
+ this.contractTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
+ this.contractTable.Controls.Add(this.label21, 0, 3);
+ this.contractTable.Controls.Add(this.label17, 5, 0);
+ this.contractTable.Controls.Add(this.label15, 3, 0);
+ this.contractTable.Controls.Add(this.checkBox1, 1, 1);
+ this.contractTable.Controls.Add(this.checkBox2, 1, 2);
+ this.contractTable.Controls.Add(this.checkBox3, 1, 3);
+ this.contractTable.Controls.Add(this.checkBox4, 1, 4);
+ this.contractTable.Controls.Add(this.checkBox5, 2, 1);
+ this.contractTable.Controls.Add(this.checkBox6, 2, 2);
+ this.contractTable.Controls.Add(this.checkBox7, 2, 3);
+ this.contractTable.Controls.Add(this.checkBox8, 2, 4);
+ this.contractTable.Controls.Add(this.checkBox9, 3, 1);
+ this.contractTable.Controls.Add(this.checkBox10, 4, 1);
+ this.contractTable.Controls.Add(this.checkBox11, 5, 1);
+ this.contractTable.Controls.Add(this.checkBox12, 3, 2);
+ this.contractTable.Controls.Add(this.checkBox13, 4, 2);
+ this.contractTable.Controls.Add(this.checkBox14, 5, 2);
+ this.contractTable.Controls.Add(this.checkBox15, 3, 3);
+ this.contractTable.Controls.Add(this.checkBox16, 4, 3);
+ this.contractTable.Controls.Add(this.checkBox17, 5, 3);
+ this.contractTable.Controls.Add(this.checkBox18, 3, 4);
+ this.contractTable.Controls.Add(this.checkBox19, 4, 4);
+ this.contractTable.Controls.Add(this.checkBox20, 5, 4);
+ this.contractTable.Controls.Add(this.label14, 2, 0);
+ this.contractTable.Controls.Add(this.label16, 4, 0);
+ this.contractTable.Controls.Add(this.label18, 1, 0);
+ this.contractTable.Controls.Add(this.label19, 0, 1);
+ this.contractTable.Controls.Add(this.label20, 0, 2);
+ this.contractTable.Controls.Add(this.label22, 0, 4);
+ this.contractTable.Controls.Add(this.button3, 0, 0);
+ this.contractTable.Location = new System.Drawing.Point(10, 63);
+ this.contractTable.Name = "contractTable";
+ this.contractTable.RowCount = 5;
+ this.contractTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.contractTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.contractTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.contractTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.contractTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
+ this.contractTable.Size = new System.Drawing.Size(210, 110);
+ this.contractTable.TabIndex = 12;
+ //
+ // label21
+ //
+ this.label21.Anchor = System.Windows.Forms.AnchorStyles.Right;
+ this.label21.AutoSize = true;
+ this.label21.Location = new System.Drawing.Point(14, 70);
+ this.label21.Name = "label21";
+ this.label21.Size = new System.Drawing.Size(17, 13);
+ this.label21.TabIndex = 29;
+ this.label21.Text = "S:";
+ this.label21.Click += new System.EventHandler(this.label21_Click);
+ //
+ // label17
+ //
+ this.label17.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.label17.AutoSize = true;
+ this.label17.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label17.Location = new System.Drawing.Point(173, 0);
+ this.label17.Name = "label17";
+ this.label17.Size = new System.Drawing.Size(34, 22);
+ this.label17.TabIndex = 24;
+ this.label17.Text = "♣";
+ this.label17.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label17.Click += new System.EventHandler(this.label17_Click);
//
// label15
//
+ this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.label15.AutoSize = true;
- this.label15.Location = new System.Drawing.Point(7, 104);
+ this.label15.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label15.ForeColor = System.Drawing.Color.Red;
+ this.label15.Location = new System.Drawing.Point(105, 0);
this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(39, 13);
- this.label15.TabIndex = 4;
- this.label15.Text = "Miano:";
+ this.label15.Size = new System.Drawing.Size(28, 22);
+ this.label15.TabIndex = 24;
+ this.label15.Text = "♥";
+ this.label15.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label15.Click += new System.EventHandler(this.label15_Click);
+ //
+ // checkBox1
+ //
+ this.checkBox1.AutoSize = true;
+ this.checkBox1.Location = new System.Drawing.Point(37, 25);
+ this.checkBox1.Name = "checkBox1";
+ this.checkBox1.Size = new System.Drawing.Size(15, 14);
+ this.checkBox1.TabIndex = 0;
+ this.checkBox1.UseVisualStyleBackColor = true;
+ //
+ // checkBox2
+ //
+ this.checkBox2.AutoSize = true;
+ this.checkBox2.Location = new System.Drawing.Point(37, 47);
+ this.checkBox2.Name = "checkBox2";
+ this.checkBox2.Size = new System.Drawing.Size(15, 14);
+ this.checkBox2.TabIndex = 1;
+ this.checkBox2.UseVisualStyleBackColor = true;
+ //
+ // checkBox3
+ //
+ this.checkBox3.AutoSize = true;
+ this.checkBox3.Location = new System.Drawing.Point(37, 69);
+ this.checkBox3.Name = "checkBox3";
+ this.checkBox3.Size = new System.Drawing.Size(15, 14);
+ this.checkBox3.TabIndex = 2;
+ this.checkBox3.UseVisualStyleBackColor = true;
+ //
+ // checkBox4
+ //
+ this.checkBox4.AutoSize = true;
+ this.checkBox4.Location = new System.Drawing.Point(37, 91);
+ this.checkBox4.Name = "checkBox4";
+ this.checkBox4.Size = new System.Drawing.Size(15, 14);
+ this.checkBox4.TabIndex = 3;
+ this.checkBox4.UseVisualStyleBackColor = true;
+ //
+ // checkBox5
+ //
+ this.checkBox5.AutoSize = true;
+ this.checkBox5.Location = new System.Drawing.Point(71, 25);
+ this.checkBox5.Name = "checkBox5";
+ this.checkBox5.Size = new System.Drawing.Size(15, 14);
+ this.checkBox5.TabIndex = 4;
+ this.checkBox5.UseVisualStyleBackColor = true;
+ //
+ // checkBox6
+ //
+ this.checkBox6.AutoSize = true;
+ this.checkBox6.Location = new System.Drawing.Point(71, 47);
+ this.checkBox6.Name = "checkBox6";
+ this.checkBox6.Size = new System.Drawing.Size(15, 14);
+ this.checkBox6.TabIndex = 5;
+ this.checkBox6.UseVisualStyleBackColor = true;
+ //
+ // checkBox7
+ //
+ this.checkBox7.AutoSize = true;
+ this.checkBox7.Location = new System.Drawing.Point(71, 69);
+ this.checkBox7.Name = "checkBox7";
+ this.checkBox7.Size = new System.Drawing.Size(15, 14);
+ this.checkBox7.TabIndex = 6;
+ this.checkBox7.UseVisualStyleBackColor = true;
+ //
+ // checkBox8
+ //
+ this.checkBox8.AutoSize = true;
+ this.checkBox8.Location = new System.Drawing.Point(71, 91);
+ this.checkBox8.Name = "checkBox8";
+ this.checkBox8.Size = new System.Drawing.Size(15, 14);
+ this.checkBox8.TabIndex = 7;
+ this.checkBox8.UseVisualStyleBackColor = true;
+ //
+ // checkBox9
+ //
+ this.checkBox9.AutoSize = true;
+ this.checkBox9.Location = new System.Drawing.Point(105, 25);
+ this.checkBox9.Name = "checkBox9";
+ this.checkBox9.Size = new System.Drawing.Size(15, 14);
+ this.checkBox9.TabIndex = 8;
+ this.checkBox9.UseVisualStyleBackColor = true;
+ //
+ // checkBox10
+ //
+ this.checkBox10.AutoSize = true;
+ this.checkBox10.Location = new System.Drawing.Point(139, 25);
+ this.checkBox10.Name = "checkBox10";
+ this.checkBox10.Size = new System.Drawing.Size(15, 14);
+ this.checkBox10.TabIndex = 9;
+ this.checkBox10.UseVisualStyleBackColor = true;
+ //
+ // checkBox11
+ //
+ this.checkBox11.AutoSize = true;
+ this.checkBox11.Location = new System.Drawing.Point(173, 25);
+ this.checkBox11.Name = "checkBox11";
+ this.checkBox11.Size = new System.Drawing.Size(15, 14);
+ this.checkBox11.TabIndex = 10;
+ this.checkBox11.UseVisualStyleBackColor = true;
+ //
+ // checkBox12
+ //
+ this.checkBox12.AutoSize = true;
+ this.checkBox12.Location = new System.Drawing.Point(105, 47);
+ this.checkBox12.Name = "checkBox12";
+ this.checkBox12.Size = new System.Drawing.Size(15, 14);
+ this.checkBox12.TabIndex = 11;
+ this.checkBox12.UseVisualStyleBackColor = true;
+ //
+ // checkBox13
+ //
+ this.checkBox13.AutoSize = true;
+ this.checkBox13.Location = new System.Drawing.Point(139, 47);
+ this.checkBox13.Name = "checkBox13";
+ this.checkBox13.Size = new System.Drawing.Size(15, 14);
+ this.checkBox13.TabIndex = 12;
+ this.checkBox13.UseVisualStyleBackColor = true;
+ //
+ // checkBox14
+ //
+ this.checkBox14.AutoSize = true;
+ this.checkBox14.Location = new System.Drawing.Point(173, 47);
+ this.checkBox14.Name = "checkBox14";
+ this.checkBox14.Size = new System.Drawing.Size(15, 14);
+ this.checkBox14.TabIndex = 13;
+ this.checkBox14.UseVisualStyleBackColor = true;
+ //
+ // checkBox15
+ //
+ this.checkBox15.AutoSize = true;
+ this.checkBox15.Location = new System.Drawing.Point(105, 69);
+ this.checkBox15.Name = "checkBox15";
+ this.checkBox15.Size = new System.Drawing.Size(15, 14);
+ this.checkBox15.TabIndex = 14;
+ this.checkBox15.UseVisualStyleBackColor = true;
+ //
+ // checkBox16
+ //
+ this.checkBox16.AutoSize = true;
+ this.checkBox16.Location = new System.Drawing.Point(139, 69);
+ this.checkBox16.Name = "checkBox16";
+ this.checkBox16.Size = new System.Drawing.Size(15, 14);
+ this.checkBox16.TabIndex = 15;
+ this.checkBox16.UseVisualStyleBackColor = true;
+ //
+ // checkBox17
+ //
+ this.checkBox17.AutoSize = true;
+ this.checkBox17.Location = new System.Drawing.Point(173, 69);
+ this.checkBox17.Name = "checkBox17";
+ this.checkBox17.Size = new System.Drawing.Size(15, 14);
+ this.checkBox17.TabIndex = 16;
+ this.checkBox17.UseVisualStyleBackColor = true;
+ //
+ // checkBox18
+ //
+ this.checkBox18.AutoSize = true;
+ this.checkBox18.Location = new System.Drawing.Point(105, 91);
+ this.checkBox18.Name = "checkBox18";
+ this.checkBox18.Size = new System.Drawing.Size(15, 14);
+ this.checkBox18.TabIndex = 17;
+ this.checkBox18.UseVisualStyleBackColor = true;
+ //
+ // checkBox19
+ //
+ this.checkBox19.AutoSize = true;
+ this.checkBox19.Location = new System.Drawing.Point(139, 91);
+ this.checkBox19.Name = "checkBox19";
+ this.checkBox19.Size = new System.Drawing.Size(15, 14);
+ this.checkBox19.TabIndex = 18;
+ this.checkBox19.UseVisualStyleBackColor = true;
+ //
+ // checkBox20
+ //
+ this.checkBox20.AutoSize = true;
+ this.checkBox20.Location = new System.Drawing.Point(173, 91);
+ this.checkBox20.Name = "checkBox20";
+ this.checkBox20.Size = new System.Drawing.Size(15, 14);
+ this.checkBox20.TabIndex = 19;
+ this.checkBox20.UseVisualStyleBackColor = true;
//
// label14
//
+ this.label14.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.label14.AutoSize = true;
- this.label14.Location = new System.Drawing.Point(6, 76);
+ this.label14.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label14.Location = new System.Drawing.Point(71, 0);
this.label14.Name = "label14";
- this.label14.Size = new System.Drawing.Size(76, 13);
- this.label14.TabIndex = 3;
- this.label14.Text = "Rozgrywający:";
+ this.label14.Size = new System.Drawing.Size(28, 22);
+ this.label14.TabIndex = 21;
+ this.label14.Text = "♠";
+ this.label14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label14.Click += new System.EventHandler(this.label14_Click);
+ //
+ // label16
+ //
+ this.label16.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.label16.AutoSize = true;
+ this.label16.Font = new System.Drawing.Font("Lucida Sans Unicode", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label16.ForeColor = System.Drawing.Color.Red;
+ this.label16.Location = new System.Drawing.Point(139, 0);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(28, 22);
+ this.label16.TabIndex = 25;
+ this.label16.Text = "♦";
+ this.label16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label16.Click += new System.EventHandler(this.label16_Click);
+ //
+ // label18
+ //
+ this.label18.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.label18.AutoSize = true;
+ this.label18.Font = new System.Drawing.Font("Lucida Sans Unicode", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.label18.ForeColor = System.Drawing.Color.Blue;
+ this.label18.Location = new System.Drawing.Point(37, 0);
+ this.label18.Name = "label18";
+ this.label18.Size = new System.Drawing.Size(28, 22);
+ this.label18.TabIndex = 26;
+ this.label18.Text = "NT";
+ this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.label18.Click += new System.EventHandler(this.label18_Click);
+ //
+ // label19
+ //
+ this.label19.Anchor = System.Windows.Forms.AnchorStyles.Right;
+ this.label19.AutoSize = true;
+ this.label19.Location = new System.Drawing.Point(13, 26);
+ this.label19.Name = "label19";
+ this.label19.Size = new System.Drawing.Size(18, 13);
+ this.label19.TabIndex = 27;
+ this.label19.Text = "N:";
+ this.label19.Click += new System.EventHandler(this.label19_Click);
+ //
+ // label20
+ //
+ this.label20.Anchor = System.Windows.Forms.AnchorStyles.Right;
+ this.label20.AutoSize = true;
+ this.label20.Location = new System.Drawing.Point(14, 48);
+ this.label20.Name = "label20";
+ this.label20.Size = new System.Drawing.Size(17, 13);
+ this.label20.TabIndex = 28;
+ this.label20.Text = "E:";
+ this.label20.Click += new System.EventHandler(this.label20_Click);
+ //
+ // label22
+ //
+ this.label22.Anchor = System.Windows.Forms.AnchorStyles.Right;
+ this.label22.AutoSize = true;
+ this.label22.Location = new System.Drawing.Point(10, 92);
+ this.label22.Name = "label22";
+ this.label22.Size = new System.Drawing.Size(21, 13);
+ this.label22.TabIndex = 30;
+ this.label22.Text = "W:";
+ this.label22.Click += new System.EventHandler(this.label22_Click);
+ //
+ // analyzeButton
+ //
+ this.analyzeButton.Location = new System.Drawing.Point(226, 47);
+ this.analyzeButton.Name = "analyzeButton";
+ this.analyzeButton.Size = new System.Drawing.Size(278, 99);
+ this.analyzeButton.TabIndex = 11;
+ this.analyzeButton.Text = "ANALIZUJ";
+ this.analyzeButton.UseVisualStyleBackColor = true;
+ this.analyzeButton.Click += new System.EventHandler(this.analyzeButton_Click);
//
// label13
//
@@ -622,23 +952,48 @@
//
this.analyzeFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.analyzeFileDialog_FileOk);
//
- // textBox22
+ // resultTextBox
+ //
+ this.resultTextBox.Font = new System.Drawing.Font("Lucida Console", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
+ this.resultTextBox.Location = new System.Drawing.Point(531, 197);
+ this.resultTextBox.Multiline = true;
+ this.resultTextBox.Name = "resultTextBox";
+ this.resultTextBox.ReadOnly = true;
+ this.resultTextBox.Size = new System.Drawing.Size(513, 109);
+ this.resultTextBox.TabIndex = 4;
+ //
+ // abortButton
+ //
+ this.abortButton.Enabled = false;
+ this.abortButton.Location = new System.Drawing.Point(757, 157);
+ this.abortButton.Name = "abortButton";
+ this.abortButton.Size = new System.Drawing.Size(277, 34);
+ this.abortButton.TabIndex = 13;
+ this.abortButton.Text = "PRZERWIJ";
+ this.abortButton.UseVisualStyleBackColor = true;
+ this.abortButton.Click += new System.EventHandler(this.abortButton_Click);
+ //
+ // button3
//
- this.textBox22.Location = new System.Drawing.Point(531, 197);
- this.textBox22.Multiline = true;
- this.textBox22.Name = "textBox22";
- this.textBox22.Size = new System.Drawing.Size(513, 109);
- this.textBox22.TabIndex = 4;
+ this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.button3.Location = new System.Drawing.Point(13, 3);
+ this.button3.Name = "button3";
+ this.button3.Size = new System.Drawing.Size(18, 16);
+ this.button3.TabIndex = 31;
+ this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1052, 463);
- this.Controls.Add(this.textBox22);
+ this.Controls.Add(this.abortButton);
+ this.Controls.Add(this.resultTextBox);
this.Controls.Add(this.statusListBox);
this.Controls.Add(this.progressBar);
- this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.analyzeGroup);
this.Controls.Add(this.generateGroup);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@@ -651,8 +1006,10 @@
this.generateGroup.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
- this.groupBox2.ResumeLayout(false);
- this.groupBox2.PerformLayout();
+ this.analyzeGroup.ResumeLayout(false);
+ this.analyzeGroup.PerformLayout();
+ this.contractTable.ResumeLayout(false);
+ this.contractTable.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -661,7 +1018,7 @@
#endregion
private System.Windows.Forms.GroupBox generateGroup;
- private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.GroupBox analyzeGroup;
private System.Windows.Forms.OpenFileDialog generateFileDialog;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TextBox predealNorthSpadesBox;
@@ -699,17 +1056,45 @@
private System.Windows.Forms.Label label11;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.ListBox statusListBox;
- private System.Windows.Forms.ComboBox contractList;
- private System.Windows.Forms.ComboBox declarerList;
- private System.Windows.Forms.Label label15;
- private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox analyzeFileNameTextBox;
private System.Windows.Forms.OpenFileDialog analyzeFileDialog;
private System.Windows.Forms.Button analyzeButton;
- private System.Windows.Forms.TextBox textBox22;
+ private System.Windows.Forms.TextBox resultTextBox;
private System.Windows.Forms.RichTextBox conditionBox;
+ private System.Windows.Forms.TableLayoutPanel contractTable;
+ private System.Windows.Forms.CheckBox checkBox1;
+ private System.Windows.Forms.CheckBox checkBox2;
+ private System.Windows.Forms.CheckBox checkBox3;
+ private System.Windows.Forms.CheckBox checkBox4;
+ private System.Windows.Forms.CheckBox checkBox5;
+ private System.Windows.Forms.CheckBox checkBox6;
+ private System.Windows.Forms.CheckBox checkBox7;
+ private System.Windows.Forms.CheckBox checkBox8;
+ private System.Windows.Forms.CheckBox checkBox9;
+ private System.Windows.Forms.CheckBox checkBox10;
+ private System.Windows.Forms.CheckBox checkBox11;
+ private System.Windows.Forms.CheckBox checkBox12;
+ private System.Windows.Forms.CheckBox checkBox13;
+ private System.Windows.Forms.CheckBox checkBox14;
+ private System.Windows.Forms.CheckBox checkBox15;
+ private System.Windows.Forms.CheckBox checkBox16;
+ private System.Windows.Forms.CheckBox checkBox17;
+ private System.Windows.Forms.CheckBox checkBox18;
+ private System.Windows.Forms.CheckBox checkBox19;
+ private System.Windows.Forms.CheckBox checkBox20;
+ private System.Windows.Forms.Label label21;
+ private System.Windows.Forms.Label label22;
+ private System.Windows.Forms.Label label17;
+ private System.Windows.Forms.Label label15;
+ private System.Windows.Forms.Label label14;
+ private System.Windows.Forms.Label label16;
+ private System.Windows.Forms.Label label18;
+ private System.Windows.Forms.Label label20;
+ private System.Windows.Forms.Label label19;
+ private System.Windows.Forms.Button abortButton;
+ private System.Windows.Forms.Button button3;
}
}
diff --git a/Analizator9000/Analizator9000/Form1.cs b/Analizator9000/Analizator9000/Form1.cs
index 64dce0f..8747c68 100644
--- a/Analizator9000/Analizator9000/Form1.cs
+++ b/Analizator9000/Analizator9000/Form1.cs
@@ -73,6 +73,7 @@ namespace Analizator9000
private void generateButton_Click(object sender, EventArgs e)
{
generateGroup.Enabled = false;
+ analyzeGroup.Enabled = false;
progressBar.Value = 0;
try
{
@@ -94,6 +95,8 @@ namespace Analizator9000
catch (Exception ex)
{
MessageBox.Show("Błąd wprowadzania danych: " + ex.Message, "Błąd wprowadzania danych", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ generateGroup.Enabled = true;
+ analyzeGroup.Enabled = true;
}
try
{
@@ -104,10 +107,14 @@ namespace Analizator9000
catch (FileNotFoundException)
{
MessageBox.Show("Nie można utworzyć pliku. Sprawdź, czy w katalogu programu istnieje katalog 'files'", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ generateGroup.Enabled = true;
+ analyzeGroup.Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show("Błąd generatora: " + ex.Message, "Błąd generatora", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ generateGroup.Enabled = true;
+ analyzeGroup.Enabled = true;
}
}
@@ -125,8 +132,9 @@ namespace Analizator9000
{
this.addStatusLine("Zapisano do pliku: " + filename);
}
- analyzeFileNameTextBox.Text = Path.GetFullPath(filename);
+ analyzeFileNameTextBox.Text = Path.GetFullPath(@"files\" + filename);
generateGroup.Enabled = true;
+ analyzeGroup.Enabled = true;
}
}
@@ -162,8 +170,6 @@ namespace Analizator9000
private void Form1_Load(object sender, EventArgs e)
{
- declarerList.SelectedIndex = 0;
- contractList.SelectedIndex = 0;
}
private void analyzeFileDialog_FileOk(object sender, CancelEventArgs e)
@@ -176,9 +182,142 @@ namespace Analizator9000
analyzeFileDialog.ShowDialog();
}
+ private Accumulator ac;
private void analyzeButton_Click(object sender, EventArgs e)
{
+ analyzeGroup.Enabled = false;
+ generateGroup.Enabled = false;
+ abortButton.Enabled = true;
+ this.addStatusLine("Otwieram plik: " + analyzeFileNameTextBox.Text);
+ try
+ {
+ String[] deals = File.ReadAllLines(analyzeFileNameTextBox.Text);
+ List<Tuple<int, int>> cons = new List<Tuple<int,int>>();
+ foreach (int i in Enumerable.Range(1, 5))
+ {
+ foreach (int j in Enumerable.Range(1, 4))
+ {
+ if (((CheckBox)contractTable.GetControlFromPosition(i, j)).Checked)
+ {
+ cons.Add(new Tuple<int, int>(5 - i, j - 1));
+ }
+ }
+ }
+ if (cons.Count == 0)
+ {
+ throw new Exception("Nie podano kontraktów");
+ }
+ this.ac = new Accumulator(deals, cons, this);
+ this.ac.run(10);
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Błąd analizy: " + ex.Message, "Błąd analizy", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ this.setProgress(0);
+ abortButton.Enabled = false;
+ analyzeGroup.Enabled = true;
+ generateGroup.Enabled = true;
+ }
}
+ private delegate void EndAnalysisDelegate();
+ public void endAnalysis()
+ {
+ if (this.InvokeRequired)
+ {
+ this.Invoke(new EndAnalysisDelegate(endAnalysis));
+ }
+ else
+ {
+ this.setProgress(100);
+ abortButton.Enabled = false;
+ analyzeGroup.Enabled = true;
+ generateGroup.Enabled = true;
+ this.ac = null;
+ }
+ }
+
+ private delegate void SetResultDelegate(String res);
+ public void setResult(String res)
+ {
+ if (this.InvokeRequired)
+ {
+ this.Invoke(new SetResultDelegate(setResult), new object[] { res });
+ }
+ else
+ {
+ resultTextBox.Text = res;
+ }
+ }
+
+ private void abortButton_Click(object sender, EventArgs e)
+ {
+ if (this.ac != null)
+ {
+ this.ac.abortAnalysis();
+ }
+ }
+
+ private void toggleBoxes(IEnumerable<int> xRange, IEnumerable<int> yRange)
+ {
+ foreach (int x in xRange)
+ {
+ foreach (int y in yRange)
+ {
+ CheckBox cb = ((CheckBox)contractTable.GetControlFromPosition(x, y));
+ cb.Checked = !cb.Checked;
+ }
+ }
+ }
+
+ private void button3_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(1, 5), Enumerable.Range(1, 4));
+ }
+
+ private void label18_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(1, 1), Enumerable.Range(1, 4));
+ }
+
+ private void label14_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(2, 1), Enumerable.Range(1, 4));
+ }
+
+ private void label15_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(3, 1), Enumerable.Range(1, 4));
+ }
+
+ private void label16_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(4, 1), Enumerable.Range(1, 4));
+ }
+
+ private void label17_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(5, 1), Enumerable.Range(1, 4));
+ }
+
+ private void label19_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(1, 5), Enumerable.Range(1, 1));
+ }
+
+ private void label20_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(1, 5), Enumerable.Range(2, 1));
+ }
+
+ private void label21_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(1, 5), Enumerable.Range(3, 1));
+ }
+
+ private void label22_Click(object sender, EventArgs e)
+ {
+ this.toggleBoxes(Enumerable.Range(1, 5), Enumerable.Range(4, 1));
+ }
}
}
diff --git a/Analizator9000/Analizator9000/Utils.cs b/Analizator9000/Analizator9000/Utils.cs
new file mode 100644
index 0000000..eefaa9b
--- /dev/null
+++ b/Analizator9000/Analizator9000/Utils.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Analizator9000
+{
+ class Utils
+ {
+ static public String getFilename(String extension)
+ {
+ return "an9k-" + DateTime.Now.ToString("yyyyMMddHHmmssFFF") + "." + extension;
+ }
+ }
+}