GithubHelp home page GithubHelp logo

gbtami / pychess-variants Goto Github PK

View Code? Open in Web Editor NEW
219.0 16.0 111.0 108.73 MB

Chess variant server

Home Page: https://www.pychess.org

License: GNU Affero General Public License v3.0

Python 31.43% JavaScript 0.40% TypeScript 34.49% CSS 24.91% HTML 8.63% Shell 0.15% Procfile 0.01%
python3 aiohttp-server typescript mongodb snabbdom chess shogi xiangqi makruk sittuyin seirawan capablanca grand placement shako janggi

pychess-variants's Introduction

Python-CI Nodejs-CI

pychess-variants is a free, open-source chess server designed to play chess variants.

Currently supported games are:

Additionally you can check Chess960 option in for Chess, Crazyhouse, Atomic, Three check, King of the Hill, S-chess, Capablanca and Capahouse to start games from random positions with Chess960 castling rules

For move generation, validation, analysis and engine play it uses

On client side it is based on chessgroundx fork of chessground

As you know, pychess-variants is a free server and it will remain free forever. However, maintaining and improving the server costs time and money.

If you like our work and find our server useful, please donate through patreon or directly through paypal!! Your contribution will be greatly appreciated and help me continue to develop this awesome server.

Installation

Prerequisites

Project setup

pip3 install -r requirements.txt --user // Install python requirements
yarn install                            // Install node requirements
yarn dev                                // Compile typescript files to javascript
yarn md                                 // Compile md files to html

Start server

python3 server/server.py

Supported browsers

Pychess-variants should support almost all browsers. Though older browsers (including any version of Internet Explorer) will not work. For your own sake, please upgrade. Security and performance, think about it!

Only Fairy-Stockfish analysis might not work on all browsers.

pychess-variants's People

Contributors

abhishekashyap avatar arma55 avatar autocorr avatar avirtual777 avatar couchtomato87 avatar cssandhtmlonly avatar deepsource-autofix[bot] avatar dependabot[bot] avatar fulmene avatar gbtami avatar hartwork avatar ianfab avatar imkadaga avatar kezsulap avatar little-mage avatar marken-foo avatar nelloho avatar nnickoloff1234 avatar notruck avatar pepellou avatar rainrat avatar ralgun avatar randompearl-stack avatar rechefiltr-is-fire avatar renyhp avatar srimethan avatar tiagohermano avatar ttbot-on-lichess avatar visualdenniss avatar xyvir avatar

Stargazers

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

Watchers

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

pychess-variants's Issues

Piece Sets and Boards

I noticed that some people didn't even know you could change the piece sets by clicking the settings button on the top right. I think for a game about one game (like lichess) it's fine to keep it in the overall settings, but in this game where different types of games are played, I think it makes more sense to have this option within the game interface instead of the top menu bar, kind of like what they do in playok.com. As of now, the interface uses a lot of space for just three buttons (abort, draw, and resign). Maybe you can squeeze in graphics options too?

Along those lines, maybe this is already planned, but would you be able to split the piece sets and boards so you can mix and match, like you can do in lichess?

Also, the thumbnail previews when looking at other player's games does not update with your current theme.

Shogi SFEN

This one would actually be a huge quality-of-life improvement for me. A lot of people use the ShogiGUI software for running engine analyses, and one of the only ways to get a game outside of downloading and loading a .kifu is by pasting notation in -- most likely going to be SFEN in this case.

So far, in order to analyze my games under the engine, I've had to replay the game myself on the engine, which is time-consuming to say the least. I know you pretty much have an analysis feature going at this moment (which is going to be VERY useful for quick analysis), but I still turn to the strongest available engine when I want deep analysis.

What would be helpful then is a link for "copy SFEN to clipboard" or something. Here are a few examples of SFENs generated by ShogiGUI:

  1. A standard game with checkmate:

position startpos moves 2g2f 3c3d 7g7f 5c5d 4i5h 8b5b 2f2e 2b3c 8h3c+ 2a3c 2e2d 2c2d 2h2d 3d3e 2d2c+ 5b2b 2c3c 2b2i+ 5i6h B4d 3c4c 4d9i+ N5c 3a3b 5c4a+ 3b4a B1e P4b 4c5d 6a5b 8i7g L5c 5d2d 2i3i 6i7h N4e G8i 5c5g+ 5h5g S5i 6h6i 4e5g 6i5h 3i4h 5h4h win

  1. A handicap game won by resignation:

position sfen 4k4/9/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL w - 1 moves 5a4b 2g2f 4b3b 7g7f 3b2b 2f2e 2b3b 2e2d 2c2d 2h2d P*2c 2d2e 3b2b 2e7e 2b3b 7e7c+ 2c2d 7c6c 3b2c 6c5c 2c3d 5c5e 1c1d 8h6f 9c9d 6f9c+ 2d2e 3g3f 2e2f 4i3h 4c4d 3h3g 4d4e 9c8c 2f2g+ 3g2g 9d9e 8c6a 3d2c 5e4e 2c3b 6a5b 3b2c 4e4d 2c3b 4d4c 3b2b 5b4a 2b1c 4c3c 1c1b 3c2c 1b1a 4a3a 1d1e 2c2b resign

  1. A handicap game won by timeout:

position sfen 3gkg3/9/ppppppppp/9/9/9/PPPPPPPPP/1B5R1/LNSGKGSNL w - 1 moves 4a3b 7g7f 6a7b 6g6f 5a6b 6i7h 7c7d 7i6h 7b7c 6h7g 7c8d 9g9f 7d7e 8h9g 7e7f 7g7f 9c9d 7h7g 4c4d 8g8f 3b4c 2g2f 3c3d 2f2e 4c3c 2h2f 3c3b 2e2d 2c2d 2f2d 6b5b 2d2a+ 5b4c 2a2e 9d9e 8f8e 9e9f 9g8f 8d7d 6f6e 8c8d 6e6d 6c6d 9i9f P*9h

Games ending at the start

This is probably known already, but this especially happens with new players... When a game is started, no one makes a move (not sure if it's because they can't), and then the game ends a few seconds later.

There was also one problem where a user was playing but it still listed him as anonymous when he chatted: https://pychess-variants.herokuapp.com/e4wE2Pub (in the game it listed him as ohioshogi, but in the game record he's still anonyous)

Enhance drop move highlight

@CouchTomato87
"Speaking of last move highlights, if there was a drop, could we get a highlight from the corresponding spot in the pieces in hand? I often get confused if there was a drop or not because if there is a green piece in the middle of the board, I have to check all corners to make sure it just wasn't a long move."

Game navigator scrolling issue

When you navigate through a game (going backward and forward), once you get to the final few moves, the screen jump because of the scrollbar moving. This causes things to mess up if you're clicking rewind or fast-forward really quickly (which we often do)

Additional variants

Any chance we can get grand chess, minishogi,and kyoto shogi, which are on Fairy? :)

1Kanji pieces

Here is the first version of 1 Kanji pieces. I feel like there will probably be issues (with centering, sizing, etc), so expect changes. Unfortunately there is no font available that replicates the ones typically used for shogi pieces, so I had to pick one that's close enough.

I was also lazy with naming the pieces. But basically I just used the abbreviation of the piece. The number before is the direction (0 = up, 1 = down), and the number 1 after just means 1 kanji as opposed to 2. P before a letter means promoted. T = tokin (promoted pawn).

1Kanji.zip

Guides for games

Here is what I have for my shogi guide. The txt file is in Github markdown, but I'm not sure what to do from there. There are image placeholders, but I don't know the exact directory for the images. Hopefully you know what to do do about that. :)

ShogiGuide.zip

Also, on an unrelated note. I checked the white elephant and the borders are exactly the same as other pieces (6 px wide), so I don't know why it appears thicker in the game. Might as well leave it as is though. I should mention that the Capa sets aren't updated with the newest elephants/hawks though.

New XQ set - Hanzi

Here is a new XQ set using the same style of pieces as the internationalized ones, but using Chinese characters (Hanzi). Like most sets, it can be used with any board.

Hanzi.zip

Shogi board flip

When you flip the board, the piece directions don't change with that. I just flipped the board for the first time today haha.

New Xiangqi pieces

Not really an issue, but here is a full set of Xiangqi pieces, so that my set is not just copying from the other set used.
XQ2.zip

On a completely unrelated note, some English fixes for the chat:

"XXX leaved lobby" -> "XXX left the lobby."
"XXX joined to lobby" -> "XXX joined the lobby."

Analysis graph issues

There currently are two possibly confusing behaviors of the analysis graph:

  • Positions not analyzed yet are displayed as if the evaluation was 0.00. It would be more clear if they were hidden.
  • When hovering over the analysis result for the initial position, it says 0...null or 0.null.

In-game chat request

It would be nice to have player entering (probably for visitors) and player leaving messages in the in-game chat so that you know your opponent is still with you even after the game or if they already went back to the lobby.

Shogi notation slightly wrong

Just realized this when testing pieces. Western shogi notation usually depicts promotion with a + at the end of the move. While this usually means "check" in chess, shogi doesn't depict checks. However, the notation here uses + for check, but does not indicate when a piece promotes (which is more important).

Ask to confirm when 'resign' button is clicked

The current behavior of the resign button is to end the game immediately with a loss. Requiring a second-click (like on Lichess) would help avoid mis-clicks and unpleasant surprises. Thx!

PGN export issue

GothicChessInventor reported in lobby chat:
I just tried to download all of my games as one PGN file and the moves are wrong.

[Event "PyChess casual game"] [Site "https://pychess-variants.herokuapp.com/nFgwxu4u"] [Date "2019.09.29"] [Round "-"] [White "GothicChessInventor"] [Black "Fairy-Stockfish"] [Result "0-1"] [TimeControl "3600+5"] [Variant "Capablanca"] [FEN "r4k1b1r/pp6p1/n1p3pp2/4pbN2p/3p6/P3B1P3/1P2PPBPPP/3qcKA2R w kq - 0 25"] [SetUp "1"] 1. d5 Nh3

Obviously 1. d5 is not possible for white.

Bug on S-chess house

Sometimes when the ai captures with the bishop it duplicates. For example bishop takes pawn but instead of going onto the square of the captured pawn a new bishop appears where the pawn got captured and the original bishop that made the capture remains on its original square and it doesn't count it as a dropping a previously captured bishop.
Dont know if this makes sense reply if confused.
Thanks.
Look at move 20:
https://pychess-variants.herokuapp.com/RFp9UeUr

Piece drops cannot be clicked

I brought this up earlier, but I think it's still an open issue. Basically, for any game using drops (i.e. shogi, crazyhouse, etc.), you can't drop a piece by clicking it and then clicking the destination. You can only drop by dragging, which can be an issue when timers are involved.

Out of curiosity, what does the code look like that allows you to normally move with two clicks? (I'm not very good at coding but I can try to help by comparing at least haha)

Handicaps

Request for including potential of handicaps (starting the game with one player missing pieces). I'm not sure if this would need present handicaps or if the players can manually remove...

Seirawan subvariant idea

This is an suggestion based on Seirawan Chess. The board is 8x8 with four additional squares.

Instead of the drop system used in Seirawan, the new pieces is already in the game at the start of the game. I'm not sure but i think it's preferable to disable the extra squares once the fairy pieces has left their starting position. The additional squares may be disabled for the rest of the games once the fairy pieces has left their starting squares. The giraffe chess board is somewhat odd but modification is good idea to rule out the drop system.

giraffe board

Favicon

I went back to Jarl's original idea of an elephant. How does this look?

ElephantFavicon16
ElephantFavicon64

Here is the file, and I've also included the code it came with in a text file:

favicon.zip

Responsive design/mobile support

On browsers, horizontal scroll is disabled even when the board is bigger than the window.

Also, not sure if mobile support is available, but when viewing on a mobile browser, a whole portion of the left side of the screen is cut off and not able to be viewed. Scrolling and resizing doesn't bring it into view.

Transparency of game request settings

There are two scenarios where I found it difficult to keep track of the game settings:

  • The chess960 flag is not be visible in the list of game requests, so the opponent does not know about it before accepting the request.
  • The AI level from the "play with the machine" dialog is not shown anywhere during or after a game.

Typos/grammar/etc

Maybe I'll just have a section open for any typos that may exist.

The new support button, "Direcly support us" should say "Directly support us".

Shogi last move highlight not working

Was watching some random replays and noticed that for shogi, the green highlight boxes for the most recent move do not work when reviewing the game. When you open a game (for example https://pychess-variants.herokuapp.com/4Yk3ElYX ) the highlight is there. But as soon as you go back either one step or to the beginning, the highlights don't work. I've checked S Chess and Xiangqi -- both of those still work.

Timer - Byoyomi option

Request for timers being able to allow for byoyomi, which is basically like overtime (primarily used in shogi or go, but I wouldn't mind having that feature for any game). For example, 10 min + 30 sec byoyomi means you have 10 minutes for a total pool, and then 30 seconds all of your moves after that. 0 min + 30 sec byoyomi means you always have 30 seconds no matter what (which is quite different than blitz chess)

Unable to log in anymore

For some reason I can't log in anymore. I come in as anonymous and even after going through the login dialogue of using my lichess account, it spits me back into the lobby as Anonymous, but the login button is gone.

Consultation or Team Mode

Could we have a "team mode" as a future option please?

If selected, this mode would let players choose and specify exactly who is on their team. I'm not sure whether a mid-game invite should be an option, it's probably best to have everyone join before the game starts.

This new mode should be casual, and not affect anyone's ratings.

Once in the game, they will each be able to add visualizations to the board, which only their team-mates can see.

Ideally, any of the team members would be able to draw color arrows, mark highlights, make moves, and grant more time to the opponent team. This includes offering and accepting draws, and resigning on behalf of the whole team. If more than one member on the side-to-move were to attempt a move, whichever reaches the server first will register.

At the end of the game, anyone can propose a rematch. The new game will either ask everyone if they would like to join, or just automatically include the same players as before, now with the colors reversed.

In this mode, the chat window probably needs to be private as well for each team. I'm not sure how best to integrate private chats with public kibitz from spectators.

I hope such features can potentially be useful for Bughouse play to some extent if/when that variant becomes available, although these days the preferred mode of communication for Bughouse coordination seems to be over voice chat.

Thanks!

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.