I'm building a chess engine and trying to figure out how good are the moves generated. Can you tell what is the best move for white in following position and why? Thanks.

[fen "r1b1kbnr/2p2ppp/p1p5/3pP1q1/8/2N1P3/PPP2PPP/R1BQK1NR w KQkq - 0 1"]
  • 2
    If you are building an engine of your own, you will want to download other engines to help answer questions like this, since you will have hundreds more of them. Two very good free engines are Stockfish and Houdini 1.5.
    – dfan
    Jul 30, 2013 at 19:49
  • 1
    Stockfish says 1. Nf3 Qxg2 2. Rg1 Qh3 3. e4 dxe4 4. Nxe4
    – Tony Ennis
    Jul 31, 2013 at 2:33
  • @dfan that's a good point. I tried Stockfish last time but couldn't get it working. Is there any tutorial? Can you make it run with Winboard?
    – bytefire
    Jul 31, 2013 at 8:34
  • @dfan An engine can help answer what the best move is, but not why.
    – Halvard
    Jul 31, 2013 at 8:35
  • @bytefire I tried Stockfish last time but couldn't get it working. Is there any tutorial did you check the UCL? i had similar issues running houdini, was solved by checking that, by default it's not checked
    – Lynob
    Sep 7, 2013 at 18:39

4 Answers 4


This is kind of similar to the line (with colors reversed) 1. e4 e6 2. d4 d5 3. Nc3 Bb4 4. a3 Bxc3+ 5. bxc3 dxe4 6. Qg4

It's basically an identical position with colors reversed except white's knight is already on c3 which is actually a really good square for the knight. In fact I believe the main line of the line listed above is 6.. Nf6 7. Qg7 Rg8 8. Qh6 Rg6 9. (Queen somewhere) Nc6 with idea of playing e5.

[fen ""]

1.e4 e6 2.d4 d5 3.Nc3 Bb4 4.a3 Bxc3+ 5.bxc3 dxe4 6.Qg4 Nf6 7.Qxg7 Rg8 8.Qh6 Rg6 9.Qd2 Nc6

Based on this I think the plan 1. Nf3 Qxg2 2. Rg1 Qh3 3. Rg3 Qd7 4. e4 looks strong.

[fen "r1b1kbnr/2p2ppp/p1p5/3pP1q1/8/2N1P3/PPP2PPP/R1BQK1NR w KQkq - 0 1"]

1.Nf3 Qxg2 2.Rg1 Qh3 3.Rg3 Qd7 4.e4

IMO the best continuation is Nf3. Black is mostly forced to take the pawn on g2. After Rg1, white can play e4 with fairly good advantage.


You have to defend the pawn on g2, so you should move the queen d1- f3. The best response for the blacks will be queen g5-e5 or bishop c8-g4. If the white moves their pawns they will weaken their structure. They have to make the rocada as fast as possible.


I will try to give you a simple mathematical answer. It is clearly oversimplified, but might be a way to think that helps you program your engine.

Assuming that your chess engine can calculate simple forced moves and the value of pawns it should find that White now must choose between defending the e5 pawn or the g2 pawn. What if we could simply count the number of squares attacked (including squares occupied by other pawns or pieces, even your own)?

Defending the e5 pawn: One variation is 1. Nf3 Qxg2 2.Rg1 Qh3. Black attacks 54 squares, while White attacks 54 squares.

Defending the g2 pawn: 1. Qf3 Qxe5. Black attacks 57 squares, while White attacks 50 squares.

Defending the e5 pawn puts White on as many attacked squares as White, while when defending the g2 pawn White is 7 squares down.

Of course, in the variation defending the e5 pawn playing 3. e4 is strong for White as it opens up for the bishop on c1. Just count the number of squares.

I repeat, this is very simplified, but in general the more active you are (the more squares your pawns and pieces attack), the better off you are all other things being equal. This is one way used by programmers to give a mathematical value to how active a position is.

(I might have counted a wrong, but not by much - it shows the general idea)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.