aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.idea/statistic.xml14
-rw-r--r--resources/default.json2
-rw-r--r--resources/fortunes-favor.json8
-rw-r--r--resources/simple-fortunes-favor.json9
-rw-r--r--src/main/input-output/input/sol_preset_types.cpp22
-rw-r--r--src/test/fortunes_favor_test.cpp28
-rw-r--r--src/test/resources/fortunes_favor/ComplexSolvable.json7
-rw-r--r--src/test/resources/fortunes_favor/ComplexUnsolvable.json7
-rw-r--r--src/test/resources/fortunes_favor/SimpleSolvable.json7
-rw-r--r--src/test/resources/fortunes_favor/SimpleUnsolvable.json7
10 files changed, 99 insertions, 12 deletions
diff --git a/.idea/statistic.xml b/.idea/statistic.xml
new file mode 100644
index 0000000..1f847e3
--- /dev/null
+++ b/.idea/statistic.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Statistic">
+ <option name="excludedDirectories">
+ <list>
+ <option value="$PROJECT_DIR$/src/test/resources" />
+ <option value="$PROJECT_DIR$/cmake-build-debug" />
+ <option value="$PROJECT_DIR$/cmake-build-release" />
+ <option value="$PROJECT_DIR$/docs" />
+ <option value="$PROJECT_DIR$/resources" />
+ </list>
+ </option>
+ </component>
+</project> \ No newline at end of file
diff --git a/resources/default.json b/resources/default.json
index 12d39b2..756e31f 100644
--- a/resources/default.json
+++ b/resources/default.json
@@ -8,7 +8,7 @@
"max rank": 13,
"hole": false,
"foundations": true,
+ "foundation initial card": false,
"cells": 0,
- "reserve size": 0,
"stock size": 0
} \ No newline at end of file
diff --git a/resources/fortunes-favor.json b/resources/fortunes-favor.json
new file mode 100644
index 0000000..b791561
--- /dev/null
+++ b/resources/fortunes-favor.json
@@ -0,0 +1,8 @@
+{
+ "tableau piles": {
+ "count": 12,
+ "build policy": "same-suit"
+ },
+ "foundations initial card": true,
+ "stock size": 36
+} \ No newline at end of file
diff --git a/resources/simple-fortunes-favor.json b/resources/simple-fortunes-favor.json
new file mode 100644
index 0000000..6f3cf61
--- /dev/null
+++ b/resources/simple-fortunes-favor.json
@@ -0,0 +1,9 @@
+{
+ "tableau piles": {
+ "count": 3,
+ "build policy": "same-suit"
+ },
+ "max rank": 4,
+ "foundations initial card": true,
+ "stock size": 3
+} \ No newline at end of file
diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp
index 3c9d295..96cbba9 100644
--- a/src/main/input-output/input/sol_preset_types.cpp
+++ b/src/main/input-output/input/sol_preset_types.cpp
@@ -147,32 +147,32 @@ std::map<string, string> sol_preset_types::mp = {
},
{
- "canfield",
+ "fortunes-favor",
R"(
{
"tableau piles": {
- "count": 4,
- "build policy": "red-black"
+ "count": 12,
+ "build policy": "same-suit"
},
- "reserve size": 14,
- "stock size": 34
+ "foundations initial card": true,
+ "stock size": 36
}
)"
},
{
- "simple-canfield",
+ "simple-fortunes-favor",
R"(
{
"tableau piles": {
- "count": 2,
- "build policy": "red-black"
+ "count": 3,
+ "build policy": "same-suit"
},
- "max rank": 2,
- "reserve size": 2,
- "stock size": 2
+ "max rank": 4,
+ "foundations initial card": true,
+ "stock size": 3
}
)"
diff --git a/src/test/fortunes_favor_test.cpp b/src/test/fortunes_favor_test.cpp
new file mode 100644
index 0000000..8973a53
--- /dev/null
+++ b/src/test/fortunes_favor_test.cpp
@@ -0,0 +1,28 @@
+//
+// Created by thecharlesblake on 10/4/17.
+//
+
+#include <gtest/gtest.h>
+
+#include "test_helper.h"
+
+typedef test_helper th;
+
+const static std::string path = "resources/spanish_patience/";
+const static std::string type = "simple-spanish-patience";
+
+TEST(SpanishPatience, SimpleSolvable) {
+ EXPECT_TRUE(th::is_solvable(path + "SimpleSolvable.json", type));
+}
+
+TEST(SpanishPatience, ComplexSolvable) {
+ EXPECT_TRUE(th::is_solvable(path + "ComplexSolvable.json", type));
+}
+
+TEST(SpanishPatience, SimpleUnsolvable) {
+ EXPECT_FALSE(th::is_solvable(path + "SimpleUnsolvable.json", type));
+}
+
+TEST(SpanishPatience, ComplexUnsolvable) {
+ EXPECT_FALSE(th::is_solvable(path + "ComplexUnsolvable.json", type));
+}
diff --git a/src/test/resources/fortunes_favor/ComplexSolvable.json b/src/test/resources/fortunes_favor/ComplexSolvable.json
new file mode 100644
index 0000000..c48ce47
--- /dev/null
+++ b/src/test/resources/fortunes_favor/ComplexSolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["AS", "2S", "AH"],
+ ["AD", "2D", "2H"],
+ ["2C", "AC"]
+ ]
+}
diff --git a/src/test/resources/fortunes_favor/ComplexUnsolvable.json b/src/test/resources/fortunes_favor/ComplexUnsolvable.json
new file mode 100644
index 0000000..ba9be59
--- /dev/null
+++ b/src/test/resources/fortunes_favor/ComplexUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["AS", "2S", "AH"],
+ ["AD", "2D", "2H"],
+ ["AC", "2C"]
+ ]
+}
diff --git a/src/test/resources/fortunes_favor/SimpleSolvable.json b/src/test/resources/fortunes_favor/SimpleSolvable.json
new file mode 100644
index 0000000..eacad0e
--- /dev/null
+++ b/src/test/resources/fortunes_favor/SimpleSolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["2S", "AS", "AD"],
+ ["2D", "2H", "AH"],
+ ["2C", "AC"]
+ ]
+}
diff --git a/src/test/resources/fortunes_favor/SimpleUnsolvable.json b/src/test/resources/fortunes_favor/SimpleUnsolvable.json
new file mode 100644
index 0000000..99a3140
--- /dev/null
+++ b/src/test/resources/fortunes_favor/SimpleUnsolvable.json
@@ -0,0 +1,7 @@
+{
+ "tableau piles": [
+ ["AS", "2S", "2D"],
+ ["AD", "AH", "2H"],
+ ["AC", "2C"]
+ ]
+}