summaryrefslogtreecommitdiff
path: root/quackleio/iotest
diff options
context:
space:
mode:
Diffstat (limited to 'quackleio/iotest')
-rw-r--r--quackleio/iotest/.gitignore6
-rw-r--r--quackleio/iotest/capp.gcg34
-rw-r--r--quackleio/iotest/iotest.cpp78
-rw-r--r--quackleio/iotest/iotest.pro29
-rw-r--r--quackleio/iotest/trademarkedboards.cpp148
-rw-r--r--quackleio/iotest/trademarkedboards.h40
6 files changed, 335 insertions, 0 deletions
diff --git a/quackleio/iotest/.gitignore b/quackleio/iotest/.gitignore
new file mode 100644
index 0000000..f878785
--- /dev/null
+++ b/quackleio/iotest/.gitignore
@@ -0,0 +1,6 @@
+Makefile
+obj
+Makefile.Debug
+Makefile.Release
+debug
+release
diff --git a/quackleio/iotest/capp.gcg b/quackleio/iotest/capp.gcg
new file mode 100644
index 0000000..7c1a05c
--- /dev/null
+++ b/quackleio/iotest/capp.gcg
@@ -0,0 +1,34 @@
+#player1 Brian Brian Cappelletto
+#player2 Pakorn Pakorn Nemitrmansuk
+#title WSC 2001 Round 20: Brian Cappelletto vs. Pakorn Nemitrmansuk
+#description WSC 2001 Round 20: Brian Cappelletto vs. Pakorn Nemitrmansuk at Table 1
+#style wsc2001
+#incomplete
+>Brian: CNNTU?? 8b NoCTUrN +70 70
+>Pakorn: AFFIABE e8 TAFFIA +24 24
+>Brian: EEETVVY 12d VIVE +20 90
+>Pakorn: BEWWLYB 11g WEBBY +35 59
+>Brian: AEEETTY f8 UEY +32 122
+>Pakorn: LWGRAKE h10 WERGEL +45 104
+>Pakorn: LWGRAKE -- +0 59
+>Brian: AAEERTT b7 ANTEATER +70 192
+>Pakorn: LWGRAKE 7a KAW +22 81
+>Brian: NOPUUUX 13g XU +38 230
+>Pakorn: LEGGARI h2 REGALING +62 143
+>Brian: NOOPRRU a12 UPON +30 260
+>Pakorn: PHOLASR c13 HAP +35 178
+>Brian: EEMORSU 4h GRUESOME +74 334
+>Brian: ACDEJOQ (challenge) +5 339
+>Pakorn: DILTORS j1 DILUTORS +63 241
+>Brian: ACDEJOQ o1 JADE +36 375
+>Pakorn: ZSIDTLO m3 ZOOID +34 275
+>Brian: DEECOOQ n2 DEMO +35 410
+>Pakorn: NIRISTL 14h NITRILS +70 345
+>Brian: ACEHOOQ g1 OOH +21 431
+>Pakorn: SMORING 6m ISM +17 362
+>Brian: AACEENQ o6 MAC +21 452
+>Pakorn: LIGROIN h13 UNI +9 371
+>Brian: AEEINQT n11 QATS +13 465
+>Pakorn: LIGRONE o10 LIG +22 393
+>Brian: EEIN l7 EINE +8 473
+>Brian: (ENOR) +8 481
diff --git a/quackleio/iotest/iotest.cpp b/quackleio/iotest/iotest.cpp
new file mode 100644
index 0000000..87d167d
--- /dev/null
+++ b/quackleio/iotest/iotest.cpp
@@ -0,0 +1,78 @@
+/*
+ * Quackle -- Crossword game artificial intelligence and analysis tool
+ * Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <QtCore>
+
+#include "datamanager.h"
+#include "game.h"
+#include "gcgio.h"
+#include "trademarkedboards.h"
+
+void testGCGIO();
+
+int main()
+{
+ Quackle::DataManager dataManager;
+ dataManager.setBoardParameters(new ScrabbleBoard());
+
+ testGCGIO();
+ return 0;
+}
+
+void testGCGIO()
+{
+ QuackleIO::GCGIO io;
+ QFile file("capp.gcg");
+
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ {
+ cerr << "Could not open gcg" << endl;
+ return;
+ }
+
+ QTextStream in(&file);
+
+ Quackle::Game *game = io.read(in, QuackleIO::Logania::BasicLoad);
+ UVcout << game->history() << endl;
+
+ UVcout << "Final scores: " << endl;
+ Quackle::PlayerList players = game->currentPosition().endgameAdjustedScores();
+ const Quackle::PlayerList::const_iterator end(players.end());
+ for (Quackle::PlayerList::const_iterator it = players.begin(); it != end; ++it)
+ UVcout << *it << endl;
+
+ file.close();
+
+ QFile outFile("my-capp.gcg");
+
+ if (!outFile.open(QIODevice::WriteOnly | QIODevice::Text))
+ {
+ cerr << "Could not open gcg output file" << endl;
+ return;
+ }
+
+ QTextStream out(&outFile);
+ io.write(*game, out);
+
+ outFile.close();
+
+ delete game;
+}
+
diff --git a/quackleio/iotest/iotest.pro b/quackleio/iotest/iotest.pro
new file mode 100644
index 0000000..8550691
--- /dev/null
+++ b/quackleio/iotest/iotest.pro
@@ -0,0 +1,29 @@
+TEMPLATE = app
+DEPENDPATH += .
+INCLUDEPATH += . .. ../..
+
+# enable/disable debug symbols
+#CONFIG += debug
+
+debug {
+ OBJECTS_DIR = obj/debug
+ win32 { LIBS += -L../debug -L../../debug }
+}
+
+release {
+ OBJECTS_DIR = obj/release
+ win32 { LIBS += -L../release -L../../release }
+}
+
+LIBS += -L.. -L../.. -lquackle -lquackleio
+
+# Input
+HEADERS += trademarkedboards.h
+SOURCES += iotest.cpp trademarkedboards.cpp
+
+win32:!win32-g++ {
+ QMAKE_CFLAGS_DEBUG ~= s/-MDd/-MTd/
+ QMAKE_CXXFLAGS_DEBUG ~= s/-MDd/-MTd/
+ QMAKE_CFLAGS_RELEASE ~= s/-MD/-MT/
+ QMAKE_CXXFLAGS_RELEASE ~= s/-MD/-MT/
+}
diff --git a/quackleio/iotest/trademarkedboards.cpp b/quackleio/iotest/trademarkedboards.cpp
new file mode 100644
index 0000000..b9eb37c
--- /dev/null
+++ b/quackleio/iotest/trademarkedboards.cpp
@@ -0,0 +1,148 @@
+/*
+ * Quackle -- Crossword game artificial intelligence and analysis tool
+ * Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include "trademarkedboards.h"
+
+ScrabbleBoard::ScrabbleBoard()
+{
+ m_name = MARK_UV("Scrabble Board");
+
+ const int letterm[15][15] =
+ {
+ // A B C D E F G H I J K L M N O
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1},
+ {1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1},
+ {2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1},
+ {1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1},
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1},
+ {1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1},
+ {1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2},
+ {1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1},
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}
+ };
+
+ const int wordm[15][15] =
+ {
+ // A B C D E F G H I J K L M N O
+ {3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3},
+ {1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1},
+ {1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1},
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1},
+ {1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 3},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1},
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1},
+ {1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1},
+ {1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1},
+ {3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3}
+ };
+
+ for (int i = 0; i < 15; ++i)
+ {
+ for (int j = 0; j < 15; ++j)
+ {
+ m_letterMultipliers[i][j] = letterm[i][j];
+ m_wordMultipliers[i][j] = wordm[i][j];
+ }
+ }
+}
+
+//////
+
+SuperScrabbleBoard::SuperScrabbleBoard()
+{
+ m_height = 21;
+ m_width = 21;
+
+ m_startRow = 10;
+ m_startColumn = 10;
+
+ m_name = MARK_UV("Super Scrabble Board");
+
+ const int letterm[21][21] =
+ {
+ // A B C D E F G H I J K L M N O P Q R S T U
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1},
+ {1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1},
+ {2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2},
+ {1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1},
+ {1, 1, 4, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1},
+ {1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1},
+ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1},
+ {2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2},
+ {1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1},
+ {1, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 3, 1, 1, 1, 1},
+ {1, 1, 1, 1, 1, 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];
+ }
+ }
+}
diff --git a/quackleio/iotest/trademarkedboards.h b/quackleio/iotest/trademarkedboards.h
new file mode 100644
index 0000000..f596c8f
--- /dev/null
+++ b/quackleio/iotest/trademarkedboards.h
@@ -0,0 +1,40 @@
+/*
+ * Quackle -- Crossword game artificial intelligence and analysis tool
+ * Copyright (C) 2005-2006 Jason Katz-Brown and John O'Laughlin.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef QUACKLE_TRADEMARKEDBOARDS_H
+#define QUACKLE_TRADEMARKEDBOARDS_H
+
+#include "boardparameters.h"
+
+// Name: Scrabble Board
+class ScrabbleBoard : public Quackle::BoardParameters
+{
+public:
+ ScrabbleBoard();
+};
+
+// Name: Super Scrabble Board
+class SuperScrabbleBoard : public Quackle::BoardParameters
+{
+public:
+ SuperScrabbleBoard();
+};
+
+#endif