diff options
| author | thecharlesblake | 2018-01-02 11:27:27 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-02 11:27:27 +0000 |
| commit | 9ad093dc713f5464181b1018e80ec359ca381bb3 (patch) | |
| tree | 836584a0df2546bf0b9a764b26295c22c3fd6478 /src | |
| parent | Fix bug in solver - improper ref to vector element (diff) | |
| download | metasol-9ad093dc713f5464181b1018e80ec359ca381bb3.tar.gz metasol-9ad093dc713f5464181b1018e80ec359ca381bb3.zip | |
Add json rules for bakers dozen
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/input-output/sol_preset_types.cpp | 74 | ||||
| -rw-r--r-- | src/test/bakers_dozen_test.cpp | 28 | ||||
| -rw-r--r-- | src/test/resources/bakers_dozen/ComplexSolvable.json | 7 | ||||
| -rw-r--r-- | src/test/resources/bakers_dozen/ComplexUnsolvable.json | 7 | ||||
| -rw-r--r-- | src/test/resources/bakers_dozen/SimpleSolvable.json | 7 | ||||
| -rw-r--r-- | src/test/resources/bakers_dozen/SimpleUnsolvable.json | 7 |
6 files changed, 107 insertions, 23 deletions
diff --git a/src/main/input-output/sol_preset_types.cpp b/src/main/input-output/sol_preset_types.cpp index 169a8a5..2ba14d9 100644 --- a/src/main/input-output/sol_preset_types.cpp +++ b/src/main/input-output/sol_preset_types.cpp @@ -22,7 +22,8 @@ std::map<string, string> sol_preset_types::mp = { "tableau piles": { "count": 8, "build order": "descending", - "build policy": "any-suit" + "build policy": "any-suit", + "spaces policy": "any" }, "max rank": 13, "hole": false, @@ -35,85 +36,112 @@ std::map<string, string> sol_preset_types::mp = { }, { - "black-hole", + "spanish-patience", R"( { "tableau piles": { - "count": 17, - "build order": "no-build" + "count": 13 + } +} +)" + + }, + { + "simple-spanish-patience", + + R"( +{ + "tableau piles": { + "count": 3 }, - "hole": true, - "foundations": false + "max rank": 2 } )" }, { - "simple-black-hole", + "free-cell", + + R"( +{ + "tableau piles": { + "build policy": "red-black" + }, + "cells": 4 +} +)" + + }, + { + "simple-free-cell", R"( { "tableau piles": { "count": 4, - "build order": "no-build" + "build policy": "red-black" }, - "max rank": 5, - "hole": true, - "foundations": false + "max rank": 4, + "cells": 1 } )" }, { - "spanish-patience", + "bakers-dozen", R"( { "tableau piles": { - "count": 13 + "count": 13, + "spaces policy": "no-build" } } )" }, { - "simple-spanish-patience", + "simple-bakers-dozen", R"( { "tableau piles": { - "count": 3 + "count": 3, + "spaces policy": "no-build" }, - "max rank": 2 + "max rank": 3 } )" }, { - "free-cell", + "black-hole", R"( { "tableau piles": { - "build policy": "red-black" + "count": 17, + "build order": "no-build" }, - "cells": 4 + "hole": true, + "foundations": false } )" }, { - "simple-free-cell", + "simple-black-hole", R"( { "tableau piles": { "count": 4, - "build policy": "red-black" + "build order": "no-build" }, - "max rank": 4, - "cells": 1 + "max rank": 5, + "hole": true, + "foundations": false } )" diff --git a/src/test/bakers_dozen_test.cpp b/src/test/bakers_dozen_test.cpp new file mode 100644 index 0000000..8973a53 --- /dev/null +++ b/src/test/bakers_dozen_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/bakers_dozen/ComplexSolvable.json b/src/test/resources/bakers_dozen/ComplexSolvable.json new file mode 100644 index 0000000..c48ce47 --- /dev/null +++ b/src/test/resources/bakers_dozen/ComplexSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "AH"], + ["AD", "2D", "2H"], + ["2C", "AC"] + ] +} diff --git a/src/test/resources/bakers_dozen/ComplexUnsolvable.json b/src/test/resources/bakers_dozen/ComplexUnsolvable.json new file mode 100644 index 0000000..ba9be59 --- /dev/null +++ b/src/test/resources/bakers_dozen/ComplexUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "AH"], + ["AD", "2D", "2H"], + ["AC", "2C"] + ] +} diff --git a/src/test/resources/bakers_dozen/SimpleSolvable.json b/src/test/resources/bakers_dozen/SimpleSolvable.json new file mode 100644 index 0000000..eacad0e --- /dev/null +++ b/src/test/resources/bakers_dozen/SimpleSolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["2S", "AS", "AD"], + ["2D", "2H", "AH"], + ["2C", "AC"] + ] +} diff --git a/src/test/resources/bakers_dozen/SimpleUnsolvable.json b/src/test/resources/bakers_dozen/SimpleUnsolvable.json new file mode 100644 index 0000000..99a3140 --- /dev/null +++ b/src/test/resources/bakers_dozen/SimpleUnsolvable.json @@ -0,0 +1,7 @@ +{ + "tableau piles": [ + ["AS", "2S", "2D"], + ["AD", "AH", "2H"], + ["AC", "2C"] + ] +} |
