Giter Site home page Giter Site logo

apolishch / dreamteam Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 696 KB

A two player chess game, written in Rails and deployed to Heroku

Home Page: https://dreamteam-chess.herokuapp.com

Ruby 74.79% JavaScript 0.76% CSS 1.78% HTML 22.43% CoffeeScript 0.25%

dreamteam's People

Contributors

apolishch avatar charlietyler avatar hanshank avatar mahoneyj02 avatar zacjones93 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hanshank

dreamteam's Issues

Capture Logic

On the ChessPiece Model, add a check for whether the target location for movement is occupied (add a move_to! method if necessary)

If there is a piece occypying the location, and that piece has the opposite color, remove it from the game.

There are a few ways to do this:

  • You could have a status on the pieces (e.g. onboard vs captured)
  • you could se the x/y coordinates to nil
  • You could point blank delete the piece from the database

If the piece occupying the target location shares the color of the moving piece, the move should fail.

Build a valid_move? method on the King

  • If the move takes the king off the board, return false
  • If the move is_obstructed?, return false
  • If the move is more than one in any direction, return false
  • Otherwise, return true

build valid_move? for pawn

A pawn can move two squares if it is it's first move.
A pawn can NOT capture vertically
A pawn can only capture diagonally
This story includes En passant

Populate the board

  • On game creation, assign 32 pieces to the game with correct locations etc.
  • On the board, render them in their correct starting locations. E.g. render with letters...

Game creation UI

-[] On the home screen there should be a button, something like create game. The one that creates it should be assigned as the white player.

Extend Castling

can_castle? should also verify if the king is in check,
if the king would be in check at the resulting position, or at any position between start and finish

Support moving pieces

  • Each piece that is drawn on the board will be a link. The link should point at: GET /pieces/:id
  • The pieces#show method should rerender the board, highlighting the selected piece
  • Once a piece is selected, each square should be a PUT /pieces/:id, passing x and y on the params
  • This should call the update action which should trigger @piece.update_attributes

Allow players to forfeit

Create a method which ends the game, and sets a winner and loser.

Create a button somewhere in the UI which connects to the forfeit method, and ends the game, with the person who pressed it being the loser.

When the other player next refreshes the page, they should be notified of their glorious victory

Setup CD

  • Pick a provider (CircleCI/TravisCI/CodeShip/Jenkins......)
  • Wire up said CD provider to run tests on every commit
  • Wire up said CD provider to also run migrations before tests
  • Wire up said CD provider to run tests on merges to master, and then push to heroku
  • Wire up said CD provider, to display build status on pull requests

Plan out Database model

  • Try and come up with the easiest way to model a normal chessgame.
  • Don't worry about things that are way in the future (e.g. ELO calculations, or stalemate tracking)
    Model movement, pieces, games, victory, positions
  • Bring this one up for discussion, talk to Abe as well
  • Just use Excel/Google Sheets or whatever similar tool you want

Setup Testing Environment

  • Pick a testing framework (RSpec and Minitest)
  • Setup FactoryGirl
  • Setup Capybara
  • Write a single passing test. expect(true).to be(true) is perfectly fine

Password reset

-[] Add a link on login screen which. Send out an email which links to a page where you can enter a new password etc.

Setup Single Table Inheritance for Pieces

There should probably be a ChessPiece Super class,
Pawn, Knight, Bishop, Rook, Queen, King subclasses.
This should (somehow (look at resources)) be encoded at the database level

Setup Devise

  • Install Gem
  • Configure to interact with users table, create migrations as necessary

is_obstructed? method on piece

  • Write a method on the piece model which should accept an x/y coordinate, and return true if there is another piece between the pieces current coordinates and the target x/y

Introduce Checkmate

If the game is in Check, and no possible move exists which removes Check Game ends, person in Checkmate loses

Allow joining a game

  • On the list of available games, add a join button (to each game). This button should make player join as the color black.

Support Castling

If the king and the corresponding rook have no been move, castling should be possible.

Cannot castle through obstruction.

Add a method called can_castle?(rook_position) which should return a boolean.

It should verify if the king or the rook have moved, and if there are any obstructions.

Build Turn basedlogic

  • Keep track of whose turn it is currently
  • After every move, if the move is(was?) valid, change the turn taker
  • Only allow the person who'se turn it is to affect the board in any way.
  • In the UI, indicate somewhere who'se turn it is

Determine Check

  • Add a method on the Game Model, which establishes where the current state of the game is "check"

This is explicitly NOT checkmate

Create Wireframe

Run past team, bring to discussion.
There are loads of tools you could use for this. Loads of designers I know swear by Balsamiq

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.