GithubHelp home page GithubHelp logo

bridgepuzzle's Introduction

BridgePuzzle

Python program for solving a Bridge Puzzle (Hashiwokakero)

Files included:

  • BridgeObjects.py -> The python file with the classes to solve a bridge puzzle
  • test.csv -> A test puzzle as well as an example of how to fill out the puzzle
  • Output.csv -> The solution to test.csv as solved by the program and confirmed by the source of the puzzle (Linkdoku iPhone app)

The file named BridgeObjects.py contains the three classes Node, Edge, BridgePuzzle that make up this type of puzzle. The BridgePuzzle class performs the main functionality

To solve one of these puzzles using this file, do the following:

  • Create a csv file in the same directory as BridgeObjects.py
    • In this csv file, fill all locations with 0
    • Where there are nodes in the puzzle, place the number of connections that may be made to that node
  • Import the BridgeObjects.py file
  • Create a BridgePuzzle object with the file name of your previous csv as an input ( puzzle = BridgePuzzle("test.csv") )
    • Alternatively, you can do the following:
      • Create a BridgePuzzle object ( puzzle = BridgePuzzle() )
      • Call the read_file function ( puzzle.read_file("test.csv") )
      • Call the solve function ( puzzle.solve() ) where you may provide a file name to output the solved puzzle to. If no file name is specified, the solution will be written to Output.csv in the same directory as the python file
  • The output will be written to a csv file in the same directory as the python file with the name Output.csv
    • To best read this file, I recommend centering the alignment in all cells and shrinking the cell sizes to just what is necessary to display the solved puzzle

bridgepuzzle's People

Contributors

nvanalfen avatar

Watchers

 avatar

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.