GithubHelp home page GithubHelp logo

h-reversi's People

Contributors

fxdpntthm avatar

Stargazers

 avatar

Watchers

 avatar

h-reversi's Issues

End Game

End the game when no one can make a move, show the winner

How do you identify no moves are possible?

  • find empty squares
  • check if either of the discs can be placed legally

wrong disc is flipped

fromList [((-2,-1),White),((-1,-1),White),((-1,0),White),((0,-2),Black),((0,-1),White),((0,0),White),((0,1),White),((1,-3),Black),((1,-1),White),((2,-2),Black),((2,-1),Black),((2,0),White),((3,-1),Black)]

"waiting for turn: Black"
13
Just (-2,0)

fromList [((-2,-1),White),((-2,0),Black),((-1,-1),Black),((-1,0),Black),((0,-2),Black),((0,-1),White),((0,0),White),((0,1),White),((1,-3),Black),((1,-1),White),((2,-2),Black),((2,-1),Black),((2,0),White),((3,-1),Black)]

(-1,0) disc illegally flipped

Write quick check tests

How do I generate valid board configurations?
What are the properties of valid board configurations?

  1. property after every move, total number of discs is increased only by one
  2. increase in White == decrease in black + 1
  3. increase in Black == decrease in white + 1

Not all discs are flipped

fromList [((-2,-2),Black),((-2,-1),Black),((-2,0),Black),((-1,-1),Black),((-1,0),Black),((0,-1),White),((0,0),Black),((0,1),White),((1,1),White),((2,1),White)]

"waiting for turn: White"
10
Just (-3,-3)

fromList [((-3,-3),White),((-2,-2),White),((-2,-1),Black),((-2,0),Black),((-1,-1),Black),((-1,0),Black),((0,-1),White),((0,0),Black),((0,1),White),((1,1),White),((2,1),White)]

Fix the error where discs magically appear

initial state:

fromList [((-1,-1),Black),((-1,0),White),((0,-1),White),((0,0),Black),((0,1),White),((1,1),Black)]

"waiting for turn: White"
6
White plays Just (2,1)

fromList [((-1,-1),Black),((-1,0),White),((0,-1),White),((0,0),Black),((0,1),White),((1,0),White),((1,1),White),((2,1),White)]

initial state

fromList [((-3,2),Black),((-2,0),White),((-2,1),Black),((-1,-1),Black),((-1,0),White),((-1,1),White),((0,-1),Black),((0,0),White),((0,1),White),((1,-2),Black),((1,-1),White),((1,1),Black),((2,-3),Black),((2,-2),Black),((2,-1),White),((3,-3),White),((3,-2),White),((3,-1),White)]

black plays (-1,2)

fromList [((-3,2),Black),((-2,0),White),((-2,1),Black),((-2,2),Black),((-1,-1),Black),((-1,0),Black),((-1,1),Black),((-1,2),Black),((0,-1),Black),((0,0),White),((0,1),White),((1,-2),Black),((1,-1),White),((1,1),Black),((2,-3),Black),((2,-2),Black),((2,-1),White),((3,-3),White),((3,-2),White),((3,-1),White)] "waiting for turn: White"
20

(-2,2) Black appears magically

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.