Giter Site home page Giter Site logo

just-chess's Introduction

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Made With Bulma GitterPRs Welcome

JuSt chess

Just Chess is an implementation of chess in HTML5 and vanilla JavaScript, using the Bulma Framework.

Plans

  • Implement basic figure movement. (Done!)
  • Implement all the rules.
  • Implement different modes.

You can check the current status of the project here

Warning

If you want to contribute, all changes made on the master branch will affect the page which serves the preview of the app, so work on another branch and only merge when you are sure there are no bugs.

just-chess's People

Contributors

silvericarus avatar jfletcher01 avatar boseriko avatar

Watchers

 avatar Viswa Sai avatar fgata-va avatar

just-chess's Issues

Create Landing Page Design

Right now, the Game starts as soon as you load the page. The idea is to create a landing page where you can see the running games, create a new one, join a running game and then, start the game. It must use the elements in the Bulma framework and the color palette is to be chosen yet (proposals are apreciated). This issue is just for the HTML file, the inner working of the file (JS) would be created in another issue. A temporal structure for the page is in the listgames.html file.

Create Queens and design their movement

The queen is the first of the "complex" pieces to code. It's movement, given its initial position (x.y), is:

  • (x+i,y) as it moves in the x axis
  • (x,y+i) as it moves in the y axis
  • (x+i,y+i) as it moves diagonally towards the right top
  • (x-i,y-i) as it moves diagonally towards the left top
  • (x+i,y-j) as it moves diagonally towards the right bottom
  • (x-i,y+j) as it moves diagonally towards the left bottom

Add Bishops

The bishops move diagonally until they encounter another piece, given an initial position (x,y) they can move to (x+i,y+i); (x-i,y-i); (x+i,y-j); (x-i,y-j)

Code the castling, check, checkmate and the turns, as well as the stalemate.

  • Castling:
    Castling is a move in the game of chess involving a player's king and either of the player's original rooks. It is the only move in chess in which a player moves two pieces in the same move, and it is the only move aside from the knight's move where a piece can be said to "jump over" another.

Castling consists of moving the king two squares towards a rook on the player's first rank, then moving the rook to the square over which the king crossed. Castling may only be done if the king has never moved, the rook involved has never moved, the squares between the king and the rook involved are unoccupied, the king is not in check, and the king does not cross over or end on a square attacked by an enemy piece. Castling is one of the rules of chess and is technically a king move.

  • Check:
    A check is a condition in chess, shogi, xiangqi, and janggi that occurs when a player's king (or general in xiangqi and janggi) is under threat of capture on their opponent's next turn. A king so threatened is said to be in check. A player must get out of check, if possible, by interposing a piece between the threatening piece and the king, capturing the threatening piece, or moving the king to a square where it is no longer in check. If the player cannot move out of check, the game ends in checkmate and the player loses. Players cannot make any move that puts their own king in check.

  • Checkmate:
    Checkmate (often shortened to mate) is a game position in chess and other chess-like games in which a player's king is in check (threatened with capture) and there is no way to remove the threat. Checkmating the opponent wins the game.

  • Stalemate:
    Stalemate is a situation in the game of chess where the player whose turn it is to move is not in check but has no legal move. The rules of chess provide that when stalemate occurs, the game ends as a draw. During the endgame, stalemate is a resource that can enable the player with the inferior position to draw the game rather than lose. In more complex positions, stalemate is much rarer, usually taking the form of a swindle that succeeds only if the superior side is inattentive. Stalemate is also a common theme in endgame studies and other chess problems.

Sync destruction of pieces via Firebase

Describe the bug
The Pieces that are destroyed aren't synced, they need to be put in firebase as well.

To Reproduce
Steps to reproduce the behavior:

  1. Destroy a piece in a player.
  2. Check in the other player that it didn't show up.

Expected behavior
The destroyed piece showing in the graveyard in both players screens.

Create Knights and design their movement

The knights are the most complicated piece to code, because you have to manually check all of its posible movements, which are (given initial position (x,y)):

  • (x±2,y±1) plus minus depending if its towards the left or the right or the top or the bottom
  • (x±1,y±2) plus minus means the same as the latter

Setup Airbrake for your JavaScript application

Install Airbrake in 2 easy steps:

Step 1: Add the library
Include via CDN:

<script src="https://cdnjs.cloudflare.com/ajax/libs/airbrake-js/1.6.2/client.min.js"></script>

We also support installation via npm or Bower.

Step 2: Copy this config snippet to your app.js file

(You can find your project ID and API KEY with your project's settings):

var airbrake = new airbrakeJs.Client({
  projectId: <Your project ID>,
  projectKey: '<Your project API Key>'
});

To test that Airbrake has been installed correctly in your JavaScript project, just open up the JavaScript console in your internet browser and paste in:

window.onerror("TestError: This is a test", "path/to/file.js", 123);

Visit our official GitHub repo for more info on alternative configurations and advanced options.

[IMPORTANT] Auth request for firebase

Is your feature request related to a problem? Please describe.
Authentication is needed for firebase data sending and receiving.

Describe the solution you'd like
A funtion that authenticates in firebase my app, so the player can play as much as he wants.

Describe alternatives you've considered
Singing up in the app would be too much, maybe finding something else a bit easier would be better.

Make a script that starts the game when two players are connected

In the DB, there's a field called playersConnected. When it's not set, the player who connects arrives at a blocked screen, waiting for another player to connect. When this number its 1, it means that when the player connects, the two players get unblocked and can start playing.

Create Kings and design their movement

The king can move on the same pattern as the pawns, one cell at a turn, so given initial position (x,y), it can move to:

  • (x+1,y)
  • (x,y+1)
  • (x+1,y+1)
  • (x-1,y-1)
  • (x+1,y-1)
  • (x-1,y+1)
    The castling and the check and checkmate will be programmed later with the game mechanics and the turns.

FirebaseError: Document path must be a non-empty string

View details in Rollbar: https://rollbar.com/silvericarus/JuSt-Chess/items/12/


FirebaseError: Document path must be a non-empty string
  File "webpack:///../firestore/dist/esm/src/util/error.js", line 140, in FirestoreError
            var _this = _super.call(this, message) || this;
  File "webpack:///../firestore/dist/esm/src/api/database.js", line 1184, in [anonymous]
                throw new FirestoreError(Code.INVALID_ARGUMENT, 'Document path must be a non-empty st...
  File "file:///C:/Users/Silver/Documents/Programaci%C3%B3n/just%20chess/chess.html", line 112, in [anonymous]

Create footer

Elements for footer

  • Log of modifications

  • Thanks

  • Copyright

  • Link to my web

  • Log of modifications

  • thanks

  • Copyright

  • Link to my web

  • Footer

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.