summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2014-12-24 11:45:19 +0000
committeremkael <emkael@tlen.pl>2014-12-24 11:45:19 +0000
commit4679b558e7b2d8583ea6f7bb80ca13b195389ff2 (patch)
tree57f6d43fff048bbcf1511ca17e3532188cf1af72
parent348089aebcabcf7719abde4f7a493e311710bb24 (diff)
* log output for contract analysis
git-svn-id: https://svn.emkael.info/an9k@48 05ec0d5d-773b-4d93-9e23-c81a7ac79feb
-rw-r--r--Analizator9000/Analizator9000/Accumulator.cs6
-rw-r--r--Analizator9000/Analizator9000/ScoreAccumulator.cs30
2 files changed, 33 insertions, 3 deletions
diff --git a/Analizator9000/Analizator9000/Accumulator.cs b/Analizator9000/Analizator9000/Accumulator.cs
index be5e714..3f52a8c 100644
--- a/Analizator9000/Analizator9000/Accumulator.cs
+++ b/Analizator9000/Analizator9000/Accumulator.cs
@@ -224,7 +224,7 @@ namespace Analizator9000
{
try
{
- this.outputFile.WriteLine(this.getString());
+ this.outputFile.WriteLine(this.getString(true));
this.outputFile.Close();
}
catch (Exception) { };
@@ -237,10 +237,12 @@ namespace Analizator9000
/// <summary>
/// Presents the current analysis results in textual form.
/// </summary>
+ /// <param name="full">Return full analysis for log file purpose (may be used in override methods)</param>
/// <returns>Text table containing means and std. deviations for distinct contracts.</returns>
- private String getString()
+ protected virtual String getString(bool full = false)
{
StringWriter sw = new StringWriter();
+ sw.WriteLine();
sw.WriteLine(" N E S W");
foreach (KeyValuePair<int, Dictionary<int, long[]>> row in this.sums)
{
diff --git a/Analizator9000/Analizator9000/ScoreAccumulator.cs b/Analizator9000/Analizator9000/ScoreAccumulator.cs
index 14d89a1..f850e63 100644
--- a/Analizator9000/Analizator9000/ScoreAccumulator.cs
+++ b/Analizator9000/Analizator9000/ScoreAccumulator.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.IO;
namespace Analizator9000
{
@@ -9,8 +10,9 @@ namespace Analizator9000
/// </summary>
class ScoreAccumulator : Accumulator
{
+ private readonly string[] vulnerabilities = { "obie przed", "obie po", "NS po", "EW po" };
/// <summary>
- /// Vulneraility setting of the analysis
+ /// Vulnerability setting of the analysis
/// </summary>
private int vulnerability;
/// <summary>
@@ -80,6 +82,32 @@ namespace Analizator9000
}
/// <summary>
+ /// Returns user-readable summary of analysis
+ /// </summary>
+ /// <param name="full">Append matchpoint/IMP scores summary</param>
+ /// <returns>Formatted log string</returns>
+ protected override String getString(bool full = false)
+ {
+ String output = base.getString(full);
+ if (full)
+ {
+ StringWriter sw = new StringWriter();
+ sw.WriteLine();
+ sw.WriteLine("Założenia: {0}", this.vulnerabilities[this.vulnerability]);
+ sw.WriteLine(" KONTRAKT LEWY ZAPIS MAX IMP ");
+ foreach (KeyValuePair<Contract, long> tricks in this.trickSums)
+ {
+ sw.WriteLine(" {0,6} (x{1,3}) {2,5:0.00} {3,9:0.00} {4,5:0.00} {5,7:0.00} ", this.getContractLogLine(tricks.Key), tricks.Key.Frequency,
+ tricks.Value / this.dealsScored, this.scoreSums[tricks.Key] / this.dealsScored,
+ this.maxScoreSums[tricks.Key] / this.dealsScored, this.impScoreSums[tricks.Key] / this.dealsScored);
+ }
+ sw.Close();
+ output += sw.ToString();
+ }
+ return output;
+ }
+
+ /// <summary>
/// Handling single DD analysis result
/// </summary>
/// <param name="result">BCalc analysis result</param>