summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Anderson <jandew+dev@gmail.com>2016-02-23 18:52:19 -0800
committerJoe Anderson <jandew+dev@gmail.com>2016-02-23 18:53:45 -0800
commit7403b36992547841851e2ed405a5500a82416919 (patch)
tree8186be37117f9dc0a6f8f5a380d158d65be68c07
parent2b8ae2b1e120f7ee2b65f901b29d458c792840b8 (diff)
downloadoo-7403b36992547841851e2ed405a5500a82416919.tar.gz
oo-7403b36992547841851e2ed405a5500a82416919.zip
plans for a go module
-rw-r--r--TODO40
-rw-r--r--oo.py29
2 files changed, 69 insertions, 0 deletions
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..24b5fa6
--- /dev/null
+++ b/TODO
@@ -0,0 +1,40 @@
+ Python
+========
+
+* Receieve menu input while text is scrolling,
+ rather than having to interrupt with spacebar first.
+
+* Make a way to save and load games.
+
+* Make extra hard puzzle generation fast.
+
+* After porting ooStudy into Go,
+ collect data through python. Particularly:
+
+ - Consider fully-inverted puzzles as equivalent.
+
+ - Consider translated toroidal puzzles as equivalent.
+
+ - How many different n by m puzzles are there?
+
+ - What correlations are there between puzzle piece composition
+ and the number of possible solutions?
+
+
+ Go
+========
+
+* Port ooStudy into Go.
+ Implementation should have a bare-bones ooPuzzle with:
+
+ - ooPuzzle.__init__
+
+ - ooPuzzle.set_pieces_from_game_id
+
+ - ooPuzzle.set_pieces_from_edges
+
+ Start with the toroidal implementation,
+ then do the normal boundary,
+ then implement no boundary -- that is,
+ the boundary is not logically parsed at all.
+
diff --git a/oo.py b/oo.py
index c8a6444..d9a153e 100644
--- a/oo.py
+++ b/oo.py
@@ -876,6 +876,35 @@ class ooPlay:
elif self.xpos < self.max_xpos:
self.xpos += 1
+class ooStudy():
+ """Studies oo puzzles of a particular size.
+
+ This class is not intended to be used. It is far too slow.
+ Instead, it is intended to be ported to a faster language.
+ """
+
+ def __init__(self, X, Y, toroidal=False):
+ self.X = X
+ self.Y = Y
+ self.toroidal = toroidal
+ self.puzzles = []
+
+ def __call__(self):
+ """Study each possible game id."""
+ X = self.X
+ Y = self.Y
+ if self.toroidal: upper_bound = 2**( 2*X*Y )
+ else: upper_bound = 2**( (X-1)*Y + X*(Y-1) )
+ for game_id in range(upper_bound):
+ new_puzzle = ooPuzzle(X, Y,
+ game_id=game_id, toroidal=self.toroidal)
+ for puzzle in self.puzzles:
+ if puzzle.pieces == new_puzzle.pieces:
+ puzzle.equivalent_ids.append(game_id)
+ return
+ new_puzzle.equivalent_ids = []
+ self.puzzles.append(new_puzzle)
+
def main():
curses.wrapper(ooPlay)