Giter Site home page Giter Site logo

solving-sudoku's Introduction

Writing a Sudoku Solver

Sudoku is a puzzle game with one rule: Each row, column, and section can contain only 1 of a given number.

Step 1: Program Yourself

Take ~5 minutes and play a game. Notice the steps you take as you work through it. Then, in 40 words or less, outline a "program" telling you how to solve sudoku.

Consider:

  • What questions do you ask while working through the puzzle?
  • What do you do over and over again?

As a person, it's easy to follow high level instructions like "if the column, row or section has a 5 disqualify it as a possible value."

Computers, on the other hand, need more detailed (low-level) instructions. The ability to break down high level instructions to lower level instructions is one of the most useful skills of being a programmer.

Take a monent to flesh out your outline to include more detail.

Think about:

  • What data is needed in which parts of the outline?
  • Are there any branches of the outline which are independent of other parts?
  • Which parts of the outline had surprisingly more (or less) instructions behind an "obvious-to-human" instruction?

Step 2: Program The Computer

Now that you have a rough draft it's time to start translating this into true-blue code.

open sudoku.rb in sublime, and start converting your outline into code. Run ruby sudoku.rb frequently to see how close you're getting.

solving-sudoku's People

Contributors

zspencer 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.