Commit graph

52 commits

Author SHA1 Message Date
azibom
fc6b977686 Fixes #78 - When we have two attackers in a chess game, both pieces should be red
Part-of: <https://gitlab.gnome.org/GNOME/gnome-chess/-/merge_requests/52>
2023-10-04 21:40:47 +00:00
azibom
b4cd8909e7 Fixes #46 - Use red background for king and threatening piece when king is checked
Part-of: <https://gitlab.gnome.org/GNOME/gnome-chess/-/merge_requests/50>
2023-09-29 15:22:39 +03:30
Rico Tzschichholz
0b383a2ddc Use uint64 for BitBoard mask arrays 2022-12-08 16:10:50 +01:00
Nils Lück
f8aa4eab3d Modernized preferences 2022-08-19 21:18:48 +00:00
Michael Catanzaro
9411e198b8 Fix some new switch warnings 2020-12-05 10:04:20 -06:00
Michael Catanzaro
05d7bb3a11 Prefix all custom PGN tags with X-GNOME
We will still honor the original tag name when importing, so users who
saved games with older versions of GNOME Chess won't be affected.
2020-12-04 18:14:20 -06:00
Michael Catanzaro
d8d14506ae Add warning comment about the Seven Tag Roster 2020-12-04 18:04:23 -06:00
Michael Catanzaro
fb46a6765c Fix "engine error" on stalemate
When the game is stalemated, the chess engine will declare a draw. We
then check if it can claim a draw, and if not, declare that the game has
ended due to an engine bug. Since stalemate is not a valid reason to
claim a draw -- it is a forced draw, not a claimable draw -- this means
we incorrectly claim the engine is broken.

Stalemate requires special handling.
2020-12-04 17:46:40 -06:00
Amandeep Singh
0ab9614e13 gnome-chess currently disables undo functionality when a game has ended.
This commit keeps the undo button enabled even after end of a game.
User can now undo a move even after a checkmate or a draw.

Closes #44
2020-10-18 14:30:25 +00:00
Michael Catanzaro
7e3368f278 Avoid showing claim draw dialog before forced draw
If we've repeated the same move enough times, we display the claim draw
dialog immediately before ending the game due to the forced draw. This
is wrong: the game is already over, but the user is still prompted to
decide whether to claim draw or not! That's no good.
2020-10-15 09:30:49 -05:00
Michael Catanzaro
34b6e0dee4 threefold/fivefold repetition checks should consider only current state
Way back in 4cabc41085, I thought it was
important to allow users to claim a draw at any point in the future
after a threefold repetition. But this is not what the laws of chess
allow: it should be claimed when it happens, not at random points in the
future. At the time, that change probably made sense because we didn't
tell the user when it's possible to claim a draw, which nowadays we do
by opening a message dialog. But nowadays, it has no benefit, and a
large cost: the message dialog appears at the start of every turn,
forevermore, getting in the way and irritating the user. So let's only
show it if the current board state really is eligible for a draw.

Fixes #47
2020-10-15 09:30:01 -05:00
Amandeep Singh
de1b15d674 chess-pgn: Remove the extra check while setting TimeControl tag
TimeControl tag should be set irrespective of whether WhiteTimeLeft
or BlackTimeLeft tag has been set

Closes #45
2020-06-30 11:55:11 +05:30
Michael Catanzaro
92b943ecd2 Ensure draws are only claimed when valid
For robustness, let's make it a bug to try claiming a draw when it's not
possible. Guard against this in the one point it can currently happen.
2019-01-27 11:49:59 -06:00
Michael Catanzaro
9bc94a14ee Fix wrong player sometimes winning when timer expires
Fixes #25. Thanks to Alessandro Bruni for investigating and proposing
the original version of this patch.
2018-07-27 17:57:59 -05:00
Michael Catanzaro
f4961bd57b Improve ChessClock
Make most of the members private and expose new properties to get the
remaining time for each player. Much simpler to use.

Credit to Alessandro Bruni for the initial version of this patch adding
the new properties, and to Sahil Sareen for spotting a bug in that
version.
2018-07-27 17:52:47 -05:00
Michael Catanzaro
9b41b9bef7 Show better move description for en passant captures
The current description is wrong since it says the captured piece was at
the current location of the capturing piece, but that's not true for en
passant captures.

Also, this might possibly help users realize that en passant is not a bug.
2018-04-24 11:48:07 -05:00
Michael Catanzaro
95292f5597 Rename ChessMove.moved_rook to castling_rook 2018-04-24 09:54:55 -05:00
Michael Catanzaro
c2292dd1a7 libchess should be a static convenience library
This shouldn't be installed as a shared library

https://bugzilla.gnome.org/show_bug.cgi?id=794238
2018-03-11 12:41:16 -05:00
Niels De Graef
ce6465a9e2 Ported build system to Meson.
See the following links for more info:
* https://mesonbuild.com
* https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting

Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=787346
2017-09-08 23:09:12 -05:00
Michael Catanzaro
59111fcf8a clock: Fix game ending too soon when using Fischer/Bronstein clocks
https://bugzilla.gnome.org/show_bug.cgi?id=779937
2017-03-12 11:00:17 -05:00
Michael Catanzaro
19a65b04e6 Support new fivefold repetition and 75 move draw conditions
On July 1, 2014 the FIDE Laws of Chess were updated to add two new
automatic draw conditions. These are the same as the threefold
repetition and 50 move rules, except they take effect automatically
rather than optionally.

http://www.fide.com/component/handbook/?id=171&view=article

https://bugzilla.gnome.org/show_bug.cgi?id=766005
2017-01-22 09:02:06 -06:00
Michael Catanzaro
cff0c343e5 Use namespace instead of class for BitBoard
This class contains only constants and static functions, so generating a
ton of GObject code here for an object that never gets instantiated is
way overkill. Use namespace instead of class to clarify this.
2016-07-27 23:38:56 -05:00
Michael Catanzaro
263de13df0 Fix valac warnings about static const 2016-07-27 22:07:44 -05:00
Sahil Sareen
c81114efae Update copyrights 2016-03-18 22:45:08 +05:30
Sahil Sareen
d78fa64289 Bump up the license version on source files 2016-02-16 02:27:59 +05:30
Sahil Sareen
16037c46f8 Fix bad pgn load behaviour - invalid moves in pgn
Don't load a pgn with invalid moves,
prompt a dialog to the player, and
start a new game.

https://bugzilla.gnome.org/show_bug.cgi?id=746218
2015-05-03 22:56:48 +05:30
Sahil Sareen
ba7a105a76 Marking new strings for translation
* Marked new strings that print warnings on loading a bad pgn
 * Added config.vapi to lib/ and updated Makefile.am
 * Updated po/POTFILES

https://bugzilla.gnome.org/show_bug.cgi?id=746218
2015-04-04 18:51:28 +05:30
Sahil Sareen
0e9eaa8547 Fix bad pgn load behaviour
Handle invalid fields in PGN properly.
2015-03-29 20:52:21 +05:30
Sahil Sareen
e9d862cda3 Fix crash on invalid clock type in pgn
Use a simple clock for invalid clock types in pgn.
2015-03-24 20:40:56 +05:30
Sahil Sareen
fe69cc5a02 Code Cleanup 2015-02-19 20:49:36 +05:30
Sahil Sareen
d00db10c10 Add support for Fischer and Bronstein clocks
* Preferences dialog: Added option for clock type
* Clock Library: Support for these clocks
* Gnome-Chess: Handle fischer/bronstein clocks

https://bugzilla.gnome.org/show_bug.cgi?id=473395
2015-02-16 09:45:50 +05:30
Michael Catanzaro
ed104403a0 Fix whitespace error in previous commit
This is a whitespace error on more than one level.

Really think that space before parens in OO code may have been a
mistake... too late now.
2015-02-14 23:14:49 -06:00
Michael Catanzaro
0b8f5b81d8 Silence new empty if statement warning 2015-02-14 23:12:54 -06:00
Sahil Sareen
9b9e47a241 Fix commit 3760a9c 2015-02-14 23:20:54 +05:30
Sahil Sareen
c79fab81af Improving the precision of chess-clock
* Minor change to chess-clock library.
2015-02-11 14:31:47 +05:30
Sahil Sareen
3760a9c1c3 Another indentation fix 2015-02-08 23:46:09 +05:30
Michael Catanzaro
5aa4c980e3 Use Source.CONTINUE and Source.REMOVE 2014-12-30 21:37:03 -06:00
Sahil Sareen
3c99d3de82 Saving a completed game due to timeup saves the timer as infinity
When loading the completed games-
1. show the pgn file name in header-subtitle.
2. due to timeout - Show timer time correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=741966
2014-12-30 11:14:24 -06:00
Michael Catanzaro
5fae150e48 Fix whitespace errors in previous commit 2014-12-16 19:07:00 -06:00
Sahil Sareen
3e6ccc1f4d Fix the pause functionality on timer
Fixes issues:
Bug 740988 - Timer is dead in a scenario
Bug 741119 - Pause seems to be broken
2014-12-16 18:47:46 -06:00
Michael Catanzaro
072e12f299 Fix game ending with 1s left on timer
https://bugzilla.gnome.org/show_bug.cgi?id=721722
2014-09-15 18:13:32 -05:00
Michael Catanzaro
620625ecca Compile with --target-glib=$(GLIB_REQUIRED) 2014-08-17 15:28:36 -05:00
Michael Catanzaro
a4148ca589 Do not directly pause/unpause the chess clock
https://bugzilla.gnome.org/show_bug.cgi?id=728202
2014-07-06 12:11:01 -05:00
Michael Catanzaro
be821cf7d6 Remove ChessPlayer.start_turn()
It's unused
2014-06-25 21:37:44 -05:00
Michael Catanzaro
f32dcec4d9 ChessGame: do not complete move if game is over
Fixes clock unpausing when using Undo after gnuchess has decided to
report a move but before it has actually done so (which is no longer
possible after the previous commit, anyway)
2014-06-25 15:16:25 -05:00
Michael Catanzaro
c948843e68 Don't create new fundamental types 2014-06-24 08:14:59 -05:00
Michael Catanzaro
10e74eb03f Better workaround for signal misfires 2014-06-22 21:54:09 -05:00
Michael Catanzaro
f2f2842bff Distribute libchess.vapi
This allows users to modify Vala files outside of lib/ without having to
manually remove anything.

https://bugzilla.gnome.org/show_bug.cgi?id=729042
2014-05-17 19:51:54 -05:00
Michael Catanzaro
cc04b52312 trivial: move methods related to claim draw 2014-04-08 22:46:37 -05:00
Michael Catanzaro
2ed16b90f7 Prompt the player when claiming a draw is possible
https://bugzilla.gnome.org/show_bug.cgi?id=727789
2014-04-08 22:45:25 -05:00