Giter Site home page Giter Site logo

chess-elm's People

Contributors

nelsonic avatar robstallion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jgrenat kutyel

chess-elm's Issues

Focus on UI (What People See)

@RobStallion I'm really excited to see the progress on this project and feel that it's a really good showcase of both your Elm and critical reasoning skills! I would add it to your CV as a "spare time learning" project. Hiring/Engineering/HR Managers want to see that you are learning new skills in your own time not just "on the clock" ... it's a massive differentiator between you and your less proactive peers.

At present a person viewing your GH profile, sees only one thing:
image

But when they click to view the repo, it's kinda bare: https://github.com/RobStallion/chess-elm
image

If it is your only showcased repo on your profile, I would highly recommend that you make it a showcase of your skills. You touched upon this fact in #2 but have instead dived into figuring out the Pawn moving algo. (I can see the appeal of diving into solving one of the challenges rather than documenting it ... but you must demonstrate Document-Driven Development if you want to show that skill to an observer...)

You don't need to have a fully formed UI, you can borrow one from https://chessui.com
image

Just having a chess board in your readme is a night-and-day difference from a blank one.

And with a bit of photoshop ("smoke and mirrors") you can illustrate the issue #1 you are currently working on; "available moves for king's pawn on home square with no obstructions":
chess-board-initial-state

Ultimately "as a reader" of our GH profile I want to be "wowed" by what you've been working on. πŸ˜‰

Create logic that will allow "en passant" captures

Need to create the logic that will allow "en passant" captures.

For this I will need to have something in the state that stores whether or if a pawns last move was a "two tile move" (I don't think that there is a name for this. If there is please comment with it πŸ‘)

This will probably be best stored in each pawn.

At the moment the a piece is made up of the following...

type alias Piece =
    { pieceType : PieceType
    , team : Team
    , status : PieceStatus
    }


type PieceType
    = King
    | Queen
    | Rook
    | Bishop
    | Knight
    | Pawn

The PieceType type is currently fairly simple. If I am going to store if a pawn is able to be captured "en passant" in each pawn I am likely going to have to update the PieceType Pawn.

Epic: Backend?

Story (Epic)

As a person that plays IRL chess and wants to play remote chess
I need a way of saving the moves made in the game,
so that my remote partner/opponent can see them and make their next move!

I know this is on your mental list, but it's something someone else might be able to help with,
so capturing it in an issue means the requirement(s) can be discussed and progress made ... πŸ˜‰

Proposed Schema (MVP)

  • players

  • sessions (for authentication ... could just use https://github.com/dwyl/auth if it was ready ...? πŸ€”)

  • games

    • id: int (PK)
    • inserted_at: timestamp
    • white: int (player_id FK)
    • black (player_id)
  • moves

    • id: int (PK)
    • inserted_at: timestamp
    • game_id: int (FK)
    • move: string

    Would you store just the "move" e.g: "Bb5" or the complete board on each move (FEN) ?

  • Authentication using:

    • Email & Password - the most basic auth possible just to have game ownership.

Open Questions

  • Attempt to build your own backed from scratch as a learning exercise or use python-chess ?
  • Is the objective to allow human players to play remotely (i.e. we only need to record moves so they can be stored, transmitted and displayed in the interface) OR is the objective to be able to parse the available game datasets in order to suggest the statistically strongest move #10 ? e.g:
  • Anything else required before the MVP backend can be started?

Example of game using Algebraic Notation:
https://www.chess.com/article/view/magnus-carlsen-s-biggest-secret

image

References

In drafting a (suggested) schema to store moves in a game, I consulted the following SO Q/A:

club soda testing

putting this issue here as I didn't want to clutter the cs repo. Can copy over afterwards if needed

Create a way to move pieces

relates to #10

Steps

  • create a new Msg type that will send the selected Piece and tileIndex to update
  • write function that will be used in update that will take the Piece, tileIndexandmodel.board` and will return an updated board

I am not going to allow captures at this point or worry about move order. They will come later.

When a king is in check do not allow illegal moves

Need to create logic that checks if a king is in check.

If so it restricts the possible moves that other pieces can make so that it only allows moves that either:

  • block the check
  • capture the piece giving check
  • move the king out of check

Refactor moves file

Spend some time to see if move file can be refactored. Seemed to be a lot of duplication first time round.

Track previous move

Keep track of the previous move.

Acceptance Criteria

  • Add previousMove to the model
  • Have previousMove take a tuple of Piece, previousIndex and newIndex.

Relates to #26

Create a function that returns a list of available pawn moves

  • Create a function that checks the available moves a pawn can make.
    • will need to take a tile and return a list of indexes that the pawn can move to
    • will need to use piece colour to filter moves that a pawn can make (black pawns move in negative numbers. White pawns move in positive numbers)
    • Will need to turn the list of pawn moves into a list of tile indexes that a pawn can move to.
    • will need to filter out indexes that are out of bounds
    • if pawn is on home square allow pawn to move two tiles forward (keep pawn index + 20 in the list of int else remove it)
    • Is a piece blocking the pawns way? if so remove tile from list (also remove tiles after the tile that is blocked. e.g. if pawn is on b2(22) and wants to move to b4(42) but there is a piece on b3(32), remove both b3 and b4 as options)
    • is there an opponent piece on tiles 9/11 in front or behind the current tile a pawn is on. If so allow pawn to move there and replace(capture) that piece. If the piece is a same team just remove the tile.
Edits View issue history
Edit Count View History: http://localhost:4000/issues/387354004

Display possible moves on the board

Displaying the possible moves on the board.

Idea of what it could look like taken from @nelsonic 's comment in #9
chess-board-initial-state

Decide what action causes possible moves to display

  • Do they appear on a mousedown (and disappear on mouseup)?
  • Do they appear on mouseclick and stay onscreen until another mouseclick happens?

Do you need elm-live?

At the moment the Readme say to type the following command to run the project

elm-live src/Main.elm --open --dir=public -- --output=public/js/elm.js --debug

However I was too lazy to found out how to install elm-live 😟 . I would suggest to make the demo of the project as easy/smooth as possible if you want people to play or contribute with elm-chess

elm-live looks like a good tool when developing:

A flexible dev server for Elm
Live reload included!

Maybe you could create a section "How to contribute" which explain how to run the project for development (learn elm at http://github.com/dwyl/learn-elm/, install elm-live with npm, ...).

And another section "Play now" which explain how to directly run the latest compiled version of the game (you'll need to run elm make each time a PR is merged into master maybe). And the best solution would be to host elm-chess on a Github page for example (or Heroku). I've done something like this for the elm-criteria package

Project looks nice otherwise πŸŽ‰

Time management

Test time management apps so I can learn to manage my time more effectively.

Desired outcomes

I would first like to be able to EASILY identify how much time I spend doing 'anything' in a given amount of time

How much time I spend cooking in a day, how much time I spend replying to issues in a working week, how much time I spend watching TV in a month, how much time I work on personal projects, etc...

Easily is KEY!!!!!!!!!!!!!!!!!!!!!!!!!!!!! to this. I NEED to be able to do this with minimal effort. So little effort that I don't even think about it otherwise I won't want to do it.

My hope is that this will allow me to easily 'rank' the things I have done in an amount of time (day, week, month).

The reason I want to rank my tasks is so that I can focus on things that are more important.

There are things that are important, for example seeing friends, but I do not want to do that everyday for 5 hours a day. I also think personal 'unwinding' time is important (watching tv, playing ps etc...) but are these things taking up too much time and stopping me from doing other things I want to achieve, like BUILDING THIS APP?

Toggl

Going to use this app first and see what I think of it. Will capture my thoughts in this issue.

Store current game state in local storage

Need to create a way to store current game state in local storage. Do not want games "lost" because of a browser refresh.

If local storage has a game state saved when a users comes to the site then they will be able to pick up where they left off

Stretch goals

  • add buttons to save a game state
  • allow multiple game states to be saved
  • have a clear/delete game option

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.