summaryrefslogtreecommitdiff
path: root/Aktywator
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-02-04 15:00:00 +0100
committeremkael <emkael@tlen.pl>2018-02-04 15:00:00 +0100
commitf8d681f86db438cc2d8749e89d8ef3909ece8ca6 (patch)
tree1c35b473699a3454304f6f213d13ef671943573b /Aktywator
parent04af6640bb6f054adea7bd0f8d455857e3a81ebd (diff)
Rotating board layout if string defined in PBN starts with different player than North
Fixes #38
Diffstat (limited to 'Aktywator')
-rw-r--r--Aktywator/PBNBoard.cs15
-rw-r--r--Aktywator/Resources/BuildDate.txt2
2 files changed, 15 insertions, 2 deletions
diff --git a/Aktywator/PBNBoard.cs b/Aktywator/PBNBoard.cs
index fadfd22..994108e 100644
--- a/Aktywator/PBNBoard.cs
+++ b/Aktywator/PBNBoard.cs
@@ -88,7 +88,20 @@ namespace Aktywator
public String GetLayout()
{
string[] dealParts = this.GetField("Deal").Split(':');
- return dealParts[dealParts.Length - 1];
+ string layout = dealParts[dealParts.Length - 1];
+ if (dealParts.Length > 1)
+ {
+ string[] layoutParts = layout.Split(' ');
+ string[] rotatedLayout = { "", "", "", "" };
+ char dealer = dealParts[0][0];
+ int rotation = Array.IndexOf(DDTable.PLAYERS, dealer);
+ for (int i = 0; i < rotatedLayout.Length; i++)
+ {
+ rotatedLayout[(i + rotation) % rotatedLayout.Length] = layoutParts[i];
+ }
+ layout = String.Join(" ", rotatedLayout);
+ }
+ return layout;
}
public String GetNumber()
diff --git a/Aktywator/Resources/BuildDate.txt b/Aktywator/Resources/BuildDate.txt
index 8e190cf..fb76437 100644
--- a/Aktywator/Resources/BuildDate.txt
+++ b/Aktywator/Resources/BuildDate.txt
@@ -1 +1 @@
-2018-01-16
+2018-02-04