Giter Club home page Giter Club logo

learning-go's Introduction

Learning-Go

I decided to learn Golang by creating a solver for the Cracker Barrel Peg Game

Cracker Barrel Peg Game

Running

From the Root Directory, run the following command:

go run main.go

You will be prompted to enter a 15 letter string of the characters 0 and 1; 0 means empty, 1 means there is a peg. The 15 character stream maps to the Cracker Barrel Triangle like this:

        [ 0]
      [ 1] [ 2]
    [ 3] [ 4] [ 5]
  [ 6] [ 7] [ 8] [ 9]
[10] [11] [12] [13] [14]

Enter the 15 characters of the board you would like solved:

josephnormandev/Learning-Go~$ go run main.go
Enter a Board: (15 characters long)
...............
111100110111111

Then press enter!

Results

The results for this board are pretty interesting; it leaves two pegs on opposite ends of the board. Weird!

* is a peg, - is an empty slot. Round 0 is the starting state of the board from your input string.

Results........
Round: 0
    *
   * *
  * - -
 * * - *
* * * * *

Round: 1
    *
   * *
  * * -
 * - - *
* - * * *

Round: 2
    -
   * -
  * * *
 * - - *
* - * * *

Round: 3
    *
   - -
  - * *
 * - - *
* - * * *

Round: 4
    *
   - *
  - * -
 * - - -
* - * * *

Round: 5
    *
   - *
  * * -
 - - - -
- - * * *

Round: 6
    *
   - -
  * - -
 - * - -
- - * * *

Round: 7
    *
   - -
  * - -
 - * - -
- * - - *

Round: 8
    *
   - -
  - - -
 - - - -
- * * - *

Round: 9
    *
   - -
  - - -
 - - - -
- - - * *

Round: 10
    *
   - -
  - - -
 - - - -
- - * - -

learning-go's People

Contributors

jnorman-us avatar

Watchers

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