GithubHelp home page GithubHelp logo

analogchess's Introduction

Analog Chess

Holy Hell!

This is a version of chess where the pieces are not constrained to an 8x8 grid, and instead can move to any position on the board. After clicking on a piece, the areas it may move to are highlighted in green, and areas the enemy can move to are highlighted in red. Drag the piece to move it, and to confirm a move, either click on the piece again or press enter. To cancel a move, press escape or click anywhere off the piece.

There is no check or checkmate in this game. To win, you simply need to capture the opponent's king. This is mainly because stalemate is basically impossible, as the king can always move an infintesimal amount, and also because implementing check/checkmate would destroy the last ounce of sanity I have left.

Pieces

Each piece's moves are based on it's moves in regular chess, but in Analog Chess, pieces may move to any position along their trajectory.

Pawn: May move 0-2 squares on it's first move, 0-1 otherwise. Can only attack diagonally. Sadly en passant (the funny move) is not implemented yet because I have no idea how it would work.

Bishop: Moves any distance diagonally

Knight: Moves in a circle of radius sqrt(5), which is the distance it travels in it's usual L move.

Rook: Moves any distance orthogonally

Queen: Moves any distance orthogonally or diagonally.

King: Moves 0-1 squares orthogonally or 0-sqrt(2) squares diagonally. It is allowed to move into check because this game was way too complicated to code already. You lose if your king dies.

The king may castle with the rooks, and it is allowed to castle out of, into, or through check.

Capturing

Capturing in this game is a little bit goofy. Basically, if your piece overlaps the opponent's piece it is captured, and you cannot move past the first piece you overlap.

Example

One interesting side effect of this is that you can capture multiple pieces at once. :)

Code

To run the code you will need to install Python and the PyGame library, and then run the latest .py file because I can't be bothered to actually use version control.

Warning: This code is fucking awful.

Do not expect the code to be stable under any modifications, but you can try if you want I guess. Also there are barely any comments sorry. I am in Electrical Engineering and I like writing shitty code to piss off my Computer Science friends.

analogchess's People

Contributors

byarmis avatar ehulinsky avatar mwufi avatar

Stargazers

 avatar

Watchers

 avatar

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.