Skip to content

IonBoleac/AnalogChess

 
 

Repository files navigation

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.

EURISTICHE

Il peso del cavallo è 3. Il suo valore però varia di 0.16 per ogni casella controllata in più rispetto a 4. Peso_cavallo = 3 + 1/granularità*(numero_case_controllate - 4*granularità)

NOTA: con case controllate si intendono le case in cui si potrebbe muovere (se c'è un pezzo dello stesso colore non ci può andare mentre se ce n'è uno dell'altro colore sì)

NOTA 2: il valore 4*granularità (o quello che è) dovrebbe in realtà essere un parametro che rappresenti l'area media coperta dal pezzo

Pesi altri pezzi: peso_cavallo = 3 + 1/granularità*(numero_case_controllate - 4granularità) peso_pedone = 1 + 1/granularità(numero_case_controllate - 2granularità) peso_alfiere = 3 + 1/granularità(numero_case_controllate - 4granularità) peso_torre = 5 + 1/granularità(numero_case_controllate - 6granularità) peso_regina = 9 + 1/granularità(numero_case_controllate - 10*granularità) peso_re = 60

About

Chess but no grid

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Jupyter Notebook 5.1%