From 7403b36992547841851e2ed405a5500a82416919 Mon Sep 17 00:00:00 2001 From: Joe Anderson Date: Tue, 23 Feb 2016 18:52:19 -0800 Subject: plans for a go module --- TODO | 40 ++++++++++++++++++++++++++++++++++++++++ oo.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 TODO 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) -- cgit v1.2.3-54-g00ecf