GithubHelp home page GithubHelp logo

pzudoku's People

Contributors

pzahemszky avatar

Watchers

 avatar

pzudoku's Issues

Replace python setup.py test with something else

setuptools gives a warning that python setup.py test will be removed. It should be replaced with something else, e.g. something like python -m unittest discover. See the logs e.g. on Cirrus CI.

coverage run setup.py test
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.

Create new attributes

  • 1. filled_in, the number of filled in squares on the board (e.g. a property calculated from empties)
  • 2. ndigits, the number of unique digits the board has so far
  • 3. has_clash and its first occurence
  • 4. has_unique_soln
  • 5. has_multi_soln (probably hard to calculate)

Add a to_array() method

Add a public to_array() method to the HB6DBoard class, that would be the equivalent of the from_array() function.

`OperationQueue` object should be class-level

One reason for this is that during from_str (and the recursive solve call) some operations are supposed to be deleted from the queue.
Also, move operations.remove_rearrange inside the _add function.

`python3` fails on FreeBSD 11.1

In the most recent PR #69 the python3 -m ensurepip --default-pip command fails on FreeBSD 11.1 platform. Strangely enough, it succeeds on versions 10.4, 11.2, and 12.0.

Shared object "libdl.so.1" not found, required by "python3"

See the full log here.

Unfortunately, pkg install py3-pip doesn't solve this issue, because that results in a "No packages available" error message (on all versions, not just 11.1).

Edit: this has probably little to do with ensurepip. It might be a problem with the python3 installation.

Use other N-D array type

Explore the possibility of using other multi-dimensional arrays (instead of NumPy ndarrays), and extract an abstract base class (e.g. Core6DArray) purely for storing the underlying boolean data.

For example,

  • memoryview on a 1-D array / bytearray (so that strides, 1-D slicing and multi-dimensional indexing are implemented), or
  • nested lists / dicts / OrderedDicts (with custom-built slicing and multi-dimensional indexing).

This way the code would not dependent on NumPy.

Consider more options in `_first_empty_square`

For example an empty candidate being _dig_row instead of _row_col (=cell), i.e. a (digit, row) pair that has more than one possible columns where the digit is still a candidate.

Think of it as "projecting" board along the first dimension to find empty cells, and along other dimensions to find the other options.

Separate primary and secondary peers

There could be a simple two-level hierarchy between peers: those operations that are more likely to be successful after _add(dig, row, col) should be placed in front of the secondary operations in the queue of remove_rearrange.

In particular, for the triple (dig, row, col) and corresponding row_slice and col_slice objects the below operations should be prioritised before any of the other ones.

  • Operation('digcol', dig, c), if c is within col_slice
  • Operation('digrow', dig, r), if r is within row_slice
  • Operation('digbox', dig, b), if b intersects with row or col

Create different type of puzzles for testing

  • 1. filled, without clash
  • 2. filled, with clash
  • 3. not filled, with immediate clash (=no solution)
  • 4. not filled, with hidden clash (=no solution)
  • 5. not filled, no clash, unique solution
  • 6. not filled, no clash, multiple solutions
  • 7. various recursion depths

  • normal 3x3
  • other square boxed, e.g. 2x2
  • rectangular box
  • 4x4 (from newspapers)

Add OS specific badges for build status

Currently there's a single badge showing the build status.

It would be good to have one for each platform.

This might require the introduction of new CI tools.

Add memory efficient version

In addition to a fast version, where every possible thing is stored, it would be nice to have an alternative implementation that's the least memory heavy (but also slower).

Handle KeyboardInterrupt during solution

Would be really nice to retrieve the newly filled in squares even if the user terminates the solution halfway through the process.

This functionality might be very hard to test (non-manually).

Finish quickfill exactly when needed

Record the first requeued operation since the beginning / the last _add call, then check for equality with the current operation. Finish the loop when the operation reoccurs.

Remove string literals related to `Operation.inspects`

Replace them with global(?) variables, so that renaming is easy (e.g. with and IDE).
For example, use SQUARE, DIGIT_ROW, DIGIT_COLUMN, DIGIT_BOX, referring to the string literals 'square', 'digrow', 'digcol', 'digbox'.

Separate `_recursively_solve` method from `solve`

The solve method should call _recursive_solve, and additionally print/record things afterwards (e.g. regarding depth of recursion, whether a clash has been found, etc). Hence _recursive_solve should not have any side effects.

Make the errors more user-friendly in the from_str() method

Currently one gets this traceback when typing board = Board(1, 2); board.from_str('1234').

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/local/lib/python3.6/unittest/case.py", line 605, in run
    testMethod()
  File "/home/zpeti/sudoku/tests/test_board.py", line 364, in test_solve_filled_1x1_with_clash
    board.from_str('1234')
  File "/home/zpeti/sudoku/board.py", line 222, in from_str
    char = characters[i]
IndexError: string index out of range

There should be an error for not enough number of squares (arising from the dropping of out-of-bounds digits in the input string).

Add the HB6DBoard class

Add a class similar to the current Board, but with 5D 6D boolean hyper-rectangle array as the underlying data structure.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.