This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

bourne presents ...


Chess Dos

Play chess with other Greenfoot users, or against the AI (with difficulty setting), or yourself.

There are four difficulty settings for the AI. So far it just determines how many moves the AI will look ahead (2-5).

Pawn promotion piece selection is done by clicking (to toggle through options) on the piece shown to the right of the chess board. Have it ready before moving a pawn to be promoted.

Playing with other users:
* Comment below to ask someone to join you if no one is in the game with you.
* May chat with your opponent.
* Who goes first is randomized for now.
* There is no time restriction.
* Notices will be given if your opponent quits the game (starting a new game), or if they may have paused the scenario or left.

* Save game feature

The AI is similar to my one from like 3 years ago, but with better implementation/documentation. My old chess game can be found here:

For a reusable class for making your own onsite user 2-player/users games/scenarios, visit:

For reusable GUI Components, visit:

5835 views / 1368 in the last 7 days

6 votes | 0 in the last 7 days

Tags: game with-source 2-player ai gui chess messages bourne

This scenario is a member of: UserInfo Shares, UserInfo Multiplayer, Game AI

open in greenfoot

There is no HTML 5 translation of this scenario available.
View legacy version (requires Java plugin)

This scenarios uses Java features that are not available for use after conversion to HTML 5. Please try the legacy version, which requires the Java plugin to be installed.



Here is an example of the jumping Queen. Medium setting, player (w) against computer (b). MV | WHITE | BLACK ---+-------------+-------------- 1 | e2e4 | b8c6 2 | d2d4 | g8f6 3 | b1c3 | a8b8 4 | e4e5 | f6g8 5 | f2f4 | b8a8 6 | g1f3 | a8b8 7 | c1d2 | b8a8 8 | c3e4 | d7d5 9 | e4c5 | c8g4 10 | c2c3 | b7b6 11 | c5d3 | d8d7 12 | h2h3 | g4f5 13 | d1e2 | f5e4 14 | f3g5 | c6d4xP 15 | c3d4xn | e4f5 16 | g2g4 | f5g6 17 | f4f5 | h7h6 18 | f5g6xb | h6g5xN 19 | g6f7xp+ | e8f7xP 20 | d2g5xp | f7g6 21 | h3h4 | d7a4 22 | d3f4+ | g6h7 23 | e2d3+ | a4e4+ ?????


Thanks Danpost! I found the bug. When the AI checked the Queen's movement possibilities to the right, it found the pawn, checked to see what happens if it captured it, finds out its King is still in check, so continued with path. The execution break for the path (to the right), when it found a piece (the pawn) occurred after the king check, so was skipped.
A new version of this scenario was uploaded on Thu Feb 20 12:45:17 UTC 2014 Fixed AI bug where a Rook, Bishop, or Queen would continue a path in a particular direction over an opponent's piece, if capturing the piece would result with the AI King being in check. Thanks again Danpost for the report


It does not seem to ever start for me, the system hangs like it is in dead lock.


Does the applet load? Or are you talking about the computer's turn in the game?


Something weird happened to my machine - If I am running java (jboss) somewhere else the 2 instances fight for resource. I killed the other process and it seems to be ok now.
Can you add en-passant into your code?


@Blackknight1123, I forgot about that move, when I have time I will look into adding it.
Also, can you make under-promotion possible.


@Blackknight1123, under-promotion is already implemented. Check the scenario description for how to do this.

See all comments

Want to leave a comment? You must first log in.

Who likes this?

lehrerfreund valdes Entity1037 Game/maniac Gevater_Tod4711 m_p_v_13