# Question
Title: Is it good to have a tendency to exchange pieces?
This is how I am playing nowadays. I can beat ~1500 player 50% of the time (the rest is due to tactical errors):

1. Play the opening (upto 12 moves)
2. Don't blunder
3. At the point where my pawns and pieces are in a better shape than the opponent's, I first exchange the queens
4. Centralise my king
5. Slowly exchange all the minor pieces, then the rooks
6. Win in the endgame

Now is this really the way to play chess? I mean, I do want to improve my tactical skills but my decision is that once I am able to beat a 1500 player 100% of the time, I will start playing tactical chess, with which I mean attacks and stuff.

Is there something wrong with my approach?

# Answer
> 17 votes
> Now is this really the way to play chess?

Well, it is certainly *a* way to play chess. It's the way Aryan Tari chose to play Magnus Carlsen in the Altibox Norway tournament a couple of days ago. Swap as many pieces off as you can, get to a more or less equal endgame, maybe have to survive a bit of pressure then shake hands for a draw. It didn't work out that way. He got positionally crushed from a position which, to this patzer, looked fairly even.

It certainly didn't look roughly even to the chess24.com commentary team of Judit Polgar and Vladimir Kramnik. "60% lost / 40% drawn" said Kramnik, "Go back to school, Aryan" said Judit during the commentary after move 18.

After 21. Nd2:

> The strategical battle is over at that point. It's very nice when you can just follow a plan and you don't need to calculate

was Carlsen's comment afterwards.

I have to admit I have lost a fair number of games against stronger opponents like this just as I have won games against weaker players like this. The biggest difference between good players and bad players is not tactical ability (although it is often also a factor). It is the ability to accurately evaluate positions. Weaker players happily aim for bad positions because they don't know any better and stronger players can't believe their luck. Ask Magnus.

Bottom line: you are going to lose if you try and follow this plan against stronger players and if you try it against a weaker player who is weak tactically but strong positionally then you are also going to lose.

Here is the game.

```
[title "Carlsen - Tari, Altibox Norway Chess 2020"]
[fen ""]

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. d3 b5 7. Bb3 d6 8. a4 Bd7 9. c3 Na5 10. Ba2 c5 11. Bg5 O-O 12. Nbd2 Rb8 13. axb5 axb5 14. Re1 b4 15. Nc4 Nxc4 16. Bxc4 bxc3 17. bxc3 Qc7 18. Qc2 Bb5 19. Bxb5 Rxb5 20. Bxf6 Bxf6 21. Nd2 Qc6 22. Qa4 Rfb8 23. Nc4 Be7 24. g3 Qc8 25. Qd1 g6 26. Kg2 Bf8 27. Qf3 Rb3 28. Rec1 Qe6 29. Ra7 R8b7 30. Rxb7 Rxb7 31. Ra1 h5 32. Ra8 Kg7 33. Ne3 Rc7 34. Nd5 Rc8 35. Ra7 Rb8 36. h3 Rd8 37. g4 hxg4 38. hxg4 Rd7 39. Ra8 f6 40. g5 f5 41. Qh3 Rf7 42. Re8 Qxe8 43. Qh6+ Kg8 44. Qxg6+ Kh8 45. Nf6 1-0

```

# Answer
> 14 votes
> Is there something wrong with my approach?

Yes.

> This is how I am playing nowadays and can beat ~1500 player 50% of time( rest is due to tactical errors)

> I mean i do wanna improve my tactical skill but my decision is that once i am able to beat a 1500 player 100% of the time,I will start playing tactical chess.

If I am reading this correctly, against 1500 players you lose about half the time, and when you lose, *it's almost always due to a tactical error*. But you don't want to improve your tactics until you beat the 1500 players more. That's sort of a catch-22. How are you going to beat them if you refuse to improve the one area of your game that's causing you to lose to them? Although I can understand your reluctance to play more tactical chess if you don't think you're good at it, practicing is the best way to get better.

Also, 100% isn't a realistic goal in the first place. Do you expect to play perfect chess every game? If you could get to 99% against 1500 you'd probably be titled. So how about instead, you set a goal of beating 1700 rated players 50% of the time? Seeing how a slightly higher rated player can beat you - without you making a tactical error - might help you get a perspective on your strategy.

As for the details of your strategy, they seem to involve getting superior pieces, and them trading them off. I won't say it's wrong to go into an endgame if you know you can win it. But if there's any doubt, you might be better off keeping the better pieces on the board.

# Answer
> 6 votes
If you are a player who is skilled in the endgame, it is not always a bad idea to head for an endgame. Magnus Carlsen, a fabulous endgame player who can grind for hours at a seemingly dead drawn position, will do this sometimes- head into an endgame, then push and poke and prod until his opponent collapses. This is certainly a valid approach, especially if you know that your opponent is weaker in endgames, or positional play more generally.

However, it takes two people to go into an endgame! This is especially true if your opponent has studied your play and seen that you do not enjoy highly complex, tactical, middlegames where attacking is necessary for both sides. If I knew that I would be playing you and had seen your games, I would be preparing a Sicilian Dragon right now! While it is important to be good in endgames and strong in positional play, good attacking capabilities and tactical prowess are necessary to have a flexible game that can be used for all kinds of situations (games where you must win, games where you must draw, games where your opponent must win and is going to press, etc), and can handle whatever course your opponent tries to take.

# Answer
> 6 votes
The tautological "correct" play is to only make moves which make your position better. Your formula makes some assumptions about what is "better," specifically that having fewer pieces on the board is better.

This is not always the case. Sometimes you might be trading an active and useful queen for a passive and entrapt queen, which stymes your attack. Such a trade is not useful. If you are on the attack, trading generally dilutes the attack. You want to get more for your trade -- you want to get a positional advantage as well.

However, the real challenge you will face in this situation is a circular logic that will form over time.

> 3. At the point where my pawns and pieces are in a better shape than opponent's, I first exchange the queens.

What makes "pawns an pieces" be "in better shape than opponents?" That's an open question, and the subject of countless Chess books. You answer that question with 4 and 5:

> 4. Centralise my king
> 5. slowly exchange all the minor pieces, then the rooks.

By definition, being "in better shape" starts to become "in a shape such that centralizing the king and then exchanging pieces results in a win." And this is where you can get in trouble. You are less inclined to explore tactical situations where this 2 step formula does not result in a win. And, as others have pointed out, it will be hard to grow to learn these positions if you avoid them.

The failure for this formula will occur at the point where you face strong enough opponents such that they not only fight on the board, they fight in your mind. They aren't just looking for strong positions on the board, they are looking for positions that your mind is weak at.

How do you find these positions mid game? Your opponent would do this by looking at the sorts of moves you choose, and the sorts of moves you elect not to play. If they start to recognize that you, as a player, prefer positions where "centralizing your king and slowly exchanging pieces" wins, they won't give you those positions. Indeed, they'll start giving you bait: positions where centralizing your king and slowly exchanging pieces results in a loss but *looks* promising. Then, when you least expect it, they drive you into a "tactical" line that you weren't prepared for.

What you describe is a plan. Famously, as Former President Eisenhower put it, "plans are useless, but planning is indispensable." Its fine to start games with your formula in mind, but make sure you are not enslaved to that plan. That goes for the metagame too. You may never reach the point where you can beat a 1500 player 100% of the time before you learn tactics. Be ready to deviate from that plan when you realize that it is starting to handicap you.

---
Tags: theory, tactics, middlegame
---


# Question
Title: The most efficient valid move generation for minimax
**Problem**

I am creating a chess engine in Python using Minimax algorithm (with alpha/beta pruning) but I have some issues with performance. Currently the thinking time looks something like this for a mid game position:

* Depth 1: 0.01 s
* Depth 2: 0.07 s
* Depth 3: 0.76 s
* Depth 4: 19.8 s

I have timed each function and here are the worst performing functions, time is per move at depth 4:

* get\_valid\_moves (10 s)
* deepcopy (8 s)
* get\_all\_possible\_moves (8 s)

**What I have tried**

I have tried to have the board represented as a 2D array (8x8) which is the easiest solution. With a 1D representation (10x12) I got a tiny bit better performance but not enough to increase depth.

**What I need feedback on**

Before I try to optimize my minimax function with transposition table lookups and such, I was hoping to have the most efficient way of calculating valid moves and all moves. Here is the process I currently use:

* Looping through 8 directions from the king location to find if I am in check and what pieces are pinned (8x8 loop)
* Get all possible (pseudo?) moves without considering checks or pins (8x8 loop to find all pieces on board and then add each pieces possible moves to a list)
* Get valid moves by seeing if I am in check or double check (removing moves from the all\_possible\_moves list if they are not legal)

**Here is an example of how I calculate possible moves for a piece, bishop in this case:**

```
def get_bishop_moves(self, row, col, moves):
    piece_pinned = False
    pin_direction = ()
    for i in range(len(self.pins)-1, -1, -1):
        if self.pins[i][0] == row and self.pins[i][1] == col:
            piece_pinned = True
            pin_direction = (self.pins[i][2], self.pins[i][3])
            self.pins.remove(self.pins[i])
            break

    directions = [(-1, -1), (-1, 1), (1, -1), (1, 1)]
    enemy_color = 'b' if self.is_white_turn else 'w'
    for d in directions:
        for i in range(1, 8):
            end_row, end_col = row + d[0] * i, col + d[1] * i
            if all(0 <= x <= 7 for x in (end_row, end_col)):
                if not piece_pinned or pin_direction == d or pin_direction == (-d[0], -d[1]):
                    end_piece = self.board[end_row][end_col]
                    if end_piece == '--':
                        moves.append((row, col), (end_row, end_col))
                    elif end_piece[0] == enemy_color:
                        moves.append((row, col), (end_row, end_col))
                        break
                    else:
                        break
            else:
                break

```

**Board 2D respresentation:**

```
start_board = np.array([
            ['bR', 'bN', 'bB', 'bQ', 'bK', 'bB', 'bN', 'bR'],
            ['bp', 'bp', 'bp', 'bp', 'bp', 'bp', 'bp', 'bp'],
            ['--', '--', '--', '--', '--', '--', '--', '--'],
            ['--', '--', '--', '--', '--', '--', '--', '--'],
            ['--', '--', '--', '--', '--', '--', '--', '--'],
            ['--', '--', '--', '--', '--', '--', '--', '--'],
            ['wp', 'wp', 'wp', 'wp', 'wp', 'wp', 'wp', 'wp'],
            ['wR', 'wN', 'wB', 'wQ', 'wK', 'wB', 'wN', 'wR']])

```

**Final questions**

Is there any way of doing the valid move generation differently (without using bitboards)? Am I overlooking something? It is not fun to work on the evaluation function when my engine doesn't reach more than depth 4... :)

# Answer
> 1 votes
You should not stop after figuring out where the bottlenecks are, you should go on to identify them. For example, do you invoke the get\_xxxx\_moves() every time around?

On the chance that you do:

Instead of listing all moves each time, you may be able to reduce the work needed by only updating the piece move lists that are affected by a move. The other pieces (status and valid move lists) are unaffected, and don't need recalculation.

Thus, the opening move e2-e4 only affects pieces that cover/attack the start square e2 (wQ, wK, wBf1 and wNg1), so those are the only recalculations needed. Nothing covers/attacks e4, so no more work to do right now.

And so on.

Bitboards can be more efficient, but as you explicitly said to exclude those, ...

---
Tags: engines, candidate-move, minimax
---


# Question
Title: How can I increase the search ply depth of my minimax function for my chess engine?
I have programmed a minimax function with alpha-beta pruning for a chess engine I am building. However, it is very slow and I cannot analyze to a deeper depth as it would take too much time. I believe this is because my alpha-beta pruning isn't efficient.

For example, for my engine to analyze a position to a depth of 4-ply (white moves, black moves, white moves, black moves), it takes 11.5 seconds to analyze about thirty thousand positions (taken from a middlegame chess example). Without the alpha-beta pruning, there would be about 100 000 positions, so the pruning removes 70%. Is this inefficient or is my computer just slow? And another piece of information (I don't know if this would affect the speed): the only analysis I am using is static analysis, so I count up how many points each side has in material as well as giving them a bonus of + or - 100 if there is checkmate.

*From SmallChess's suggestion I have already implemented*

* no deepcopy
* no shuffling
* checked generator

Below is my minimax function:

```
pose = 0
def minimax(board, depth, maximizing_player, alpha, beta): #table is board
    global pose
    children = list(board.legal_moves) #find all possible moves from certain position

    if depth == 0 or board.is_game_over(): #don't go deeper if game over/depth ended
        return calc_eval(board), None #calc-eval finds piece-values on board and adds them up. e.g. two pawns would be 2 points

    if maximizing_player == True:
        best_value = -float("Inf")
    else:
        best_value = float("Inf")

    for child in children:
        pose += 1
        board.push(child) #copy board and change it by moving the child move
        new_val = minimax(board, depth - 1, not maximizing_player, alpha, beta)[0] #recursively find value
        board.pop()
        if maximizing_player == True and new_val > best_value:
            best_value = new_val
            best_move = child
            alpha = max(alpha, best_value)
        if maximizing_player == False and new_val < best_value:
            best_value = new_val
            best_move = child
            beta = min(beta, best_value)
        if alpha > beta:
            break

    return best_value, best_move

```

# Answer
> 3 votes
* Build a cache. You're exposing yourself to endless transposition.
* Please don't shuffle your moves. I don't have the numbers but I doubt randomly shuffle all your lists can be quick. It's `O(n)`. I fail to see how it can address your repetition anyway.
* Double check your generator. Source code is not here, so I have no idea
* I don't know what exactly your `table` is, but deep copying can never be quick. Each deep copy would need to allocate some memory space. Don't copy, you need to make a move and then undo the move. In chess programming, we don't make a deep copy of the board at every node, we make a move and then undo it.
* Double check how exactly your chess board makes a move, is that efficient?

# Answer
> 2 votes
I need to get two things out of the way:

1. If your are concerned about performance, Python is not for you. The language just isn't built for this kind of thing. That said, I do think it can be useful for learning/building your first engine, but it's unlikely your engine will be very strong.
2. Speed improvements for an engine come from optimizations to the search algorithm, not move generation. If you spend the next month on the move generation (without bitboards), you *might* get some respectable gains, but they are sure to be orders of magnitude smaller than the improvements from the search algorithm.

aside: you should use NegaMax. When I was young and naive, I decided I didn't need it, and ohhh boy was I wrong.

---

That said, I will now answer your question.

1. Look at the data types you use with scrutiny. Python has a tendency to hide what's going on under the hood, and there's a signifigant difference between, for instance, lists and tuples. I'm not an expert on this, but generally use integers whenever you can.
2. Dynamic Memory Allocation = bad. SmallChess mentioned this, but I'm not sure you understood (or maybe you did) that it is about way more than just avoiding copy.deepcopy(). In essence, it takes the computer a non-trivial amount of time for the computer to store something new in memory, as opposed to modifying something else in memory. To leverage this, you have *one* board stored in memory, and when you make a move you just modify that one board in memory. If you aren't doing this, it's basically free speed.

---
Tags: engines, programming, python, minimax
---


title: Stockfish Evaluations

text:
# Question
Title: Stockfish Evaluations
I've been getting Stockfish to analyse lines of the KID, and the evaluation gives a score of around +1.5: White has a big advantage. How come this is true, when the KID is a playable(and good) opening? I've also seen the same problem with Stockfish analysing the Neo-grunfeld, and similar hypermodern openings where White gets a large center.

# Answer
Very related: Traxler Counterattack

The answer is effectively the same: White has roughly a +0.5 advantage in the starting position, and a shift of a few centipawns one way or another is acceptable, but if that advantage has grown to +1.5 there's a problem. Do note that the starting position of the KID, 1. d4 Nf6 2. c4 g6 3. Nc3 Bg7 4. e4 d6 *is* evaluated at about +0.5. If you are getting +1.5 book exit, you've gone into some dubious territory. It doesn't matter what human analysis thought of the line before the advent of computers - if you go into these lines today, and your opponents are armed with engines, you are asking for trouble.

That said, it's worth pointing out that the King's Indian is a difficult, unbalanced opening that even computers don't understand perfectly. That's why it is disproportionately represented in the opening book for engine tournaments - it gives great chances for one engine to outplay the other. *But*: even these engine tournaments do not usually start with book exit lines of +1.5. That's very likely going to lead to a 1-0, 1-0 game pair.

For illustration, here are some Stockfish evaluations of known bad lines:

* 1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Ng5 d5 5. exd5 Nxd5?! (see TCEC Season 15 games 43/44): +0.8
* 1. d4 d5 2. c4 c6 3. Nf3 e6 4. Nc3 dxc4 5. Bg5 f6?! 6. Bd2 b5 (see TCEC Season 18 superfinal game 8): +0.74
* 1. e4 d5 2. exd5 Qxd5 3. Nc3 Qe6+? (Patzer variation): +1.1
* Pawn odds (White starts without f2-pawn): -1.5
* 1. e4 e5 2. Nf3 f5? (Latvian): +1.7
* 1. e4 e5 2. Nf3 f6? (Damiano Defense): +1.9
* 1. e4 e5 2. Ke2? (Bongcloud): -2.1

As you can see, you have to play some pretty terrible lines to get \> +1.5 book exit.

In short, if you are Black, interpret the book exit evals as:

* eval \< 0. Obviously the best, but will never happen without cooperation from White.
* 0 \< eval \< 0.5. The next-best, this is what you will usually be shooting for.
* 0.5 \< eval \< 1. Most commonly seen in engine tournaments where the aim is to see if the engine can defend the inferior position. Not recommended for actual tournament play.
* 1 \< eval \< 1.5. These lines come close to being busted. You could conceivably play them if you are after an adventurous game, or if it leads to complicated positions where you could hope to outplay inferior opposition, but it's a bad idea to take them up as a mainstay of your repertoire. A computer can still conceivably defend Black's position, but humans are going to suffer.
* eval \> 1.5. If you ever include these lines in the opening book of an engine tournament, be prepared for viewers to start talking about how you've chosen these lines to make the engine with Black lose.

**Edit:** since some people were unconvinced about the role book exit plays in opening selection, see this article by Jeroen Noomen (who selects the openings used in the Top Chess Engine Championship, the unofficial world computer chess championship):

> The complexity of a position and the book exit evaluation are the most important selection criterions. Book exits have been checked with classical Stockfish (development version, contempt = 0) on a 16 core Ryzen system and Leela Chess Zero v0.26.0, with the net that played in the TCEC 18 superfinal. As mentioned above, book exits are significantly higher compared to season 16 and before, to keep the games interesting and avoid boring draws. Nevertheless, there are also some lines with a lower book exit, especially in the theoretically interesting lines.

Low book exits will lead to boring draws. High book exits can lead to wins, which of course bodes badly for the engine that has the worse position out of the opening. These openings might still be viable in human play, but the keyword here is "human play"; objectively they are subpar and against an opponent armed with engines you are asking for trouble.
> 6 votes

# Answer
KID is a notorious difficult opening for a chess engine to evaluate. Forget all those opening lines, just look at the standard positions based on standard positional terms.

* White has an advanced pawn on d5 in many lines. This gives space advantage.
* Even if White doesn't a pawn on d5, White's centre control is apparently stronger. Open d-file for the queen, more squares for the bishops etc etc.
* Better queenside spacing and pawn structure.
* **(Important)** Black often has to advances the pawns in-front of its king on the king side. But ... this is making chess engines worried because chess engines are taught not to push the king protecting pawns without a clear compensation.

KID is too complicated for a chess engine to evaluate properly. You need to push it into specific lines.

You will see the same problem in an opening setup where Black's idea is to give up the center control but opt for long term counter-play. Grunfield, KID, and hypermodern openings all fall into the category.
> 6 votes

# Answer
Note that Hikaru Nakamura and Garry Kasparov have both stated that engine evaluations in the KID that favor White shouldn't be fully trusted. In the 2015 Sinquefield Cup, Nakamura won a sharp attacking game against Wesley So after which Naka is quoted as saying:

> "Wesley, frankly, just needs to learn how to prepare better," Nakamura said. "He just really misunderstood the position." Nakamura said the computer evaluation can't be trusted…

Source: Mike Klein, "Nakamura Blasts So's Preparation, Vachier-Lagrave Also Lurking," Chess.com, August 30, 2015.

In a tweet, Kasparov said:

> Congrats to @GMHikaru on his victory today. The King's Indian requires the courage of your convictions & courage to ignore machine opinions!
> 2 votes

---
Tags: engines, analysis, stockfish, evaluation, kings-indian
---


# Question
Title: Why aren't early opening moves generally given exclamation marks?
As the title above, why aren't early opening moves generally given exclamation marks? I see question marks for obvious opening mistakes from time to time, e.g. 1.e4 e5 2.Nf3 f6? or 1.d4 d5 2.Nf3 Bg4?! But I almost never see exclamation marks for early strong opening moves. For example, after 1.d4 d5 2.c4 should be given an exclamation mark, being obviously a strong move, already challenging Black's center at move 2, or, 1.e4 e5 2.Nf3 Nc6 3.Bb5! the Ruy Lopez being considered the best way to challenge Black's center already at move 3, and so on...

# Answer
Wikipedia says the following:

> Exclamation points ("!") indicate good moves—**especially ones which are surprising or involve particular skill**. Hence annotators are usually somewhat conservative with the use of this symbol.

(emphasis mine). 2. c4 is the most played move after 1. d4 d5, therefore it doesn't receive an exclamation mark.
> 16 votes

# Answer
To try to give a concrete example consider Sax-Seirawan, Brussels 1988

```
[Event "World Cup"]
[Site "Brussels"]
[Date "1988.??.??"]
[Round "?"]
[White "Sax, Gyula"]
[Black "Seirawan, Yasser"]
[Result "1/2-1/2"]
[WhiteElo "2610"]
[BlackElo "2595"]
[ECO "B09"]
[FEN ""]

1. e4 d6 2. d4 Nf6 3. Nc3 g6 4. f4 Bg7 5. Nf3 c5 6. Bb5+ Bd7 7. e5 Ng4 8. e6  fxe6! 9. Ng5 Bxb5 10. Nxe6 Bxd4!! 11. Nxd8 Bf2+ 12. Kd2 Be3+ 1/2-1/2

```

(Annotation is mine to make the point)

In 1988 before this game `8 ... fxe6` was considered a blunder and the whole `5 ... c5` line was considered somewhat dubious. However Seirawan's find of `10 ... Bxd4!!` effectively gave birth to a major new line in the Pirc, and Chess Informant voted this the most theoretically important game for the first half of 1988. Later white found ways to avoid the draw, and line is considered fairly equal nowadays, but even back then such strong novelties as early as move 10 were rare, and now, especially with engines coming into use, have all but disappeared.

So back in 1988 Bxd4 was a very surprising, strong move in a position where Black previously had been thought all but dead. Thus back in 1988 it deserved at least one if not more exclams. However nowadays it is routine - as a ~1850 patzer I have had this very game a number of times. It has lost its surprise value, and so no longer deserves the annotation.
> 9 votes

# Answer
Exclamation (!) is a highlight in analysis. Either it indicates *strong* move, or it is also possible to indicate *unexpected* move. Something to which opponent is totally *unprepared*. Something which will be followed by inaccuracy (?). This could be different depending on what exact game it is. What will follow after *provoking* move? Exclamated move could be not optimal at all, making a weakness in your defense. Nonetheless, even making you weaker, it could lure your opponent into blundering entire game.

If that is the game from XIX century where opponents could be not prepared and preferred to accept gambits, then it was "!" move.

Today we have openings up to 12 moves, and the theory behind every variant shows equality, so even if it is Queen Gambit Accepted variant - opponents are already expecting you playing it, you would not catch any initiative.

It all depends what century is the game from.

Today everybody knows QGA and most likely will choose 1.d4 d5 2.c4 c6 and there will be no surprise in that.
> 4 votes

# Answer
Not many moves in the opening deserve exclams. A classic example was Morphy-Allies, Paris 1858: 1. e4 e5 2. Nf3 d6 3. d4 Bg4 4. dxe5! and Black will lose a pawn, or lose bishop for knight while enabling White to gain time by developing with the recapture.
> 3 votes

# Answer
As noted by the existing answers, opening moves are usually standard and as such expected to at least some degree.

Arguably, Fischer’s 1. c4 in the sixth game of the 1972 World Championship match could deserve an exclamation mark, since it was a remarkably good strategical move, albeit somewhat “meta-strategic”.
> 3 votes

# Answer
The !, ?, !?, and other such symbols are meant to highlight moves that are unusual in some way: Unusually good, unusually bad, unusually dubious depending on the opponent's response, etc.

If they were used on opening moves, then they'd appear with practically every single game of chess.

At that point they'd become just noise and people would ignore them. To have any impact, they have to be used rarely.
> 2 votes

# Answer
Lots of good answers here, but I'll add one perspective that's kind of been missed.

Every chess game starts out in a position that *has been played before by others*. The game continues in this state until, at some point, in some games, play evolves into a position **that has never been played before**. It is certain that you will not find an `!` on moves that simply replicate a game that has already been played before because there is nothing surprising about copying a line from another player into a position that both players know, understand, and have seen before.

Only once a game moves into a novel position are the players truly challenged to demonstrate their skill and you will typically not see `!` used until it produces such a novel position, and only rarely even then.

When Einstein published the theory of relativity, he was hailed as a genius. `!`

When an undergraduate physics student turns in the same equations as homework a hundred years later, they simply get to come back the next day instead of being sent home with an **F**.

`!` is relative. If you're the first person to make that move, sure - you deserve it. If, 20 years later, that move is standard play into a line 3 moves deeper yet and you're just dancing through an opening with your opponent...well, sorry, no `!` for you.
> 2 votes

# Answer
Why not

1. d4?!

or even

0. ?

(Arguably, Go is a deeper game and in any event, don't you have something better to do with your time than play games?)

Symbols like ? and ! are not meant to communicate *opinions*, which is what they would be if you sprinkled them on standard opening moves.

To forestall an objection, an informed opinion is still an opinion.
> 1 votes

# Answer
I've seen the first move annotated with (!) when the move was preparation for a specific game that was a surprise and it worked out. 1. e4!
> 0 votes

---
Tags: opening, annotation
---


# Question
Title: Why 2.d5 is much less common than other responses to the Mikenas Defense(1.d4 Nc6)?
I recently came across **1.d4 Nc6** while playing a game and I was immediatly tempted to play **2.d5**, and so I did it, then my opponent continued the game with **Ne5**.

After the game I went to an online database to check some reference on this opening, I saw it is called the Mikenas Defense, and to my surprise **2.Nf3** and **2.e4** are by far the most common responses to it, while **2.d5** occurs only in 5% of the games. I'm a ~1400 player and I'm still learning the basics of openings theory, I can understand that both of these moves help white to develop its pieces, but can't they be naturally developed after **2..Ne5**(which seems to be the most played move after **2.d5**) with something like **3.e4**?

```
[fen ""]

1. d4 Nc6
2. d5 Ne5
3. e4

```

# Answer
> 13 votes
Just the opinion of a 2000 player.

```

[fen ""]

1. d4 Nc6 2. d5 Ne5 3. f4 Ng6 4. e4 e6

```

The idea of this opening, and others like the Alekhine and the Two Knights Tango, is to lure the white pawns forward to make them easier to attack. Black gets a very cramped game, but it is playable.

```

[fen ""]

1. d4 Nc6 2. Nf3 d5 3. c4

```

The main purpose of Nf3 is to prevent black's knight from using that square. After normal moves, black will find that blocking the c-pawn advance is considered bad.

One of the general objectives in openings is to control the center. White can attack black's center with the c-pawn, yet black can't support this with his own pawn. This leads to a small increase in white's advantage.

# Answer
> 2 votes
D5 is fine to play, but it is commital and a bit lacking in mobility. I probably wouldn't play it.

Nf3 does a good job preventing a quick e5, and e4 claims the center nicely. Neither are too commital and leave room for all kinds of options.

# Answer
> 0 votes
Your statistics don't seem likely to be accurate.

From 365chess.com, the most common responses are:

```
        times    win   draw   loss    eval
2. Nf3  1,455   42.9   29.2   27.9   +0.42
2. c4     566   41.7   25.1   33.2   +0.49
2. d5     396   49.7   21.5   28.8   +0.57
2. e4     343   49.6   17.5   32.9   +0.20

```

As you can see, according to these statistics 2. d5 is actually more common than 2. e4 (although still much less than 2. Nf3), and it scores best both in practice (take that with a pinch of salt as the sample size is so small) and on evaluation. So I doubt there is anything wrong with this move.

Perhaps your statistics are for position rather than exact sequence of moves, as 1. e4 Nc6 2. d4 appears more than 4,000 times in the same database.

---
Tags: opening
---


# Question
Title: Longest period with each piece "hanging"
What is the longest period in a real game with a position in which all pieces were "hanging"? The game can also be rapid, blitz or blindfold, but both players should have at least a 2000 ELO.

To clarify, all of the pieces, except the pawns, must be still on the board and be takeable by the opponent, if the opponent has the move. Of course, the kings are not considered. A check is allowed but not necessary. It is not necessary that this capture would make sense (it is enough that a covered knight is "attacked" by a queen).

I do not think that such a position, if existent, "survives" very long, but perhaps someone will find a nice example.

# Answer
Since a game with all 14 pieces, as kings are excluded, hanging has probably not happened yet, and will not for a long time, I will answer as best as I can. Under these circumstances, I think that the best that can be done is to locate the highest number possible.

The highest that I have found so far is **6 hanging pieces.** I found the full score on chessgames.com. In the board position on move 23, Black can capture three White pieces, and likewise White can also capture three Black pieces.

```
[Title "Loal W Davis-Magesh Chandran Panchanathan, HB Global Chess Challenge, Minneapolis Minnesota USA, 5/19/2005"]
[FEN ""]
[startply "45"]

1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Ng5 d5 5. exd5 Na5 6. Bb5+ c6 7. dxc6 bxc6 8. Be2 h6 9. Nf3 e4 10. Ne5 Bd6 11. f4 exf3 12. Nxf3 O-O 13. d4 Rb8 14. a3 Re8 15. O-O c5 16. Nc3 cxd4 17. Qxd4 Nc6 18. Qh4 Bf5 19. Bd3 Bc5+ 20. Kh1 Bxd3 21. cxd3 Qxd3 22. Bxh6 Rxb2 23. Na4 Rc2 24. Nxc5 Rxc5 25. Bg5 Ne4 26. Bf4 Rc2 27. Ng5 Nxg5 28. Qxg5 Nd4 29. Rfe1 Rce2 30. Rxe2 Qxe2 31. h3 Nc2 32. Rc1 Qe4 33. Bg3 Ne3 34. Bf2 f6 35. Qxe3 Qxe3 36. Bxe3 Rxe3 37. Ra1 a5 38. Ra2 a4 39. Kg1 Kf7 40. Kf2 Rc3 41. Rb2 Rxa3 42. Rb7+ Kg6 43. Ra7 Ra1 44. Kg3 a3 45. Kf2 Kh6 46. Ra5 g6 47. Kg3 Ra2 48. Kf3 f5 49. Ra7 Ra1 50. Kf2 f4 51. Ra8 a2 52. Ra5 f3 53. Kg3 Kg7 54. Ra6 Kf7 55. Kf2 Ke7 56. Kg3 Kd7 57. Kf2 Kc7 58. Ra3 Kb6 59. Ra8 Kc5 60. Rc8+ Kb6

```

However, if you wish for **"pure"** position with **all pieces hanging,** I discovered a beauty on chessgames.com. It holds **yet another 6 hanging pieces** in the final position after the climactic *33. Be4!*

```
[Title "Veselin Topalov-Alexander Morozevich, NAO Masters, Cannes France, 2/22/2002"]
[FEN ""]
[startply "64"]

1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O b5 6. Bb3 Bc5 7. a4 Rb8 8. c3 d6 9. d4 Bb6 10. axb5 axb5 11. Na3 O-O 12. Nxb5 Bg4 13. Bc2 h6 14. dxe5 Nxe5 15. Nbd4 d5 16. exd5 Qxd5 17. h3 Bh5 18. g4 Nfxg4 19. Nxe5 Nxe5 20. Qxh5 Bxd4 21. Qf5 Nf3+ 22. Kh1 Qxf5 23. Bxf5 Bf6 24. Ra7 c5 25. Be4 Ne5 26. Rd1 Nc4 27. Bb7 Bg5 28. Bxg5 hxg5 29. b3 Ne5 30. Rd5 Rfe8 31. Rxc5 Re7 32. Rb5 Nd3 33. Be4

```

Lastly, just for giggles, the fastest way reach to such a position is a mere **6 moves.**

```
[title "me, chess.stackexchange.com 10/16/2020 Non-Unique Proof Game In 6.0"]
[FEN ""]

1. e3 e6 2. Qh5 Qh4 3. Qxh7 Qxh2 4. Ba6 Ba3 5. Bxb7 Bxb2 6. Nc3 Nc6

```

---

Addendum: See @Robert Gamble's answer for the record.

On a semi-related note, the record for the longest time *a piece* was “hanging” is **snipped**.
> 7 votes

# Answer
Improving on the answers provided by Rewan, here is a game from TWIC which, after move 34, **all 10 pieces on the board** are hanging (using the provided definition):

```
[FEN ""]
[Event "ch-Euro Blitz"]
[Site "Ajaccio FRA"]
[Date "2007.10.25"]
[Round "19"]
[White "Fressinet,L"]
[Black "Fridman,D2"]
[Result "1/2-1/2"]
[WhiteElo "2654"]
[BlackElo "2621"]
[EventDate "2007.10.25"]
[ECO "B12"]
[startply "68"]

1.e4 c6 2.d4 d5 3.e5 Bf5 4.Nf3 e6 5.Be2
Nd7 6.O-O Bg6 7.Nbd2 Nh6 8.c3 c5 9.Ne1 cxd4 10.cxd4 Nf5 11.Ndf3 h5 12.Nd3 h4
13.h3 Be7 14.Nf4 Bh7 15.Bd3 Qb6 16.Be3 Nb8 17.Bxf5 Bxf5 18.Nd3 Nc6 19.Nc5 Rc8
20.b4 a5 21.bxa5 Nxa5 22.Qa4+ Nc6 23.Rac1 Rc7 24.Bg5 Bxg5 25.Nxg5 O-O 26.Nf3
Bh7 27.Rc3 Rfc8 28.Rb3 Na5 29.Rb5 Ra8 30.Nxh4 Nc6 31.Nf3 Be4 32.Nxb7 Ra6 33.Rc1
f6 34.Ng5 Nb4 35.Rxb6 35...Rxb6 36.exf6 gxf6 37.Nxe6 Rd6 38.Nf4 Nd3
39.Rc4 Re6 40.Kf1 Rd7 41.f3 Ree7 1/2-1/2

```

Here is another game from TWIC in which **11 of the 12 pieces on the board** are "hanging" after move 27 by white:

```
[FEN ""]
[Event "TCh-SVK 2014-15"]
[Site "Slovakia SVK"]
[Date "2014.10.26"]
[Round "2.5"]
[White "Macko,M"]
[Black "Lisko,F"]
[Result "1/2-1/2"]
[BlackTitle "FM"]
[WhiteElo "2167"]
[BlackElo "2234"]
[ECO "D31"]
[Opening "QGD"]
[Variation "semi-Slav"]
[WhiteTeam "Liptovska sachova skola"]
[BlackTeam "TJ INBEST Dunajov"]
[WhiteFideId "14906490"]
[BlackFideId "14900157"]
[EventDate "2014.10.25"]
[startply "53"]

1.d4 d5 2.c4 e6 3.Nc3 c6 4.cxd5 exd5 5.
Bf4 Qb6 6.Qd2 Nf6 7.f3 Bf5 8.g4 Bg6 9.h4 h6 10.h5 Bh7 11.g5 hxg5 12.Bxg5 Nbd7
13.Qe3+ Kd8 14.Qd2 Bg6 15.e4 Be7 16.e5 Nxh5 17.Bxe7+ Kxe7 18.Qg5+ Kf8 19.O-O-O
Qd8 20.Qg4 Rh6 21.Bh3 f5 22.exf6 Ndxf6 23.Qg5 Qe7 24.Nge2 Re8 25.Rhg1 b5 26.Rd2
Qe3 27.Bf5 27...Qxg5 28.Rxg5 Kf7 29.Bxg6+ Rxg6 30.Re5 Rh8 31.Rc2 Nd7 32.
Re3 Nb6 33.b3 Nc8 34.Nd1 Ne7 35.Nf2 Re6 36.Re5 Rxe5 37.dxe5 Ke6 38.Nd3 Rh6 39.
Nd4+ Kf7 40.e6+ Ke8 41.Ne5 Nf4 42.Nexc6 Nxe6 43.Nxe6 Rxe6 44.Nxa7 b4 45.Nb5 Re3
46.Nd4 Rd3 47.Rd2 Rxd2 48.Kxd2 Kd7 49.Nc2 Nc6 50.Ke3 Ke6 51.a3 bxa3 52.Nxa3 Ke5
53.f4+ Kd6 54.Nb5+ Kc5 55.Nc7 g6 56.Ne6+ Kb4 57.Kd3 Kxb3 1/2-1/2

```

A CQL query that can be used to find these games is:

```
cql()
not check
pinned_pieces = pin

// Collect pieces that can be captured by non-pinned pieces
possible_captures_by_black = [BNRQ] attackedby (a & ~ pinned_pieces)
possible_captures_by_white = [bnrq] attackedby (A & ~ pinned_pieces)
capturable_pieces = possible_captures_by_black | possible_captures_by_white

// Add pieces that can be captured by pinned pieces
pinned_piece_captures = ~.
if piece pinned in pinned_pieces {
    pinning_piece = pin from [Aa] through pinned
    pinned_piece_captures = pinned_piece_captures | (pinning_piece attackedby pinned)
} then capturable_pieces = capturable_pieces | pinned_piece_captures

capturable_pieces > 10
sort capturable_pieces

```

---

Finally, since it was mentioned in Rewan's answer, here is a game in which a piece is hanging (using the same definition that Tim Krabbe provides on his chess records page for "Longest en prise") for **30 moves** (again, from TWIC):

```
[FEN ""]
[Event "Petr Izmailov Mem"]
[Site "Tomsk RUS"]
[Date "2009.06.28"]
[Round "5"]
[White "Ibrayev,N"]
[Black "Slugin,A"]
[Result "1/2-1/2"]
[WhiteElo "2406"]
[BlackElo "2100"]
[EventDate "2009.06.24"]
[ECO "B81"]
[startply "14"]

1.e4 c5 2.Nf3 e6 3.d4 cxd4 4.Nxd4 Nf6
5.Nc3 d6 6.g4 Nbd7 7.g5 Nd5 8.Be3
a6 9.Qd2 Qc7 10.O-O-O b5 11.f4 b4 12.Nce2 Rb8 13.Nc6 Qxc6 14.Nd4 Qc7 15.f5 e5
16.Ne2 Nc5 17.Bxc5 Qxc5 18.Kb1 h6 19.Ng3 Be7 20.f6 gxf6 21.gxh6 Rb6 22.Nh5 Bg4
23.Ng7+ Kd7 24.Be2 Be6 25.h3 Qc6 26.Rhe1 Qc3 27.Qc1 Qxh3 28.Rh1 Qg3 29.Rdg1 Qf2
30.Bg4 Rc6 31.Rd1 Rg8 32.Rhf1 Qg2 33.Bf3 Qg5 34.Rg1 Qe3 35.h7 Rxc2 36.Nxe6 b3
37.h8=Q Rxb2+ 38.Kxb2 Qc3+
39.Kb1 bxa2+ 40.Kxa2 Qa5+ 41.Kb2 Qc3+ 42.Ka2 Qa5+ 1/2-1/2

```

Starting at move 8, white can legally capture the black knight on d5 with the pawn on e4 every single move up to move 38 where white is in check.

This game was found with the CQL query:

```
cql()
flipcolor {
    btm
    piece Attacked in [RNBQ] attackedby p {
        sort line singlecolor nestban --> (move legal from p to Attacked +) > 24
    }
}

```
> 2 votes

---
Tags: middlegame, records, captures
---


title: Software To Create Chess Videos

text:
# Question
Title: Software To Create Chess Videos
Is there any free software to create chess videos? I see some nice videos on chess.com and on Youtube. The way arrows are drawn on the board, highlighting squares or pieces are really wonderful features.

# Answer
> 11 votes
Programs like ChessBase, ChessPad, Scid vs. PC, and Lucas Chess all let you highlight squares & draw arrows on the board. You can then just record what you're doing using regular screen recording software like the excellent oCam.

**Edit:** I've created a video showing how to use Lucas Chess to create instructional chess videos. View it here. (YouTube)

# Answer
> 2 votes
A very simple tool is Nimbus, an extension for Chrome. It is very intuitive and can be used to record Chess.com or Lichess analysis (with their respective arrow and highlighting tools), and you can use its drawing palette (does not work in Lichess) for rectangles, freehand lines, and a few others options. It allows to include the images of the webcam. The only downside I see is that it does not allow to crop the recorded area.

# Answer
> 1 votes
For a chess board: I recommend lichess study/analysis board or import function, chessbase reader, apronus, chess.com analysis board, SCID (Great resource by the way! Free, has a database, and you can spar the engine. It is like Chessbase but free), Peshka 6 (don't know much about it, its a russian interface where you can buy stuff on chessking and put it on peshka), or Lucas chess.

I personally use lichess \[https://lichess.org/editor\] because you can import games, they have a live master-game database, and if you have an account then you can play or make studies which can be used as like a way to store games into cloud!

For recording: I recommend oCam \[http://ohsoft.net/eng/\] If you're making instructional (expository) videos about famous chess games or opening/endgame studies. oCam allows you to crop your video recording screen resolution to however you like, therefore you can make it so that the video only records the chess board alone and not your screen. If you can't get oCam for whatever reason, you can also try Bandicam if you don't mind the 10 minute time limit + the watermark.

I recommend OBS \[https://obsproject.com\] (Open Broadcaster Software) if you want to stream yourself playing chess. You can adjust boundaries too on this program, but it is more to work with. Anyway this is the type of software that almost all (if not all) streamers use! It has a function that allows you to stream automatically live as you record.

For editing videos: You can try Wondershare Video Editor \[https://m.en.softonic.com/app/wondershare-video-editor-win\]. Even the free version should have enough permissions to allow you to edit a good portion of your videos, however it has a nasty watermark. To fix this, you can use oCam to record and your wondershare video and then play your wondershare video without exporting it, it just means you'd have to sit and record it. Otherwise just use windows movie maker or Lightworks!

P.s. For some reason, Camstudio is now riddled with adware and viruses, and also Screen toaster is now unavailable.

# Answer
> 1 votes
I use Movavi software for that. Movavi Video Editor is made to be used by anyone, but especially for those who don’t really have much knowledge in video editing but would like to learn. If you are new into this world, this is definitely the editor you will want to use. It’s great software to make chess videos.

---
Tags: software
---


# Question
Title: Analyze game and explain why bad moves break theory
Is there an automated way to analyze a game and explain in human language why a particular opening move breaks theory?

# Answer
You might be looking for something like decodechess.com/:

> The first AI chess tutor, DecodeChess explains the why behind chess moves in rich, intuitive language.

This screenshot shows an example of a position of DecodeChess's natural-language explanation for why, for example, Qa1 is good:

* Escapes the black queen's threat (Qf6(b6)-b2)
* Supports the rook at a7
* Threatens to play Bxd5
* Supports the rook at d1

Although you ask for something to "explain in human language why a particular opening move breaks theory," in my limited exposure to DecodeChess it focuses on explaining why you *should* make a particular *good* move, rather than why you should not have made a bad move.

DecodeChess has a free trial available, which is pretty limited in capacity (two "decodes" per day), and monthly and annual subscriptions to get unlimited access.
> 3 votes

# Answer
> Is there an automated way to analyze a game and explain in human language why a particular opening move broke theory?

The explanation part is very easy. Opening theory is the body of opening knowledge of what moves are considered to be good moves. When a move is made which isn't regarded by theory as good then it "breaks" opening theory and the reason it does so is because it isn't regarded as good.

The only difficult part of automating the process is building the database of all opening theory. Once you've done that comparing what is played in a game with "opening theory" is fairly straightforward. In effect this is what top level commentators are doing at events like the recent Altibox Norway event.

One additional, very obvious, problem is that as long as top level players are playing chess opening theory is changing and your database is out of date and needs to be updated.

Again, Altibox provides a very good example of this. In the first round game, Tari vs Caruana, Caruana's 13th move, Bxe3, was in the databases as a blunder which lost a pawn. It had only been played a handful of times. Caruana "broke opening theory" by playing this move.

After the game when he was asked about this he said that he had analysed the move in preparation and regarded it not as a pawn-losing blunder but as a pawn sacrifice which gave him an easy game and made life very difficult for his opponent. And so it proved. He went on to win the game. 13...Bxe3 has, for the moment, become part of opening theory in the Taimanov Sicilian.

Of course that is not the end of it. The move is bound to be analysed by other top players and if a way is found for white to hold on to the pawn with a good game then the move may again "break opening theory".

Here is the game:

```
[title "Tari - Caruana, Altibox 2020 Rd 1"]
[fen ""]

1. e4 c5 2. Nf3 e6 3. d4 cxd4 4. Nxd4 Nc6 5.Nc3 Qc7 6.g3 a6 7.Bg2 Nf6 8.O-O Nxd4 9.Qxd4 Bc5 10.Bf4 d6 11.Qd2 h6 12.Rad1 e5 13.Be3 Bxe3 14.fxe3 Be6 15.Qxd6 Rc8 {White is a pawn up but his pawns are doubled and the Black pieces are better than the white ones. Especially the bishop, so there is compensation} 16. a4 {this is a real novelty and the game is now original} h5 17. h3 Qxd6 18. Rxd6 Nd7 19. h4 Ke7 20. Rd2 Nb6  21. Nd5+ Bxd5 22. exd5 Nc4 23. Re2 Nd6  24. e4 a5 25. Ra1 Rc4 26. c3 f6 27. Re3 Rhc8 28. Kf2 g5 29. Bf3 g4 30. Bg2 R4c5 31. Bf1 f5 32. exf5 Rxd5 33. Rd3 Rcc5 34. Rad1 Rxd3 35. Bxd3 e4 36. Be2 Nxf5 37. Bb5 Nd6 38. Be2 Ke6 39. Rc1 Ke5 40. Rd1 Rc7 41. Kg2 b6 42. Ba6 Rf7 43. Be2 Rf8 44. Rb1 Nf5 45. b4 Ne3+ 46. Kg1 Nd5 47. Rb3 Rc8 48. bxa5 bxa5 49. c4 Nb4 50. Rb1 Kd4 51. Bf1 Nd3  52. Rb5 Rc5  53. Bxd3 exd3 54. Kf2 Kxc4 55. Rb1 Re5 0-1

```
> 2 votes

# Answer
It's possible to make an *attempt* to do this, although it would be inferior to the opinion of someone familiar with the opening.

A program can tell you when you've left its opening book, and what move(s) would have stayed in it. It can show you its evaluation of the standard move and its evaluation of the move played. It can show you the lines it expects in each. It would even be possible for it to tell you why it evaluates the position as it does, and this can be done in human language - something like "White's king is unsafe" or "Black's knight is on an outpost".

But the openings will sometimes result in greatly diverging lines without it being obvious why they diverge. Maybe it turns out that, in the non-theory line, the threat of a pin causes one side to have to play a move that exposes some other weakness, while in the theory line it's not a threat. But the pin doesn't actually happen in *either* line. It's pretty hard for an engine to list all the moves it *didn't* play.
> 1 votes

---
Tags: opening, software
---


title: Having knightmares, what to do?

text:
# Question
Title: Having knightmares, what to do?
I just hate when my opponent has the knights because most of my blunders happen due to them. I generally like endgames where my opponent doesn't have the knight. I also hate when the Knight enters my territory. So, what to do about this knight phobia? Should I just exchange all the knights in the opening?

# Answer
> 8 votes
The solution is: play better chess. Train your tactical skills so you can better anticipate the opponent's knight's threats (and also make a better use of your own knights). Avoid creating weak squares in dangerous spots of the board where an enemy knight can dominate the position. Pay attention to how stronger opponents play and try to imitate them in the future.

Sure, you can also make inferior trades to eliminate the opponent's knights, but then you are already making a concession and "surrendering" to those knights before they even start putting you in trouble.

# Answer
> 5 votes
Well, you surely could do that, try to use openings that result in knights being cleared off the board. However, that is just a temporary and partial solution. Your opponents might not collaborate and could try to keep their knights, especially if they know or suspect you don't play well against them.

Furthermore, when there is a problem, it is usually best to face it. For this, you need tools, you need to know how to do it (trying to solve a problem without the right tools can be outright frustrating). So, you need to learn how to play against knights. Some suggestions:

* As already suggested by others, hone your tactical skills. Train to identify knight forks.
* Learn how to tackle knight vs bishop situations. See, for example the question engame with single Bishop or single Knight? The book *John Nunn's Chess Course* also has a section on this.
* Learn how to trap a knight. The book *Find the Right Plan with Anatoly Karpov* has a section named "A lasso for the knight" with some examples and exercises that may be useful.

Knowing how to deal with a knight helps taking away their scariness.

Finally, best improvement comes with practice. Practice what you have learnt in friendly games and games against the computer. Set up positions where the opponent has a knight and see if you can apply some of those techniques. And, of course, analyze your games to see what you could have done better.

# Answer
> 4 votes
While I mostly agree with the other answers that the solution to your problem is to grind tactics, there is one piece of advice in particular that changed the way I thought about knights: (I think this is from Silman...?)

Knights thrive on “advanced support points”—supported squares on the opponents side of the board that can’t be contested (this is slightly more general than an “outpost”). When playing against knights, make an effort to deny advanced support points. When playing with knights, try to create them.

Basically, shift your focus from the knights to the squares they can move to.

# Answer
> 2 votes
Perhaps you dont see Knight tactics because you find it hard to "see" where they go. Ideally, when you look at the board, you see not just where the pieces are, but also where they can go. Do you see Knight moves with less clarity than those of the other pieces?

They have some properties that are helpful in visualising. They always go to a squre of a color different from the one where they stand. If you imagine them to be at the center of a 5x5 block of squares, they go to, and only go to, the squares that other pieces can not.

You might practice solving the Knights Tour, where a Knight on an otherwise bare board has to visit every one of the 64 squares, but only once. Perhaps ypu can use the other pieces to mark where the Knight has been?

---
Tags: middlegame, knights, blunder
---


# Question
Title: How many new openings did Fischer use against Spassky in 1972?
Bobby Fischer's openings in the 1972 World Chess Championship are said to have taken Spassky completely by surprise:

> Fischer played always e4 as his opening move, in football terms he had a very limited playbook, he always played the same opening moves, and (in 1972 WCC) he defied the Russians (and the world) to beat him. From the age of 12 - 29, he played exactly the same opening moves.

In the 1972 World Chess Championship, how many new openings did Fischer use against Spassky, and across how many games did he use them?

# Answer
Fischer kept changing the openings quite a bit:

* Game 3 (black) he played a Benoni (slight surprise).
* Game 6 (white) he played c4 for the third time in a serious game (transposed to -QGD).
* Game 8 (white) he played c4 again and it was a proper English
* Game 9 (black) Queens Gambit Declined - Semi Tarrasch (slight surprise)
* Game 10 (white) he played c4 again (transposed to QGD Orthodox)
* Game 13 (black) he played Alekhine's defense.
* Game 14 (white) he played c4 (QGD)
* Game 17 (black) he played the Pirc Defense for the first time in his career
* Game 19 (black) he played Alekhine's defense again
* Game 21 (black) he played a line of the Sicilian (Taimanov) that was new to him.

You can check the list of opening here: https://en.wikipedia.org/wiki/World\_Chess\_Championship\_1972

And here are the list of Fischer's most played openings: https://www.chessgames.com/perl/chessplayer?pid=19233
> 6 votes

---
Tags: opening, fischer, 1972-world-championship
---


# Question
Title: What is the fifth position in the KN vs. KR endgame with the knight mating?
I can come up with 8 positions where the knight would deliver checkmate to a rook and king. However, on endgame tablebases, there are only 5 positions where a King knight wins against King rook. Why?

# Answer
> 2 votes
The positions are not unique if they are in some way symmetrical.

The five positions where KN wins vs. KR are:

1. White to play: White Kc1 Nd2, Black Ka1 Ra2
2. White to play: White Kc1 Nd4, Black Ka1 Ra2
3. White to play: White Kc1 Nc5, Black Ka1 Ra2
4. White to play: White Kc1 Na5, Black Ka1 Ra2
5. Finished game: White Kc1 Nb3, Black Ka1 Ra2

---
Tags: endgame, tablebases
---


# Question
Title: How should one take advantage of the "premove" function on chess.com?
Chess.com has a function called "premove". When pre-moves are enabled, while it’s the opponent’s turn you can make a move to automatically be played as soon as they make their move. The premove will play automatically even your opponent does something unexpected. If your opponent's move makes your pre-move illegal (such as putting your king in check), then your pre-move will be canceled).

My question is, under what circumstance should I use the premove function? I can think of the following scenarios:

1. My opponent has only one legal move. In this case, if I can determine my reply to this move, I may consider making a premove.
2. When I am in a very safe endgame (for example, KR vs KB, where I will not lose even after blunders by my rook) and I am running out of time.
3. In the early opening stage of a blitz game, when my opponent has only one reasonable move and for most of his "unreasonable" moves, my premove is still a good reply. For example, after 1. e4 c6, 2. d4, as white I can more or less safely assume black will play 2... d5 and (pre)play 3. Nc3 before black makes his second move. Even if black played 2... g6 or 2... d6 or 2... Na6, 3. Nc3 is still a sound reply.

Why is there such a function "premove" in the first place? What is the "best" way to make the most of this function?

# Answer
> 15 votes
I think case 4: Your premove is illegal unless your opponent does something very specific but entirely expected, is the most common case that I've seen. Like you offering a trade, and regardless of what they take with (including if there is only one way they can take), there is only one specific way you want to take back.

As an example, IM and chess streamer Eric Rosen, when he gets to play the Stafford gambit as black (1. e4 e5, 2. Nf3 Nf6, 3. Nxe5), he always plays 3. ...Nc6, then premoves 4. ...dxc6. Because if that capture is legal, it must be because the white knight captured the black one, and in that case he always wants to take back with the d-pawn.

Also notable example of useful premove (and the converse of case 4, more akin to your case 2) was a drawn endgame where Carlsen had the black pieces during this his 2020 online tour (can't remember which game, or the exact piece placemens, sadly, but I believe it was KQP or KQ versus KRP). He had established a fortress and could premove his rook back and forth between two squares on the sixth rank. The only cases where such a move would lose the game were cases where performing that rook move would be illegal. He had only seconds left and no increment, so he couldn't wait and see what move his opponent would make.

# Answer
> 13 votes
Since premove takes very little time (0.1 sec on chess.com) or no time (on lichess.org), they are mostly used in situations when players have very little time: in games with very short time control 3 min or 1 min or shorter!?, or in time scramble in games with no increment or very small increments.

I would be careful with using premove for case 3), in very short time controls, 1 min or less, people can try to trick you, for example if you just played `...g6`, they can play `Bh6` hoping that you premoved `...Bg7`.

**EDIT:**

There is another use for premove: Set a trap, and premove the "bait" move. People are a lot more likely to fall for it, thinking it is just a premove mess up. Eric Rosen gives a very good example: https://www.youtube.com/watch?v=oksV18QmCwo

# Answer
> 11 votes
Time left on the clock is the main factor determining whether a premove will be worth it or not. You should only do premoves when you are low on time.

Scenario 1 is great for premoves. In scneario 2 you should try to trade your rook for the bishop as fast as possible if you can't win. Scenario 3 is bad for premoves. I've seen so many Bullet games go 1.d4 Nf6 2.Nf3 g6 3.Bh6 Bg7.

Also note that if your premove turns out to be an illegal move it will be cancelled, so you may want to use it for recaptures. For example, if you have a knihgt on d5 protected y a bishop on c4, you can premove Bxd5 to be played instantly if the knight gets captured.

# Answer
> 6 votes
If you play without any increment (that I really hate), then sometimes premove is necessary, eg you have 3 sec left in a KQ vs KP ending.

Apart from that, the only time I use premove for is when I offer a trade and premove a retake. So that if they refuse the trade, the premove is illegal and cancelled.

# Answer
> 3 votes
You listed a lot of the main uses for a premove. I completely agree with point 1. For point 2, even if blundering the rook won't lose the game in a K+R vs K, you still want to win and not draw. After all, if you don't want to win, why not let your clock run out? It'll be a draw due to a lack of mating material for your opponent. So when you're premoving in this situation, try to make it so that your rook is always protected by the king, or far away. In either of these cases, the rook should check the opponent's king or control squares around it, in order to prevent your opponent's premoves from always being legal (forcing them to manually move). Alternatively, you could try boxing the enemy king in, with the case of your king always protecting your rook, with the goal of actually checkmating and not winning on time. Which way you play depends on how much time both sides have.

For point 3, it's a bit debatable. If *all* of your opponent's unexpected moves don't cost you material (or something worse), then go ahead and premove. But if there are *a few* that would be bad, it's more a matter of taste. E.g., after 1.d4 Nf6 2.c4 g6, would you premove 3...Bg7? Sure you save a bit of time, but you're going to lose a bishop in the case of 3.Bh6 (I see a few other answers have included this example too). Meanwhile, in the position after 3.Nc3 Bg7, it would be completely fine to premove 4...0-0. There's no move White has that would give them a winning position against this.

Another good strategy is to always premove recapturing a piece that could be taken (assuming it would be best to recapture it). If the piece is captured, you've saved time; meanwhile, if the piece isn't captured, the premove won't happen and you've lost nothing. The slight downside is that the board might show a preview of your premove while you're waiting for your opponent to move, which could make it a bit harder to calculate. This isn't a big deal though, and on Lichess they don't do this.

On the other side, let's say you're trying to exploit the fact that your opponent is premoving. If they've played the last many moves pretty fast (like premove fast), you could consider trying a dirty trick, like the 3.Bh6 move. This involves getting a feel of how fast they're playing though, since if you tried something like 3.Bh6, your confidence level should probably be at least 50% (if their rating is around yours). It's also rather unsportsmanlike, so it depends on whether you care about being nice or winning as much as possible.

# Answer
> -1 votes
Premoves should only be used if the move is illegal if not for a very specific move the other player makes. An example would be

```
e4 e5
Nf3 Nf6
Nxe5 Nc6

```

Here black can premove dxc6 because it will only be legal if white’s move is Nxc6.

Another reason would be if you are low on time, as the other answers so aptly described.

---
Tags: online-chess
---


# Question
Title: How to prepare opening for correspondence thematic tournament
I like to play correspondence thematic tournaments as a way to practice/learn new openings/variations. Since they are unrated, I sometimes try wild/unusual moves to see what happens. However, I was wondering which is the best way to prepare for this kind of tournament if one wants to obtain best results (=win as many games as possible).

Thematic tournaments are those where all players start the game the same way, with a previously decided opening variation. This gives you the opportunity to study in advance the said opening. How do you do that? And how do you choose your moves?

Previously, I have taken the rather simplistic strategy of choosing the move with the highest winning percentage according to the database. But this sometimes leads you to inferior situations if you don't look to what happens in posterior moves.

Also, in correspondence games (ICCF, at least), players may use any help (books, databases, computer engines) they like in choosing their moves. So opening traps are unlikely to work.

**UPDATE 20-10-2020**

I am not interested in getting advice for a particular opening, but rather on the method you follow to prepare for such a tournament. Also, one of the interests of thematic tournaments is the opportunity to find and test new/unusual lines. I am also interested in the method to do this.

# Answer
> 3 votes
I don't play correspondence chess myself (if I have occasionally it's without engines), but I have written a few opening books. The research aspect of both activities share some similarities.

In the tournament, I'm assuming you're allowed to use engines and databases. I'd recommend getting the best engine available (Stockfish 12), downloading the updated TWIC database, getting the up to date ICCF database, and possibly buying any recent books on the opening in question. You could try looking into renting someone's CPU time on the cloud to run Leela, but this seems excessive.

Then, before the tournament the main thing to do is to understand general important patterns in the opening you'll be playing. For example, who usually benefits from certain types of positions that can arise, where do the pieces tend to go in various circumstances, etc. Also try to learn the plans for both sides (how to develop, where to attack, etc). This will be useful to help *guide* the engine: i.e., to know what moves to get it to spend more of its time analyzing, since if those moves correspond to core principles, they have a higher chance of being right. Although there are always exceptions to principles and patterns!

When you're guiding an engine, this means letting it think for a bit. Then, when it comes up with a move (ideally at depth 30 or higher if you're very serious, otherwise, depth 25ish is okay -- although if it's absolutely clear only one move is acceptable, no need to let the engine think this long), play that move, and let the engine think again. Once you do this enough times, you can see what the evaluation is for the position you reach a number of moves later. This is a much more efficient way of analyzing than just letting the engine think on the starting position for some indefinite amount of time. Also, don't just play out the line with the best suggested moves, look at other moves as well when guiding the engine, and map those out for a while. It's possible an engine's third best move is actually the best one, which you could realize after analyzing it for many moves deep.

The exception to choosing a move the engine gives when guiding it is if the game is still early and you clearly know the move goes against the principles of the opening (based off your study of it). Like say it's on the 8th move and the engine wants to go against widely accepted theory - there's a good chance you can just ignore it. Another indication that the engine's move is poor is if it conflicts with the most common practice from the ICCF database. In this case, even if the game is later on in its development (say move 20+), ICCF games spend days on each move and use engines themselves. Although keep in mind that Stockfish 12 might be better than a game in the ICCF database from a few years ago, since the engine has made significant improvements. As in some cases, it might be that Stockfish 12 can do better in a few minutes than a correspondence player could guiding an old version of Stockfish (or another engine) for a few days.

As for finding and testing new/unusual ideas, don't worry about coming up with these before the tournament. During your games, when you guide the engine you can do this. If you see some wacky move that your gut tells you is good, and if the engine at least doesn't laugh at completely right away, then go ahead and guide the engine through analyzing this move. The engine might be a bit skeptical of the move at first, but if you play through the best moves it suggests (especially for each move being given at depth 30+), you'll have a better idea of the new move's validity at some point.

# Answer
> 3 votes
I’m not sure if a correspondence chess thematic tournament is the right place for learning the basics of an opening. For obtaining good results, i recommend:

1. Know your opening. Study all available grandmaster games, try to understand their plans. Get help by an engine, a book and/or a strong player. Be aware that the winning percentage of a line in a database is historical: The line might have been thought playable for a while, than the refutation was discovered, no one played the line since, so the winning percentage might remain high for a bad line. Don’t enter a correspondence chess thematic tournament until you have learned the opening. If you want to learn by playing, play a rapid online thematic tournament.
2. Prepare a new idea if possible. That’s something else than „wild moves“. And it is difficult. A lot of playable ideas have already been tried. But there are lines that have been played once and could be revived. And other moves have never been played and might prove correct. Test your ideas with some engines to see what happens. Your opponents will also use engines, so there is no need to play bad moves in a tournament just to see what happens and loosing a game by doing so. But don’t believe an engine a single word about complicated endgames ;-) That’s the reason why correspondence chess still exists in spite of engines.

While in an unrated thematic tournament, you will find players who do not respect their opponents and play „wild moves“, be kind and don’t do so. Even unrated events are taken serious by most of their participants.

---
Tags: opening, tournament, correspondence-chess, preparation
---


# Question
Title: Initial FIDE rating below floor, what happens?
I'm curious to know what happens in the following scenario:

I play a Swiss tournament and meet 3 rated players, I score at least half point but do badly overall. Then I play another Swiss tournament and meet another 3 rated players and do better this time.

Overall, my initial rating is below the rating floor of 1000 because of how badly I played against the first 3 rated players, and rating is not published.

My questions are:

1. Are my first 6 results discarded and I have to play 5 new rated opponents?
2. If yes to (1), do I have to score at least half a point in a tournament again before my results are considered for my initial rating?
3. If no to (1), are all of my first 6 results kept, forcing me to keep playing until I have pooled enough results to be above the floor of 1000 within 26 months?

Follow up scenario:

Assume the same thing happens as above, but I played 3 rated players in my first tournament and 6 in the second. My performance in the first one is terrible, but I did well in the second. If you pooled all 9 games, my rating would be below the floor, but if you only looked at my last 6 games, my rating would be above the floor.

What happens in this case?

# Answer
The rules FIDE use in calculating a player's first rating are outlined in the FIDE Rating Regulations effective from 1 July 2017.

The relevant sections are:

> 6.1 If an unrated player scores zero in his first tournament, his score and that of his opponents against him are disregarded. Otherwise if an unrated player has played rated games, then this result is included in computing his overall rating

and

> 7.14 A rating for a player new to the list shall be published only if it meets the following criteria:
>
> 7.14a If based on results obtained under 6.3, a minimum of 5 games.
>
> 7.14b If based on results obtained under 6.4, a minimum of 5 games played against rated opponents.
>
> 7.14c The condition of a minimum of 5 games need not be met in one tournament. Results from other tournaments played within consecutive rating periods of not more than 26 months are pooled to obtain the initial rating.
>
> 7.14d The rating is at least 1000.
>
> 7.14e **The rating is calculated using all his results as if they were played in one tournament** (it is not published until he has played at least 5 games) by using all the rating data available.

So, the answers to your questions are clear:

> 1. Are my first 6 results discarded and I have to play 5 new rated opponents?

Since you scored more than zero in your first tournament then all the results will be used in calculating your rating provided they were played within a 26 month window. So, provided 26 months have not elapsed then the answer is "No".

> 2. If yes to (1), do I have to score at least half a point in a tournament again before my results are considered for my initial rating?

If your next tournament was more than 26 months after the first two (i.e. "yes to (1)) then that counts as your first tournament and the rule regarding scoring zero in your first tournament applies.

> 3. If no to (1), are all of my first 6 results kept, forcing me to keep playing until I have pooled enough results to be above the floor of 1000 within 26 months?

According to 7.14e the answer is yes with the 26 month proviso. Every time an old tournament drops out of the 26 month window it is excluded from your results.
> 7 votes

---
Tags: tournament, rating, fide, elo, otb-chess
---


# Question
Title: How rankings or ratings of the players are determined before the next tournament?
My question is and I would like to know, Chess grandmasters Bobby Fischer\[AMERICA}, Boris Spassky\[RUSSIA\], Anatoly Karpov\[RUSSIA\], and Garry Kasparov\[Russia\]played against one another in many tournaments in Big cities. How their ratings or rankings were determined? Are the only basis their past performances? OR those who are engaged in Bettings play their roles? please take a look at the list of chess grandmasters who are famous at the international level from 1970- 1982.

# Answer
> Are the only basis their past performances?

Yes

> OR those who are engaged in Bettings play their roles?

None whatsoever.

According to the Olimpbase website:

> Back in 1942 the USCF used its own chess rating system (Harkness) to rank domestic players, while German Chess Federation did the same in 1948 (Ingo system). In 1959 one Arpad Elo was nominated chairman of USCF rating committee and already in 1961 he published the very first list of top US players in "Chess Life". Even though prof. Elo used to publish his own, unofficial International Rating Lists it was 1970 FIDE Congress held in Siegen, Germany that adopted the Elo system for official use. The first official list was to be published on 1st July 1971 and it was approved on consecutive FIDE congress in Vancouver, Canada, in August 1971.

Elo's unofficial international ratings dating back to 1967 are available on the Olimpbase site as are FIDE ratings from 1971 to 2001. From 2001 the FIDE ratings lists are available on the FIDE website.
> 2 votes

---
Tags: analysis, tournament, rating, online-chess, performance
---


title: Non-Standard Knight Development

text:
# Question
Title: Non-Standard Knight Development
From its starting square, a knight has 3 legal moves: The “standard” one (c3, f3, c6, f6), the “weird” one (a3, h3, a6, h6) and the “other” one (d2, e2, d7, e7).

In my games, I almost always do the standard move. And I completely overlook the other move by my opponent, to my detriment. When are the weird and other moves preferred?

# Answer
> 11 votes
It's probably first worth revisiting why the "standard" moves are normally preferred.

A white knight on c3 defends white's central square e4 and attacks black's central square d5. That is that knight attacks/defends/supports 2 out of the 4 central squares. In the opening those 4 squares are the most important squares on the board (unless you fall for a cheapo).

In contrast a knight on d2 only defends white's central e4 square. On d2 the knight is only half as effective as it is on c3. By symmetry the same arguments apply to knights on f3, c6 and f6.

In general in *open games* these four squares are the best ones for the knights on their first move. In closed positions it is not quite so clear cut. Often other factors make other squares better or just make those squares impossible.

In closed and semi-open openings these squares may not all be available and moving a knight there may not be possible. The Advance Caro Kann is probably the best example of this. After:

```
[fen ""]

1. e4 c6 2. d4 d5 3. e5

```

black can't put a knight on c6 because it is already occupied by a black pawn and f6 is also out of bounds because it is attacked by the white pawn on e5.

In the Winawer variation of the French Defence white puts a knight on c3 but this is a very committal move. Black can pin the knight with Bb4 and a double edged tactical battle is likely. Consequently at higher levels Nd2 is preferred heading into a Tarrasch variation of the French. This satisfies the key requirement of the position, defend the attacked white pawn on e4, while also avoiding the pin from the dark squared black bishop and allowing the d4 pawn to be defended with the move c3.

The other reason for moving a knight to d2/7 is to protect the other knight developed on f3/6 when it is pinned to the queen thereby allowing the queen to move without risking doubled pawns if black decides to exchange bishop for knight.

Finally moves like Nh6 use the h6 square as a staging post aiming for f7 or f5. These ideas come up regularly in the French Defence. Here are a couple of examples:

```
[fen ""]

1. e4 e6 2. d4 d5 3. e5 c5 4. c3 Nc6 5. Nf3 Bd7 6. a3 f6 7. Bd3 fxe5 (7...cxd4 8. cxd4 Nh6 {with the idea of Nf7 to put more pressure on e5 and if} 8. Bxh6 gxh6 9. Nh4?! Qb6 10. Bxh6 gxh6 11. Qh5+ Kd8) 8. dxe5 Nh6 9. O-O Nf7

```

If you play openings like the French or the Caro Kann as black then you will become more familiar with these ideas. In any case you should be mindful of possible advantages in playing Nd2/7 to protect a pinned knight on f3/6 making it easier to break the pin and possible advantages in leaving c3/6 free for a pawn to support a pawn on d4/5 or to kick a bishop on b4/5.

# Answer
> 6 votes
This question is too general to have a definitive answer. There is no universal criteria to know where to develop a knight. For instance, after **1.e4 e6 2.d4 d5 3.Nd2 dxe4 4.Nxe4**, now 4...Nc6 would be the "weird" move, as it would make it harder for Black to push ...c5 which is one of his main plans in this position. 4...Nd7 is therefore a much more natural move.

Sometimes the "normal" square is simply not available. Think of **1.e4 c6 2.d4 d5 3. e5**

Another interesting example is **1. d4 f5 2. g3 Nf6 3.Bg2 e6 4.c4 d5**. Now 5.Nh3 is an interesting way to reach the f4 square, even though 5.Nf3 targetting e5 is probably the main option.

Finally, keep in mind that the first square we move our knight to is probably not its "destine". After **1.e4 c5 2.Nf3 d6 3.d4 cxd4 4.Nxd4 e5 5.Nb3 Nc6** we develop our b1 knight to c3 because we dream of putting it on d5. If its best square happened to be on c4, Nc3 would suddenly become the third best option.

# Answer
> 0 votes
Much more likely it is your other moves that cause your problems not that you did a 'standard' horsie placement and they used one that was not.

# Answer
> -2 votes
The "standard" movement of the knight in the opening is pretty much forced. Other than the Alekhine's knight movement (which is also inferior but not busted), other options of knight movement almost always give \>1 advantage to the other side, busted and convertible by engines.

---
Tags: opening, knights
---


# Question
Title: Difference between a grandmaster and an international master?
International chess tournaments are played in many cities in the world. What are the criteria that differentiate a chess grandmaster from a chess international master? Dibyendu Barua of Calcutta \[Kolkata\] played in London and is a chess grandmaster. In 1982 He defeated the then world number two ranked Viktor Korchnoi. Dibyendu Barua was awarded the grandmaster title in 1991 by FIDE. Dibyendu Barua was the second Indian grandmaster after Viswanathan Anand to become a chess grandmaster.

I would like to know who is greater, a chess grandmaster or a chess international master?

# Answer
> 11 votes
> What are the criteria that differentiate a chess grandmaster from a chess international master?

The current FIDE rules regarding the awarding of international titles are described in FIDE Title Regulations effective from 1 July 2017. Basically there are two ways to achieve a title - via norms or directly via achieving a given result in a world or continental championship or in an Olympiad.

The level of achievement required to be awarded a direct title are described in Table for Direct Titles effective from 1 July 2017.

For instance the GM title is awarded to the top 16 players in the World Cup, the winner of the Women's World Championship, the outright winner of the World S65, S50 and U20 Championships, the outright winner of Continental Championships and the Continental S65, S50 and U20 Championships.

The IM title is awarded to the losing finalist in the Women's World Championship, the silver and bronze winners in the World S65, S50 and U20 Championships, the winners of the World U18 and U16 Championships, the silver and bronze winners in the Continental Championships, the winners of the Continental S65, S50 and U20 Championships, the winners of the Continental U18 Championships.

Qualification via norms requires 3 (or 2 for very long tournaments) "norm" level performances in high level tournaments combined with reaching a certain rating. These rules are complicated and you should refer to sections 1.4 and 1.5 of the document on the the FIDE website.

---
Tags: rules, fide, grandmaster, titles, international-master
---


# Question
Title: running stockfish with docker and docker-compose
I have access to a powerful computer at work so naturally I want to run a chess engine on it (stockfish for now and later leela). I am trying to use docker-compose to link a stockfish image and a jupyter notebook image; then use the python-chess library to interact with the uci version of the stockfish engine. I am having difficulty linking the images with docker-compose (I am new to docker). Here is what I have tried:

I set up my directory structure as below:

```
├── docker-compose.yml
├── jupyter
│   └── Dockerfile
└── stockfish
    └── Dockerfile

```

my Docker file for stockfish is from https://github.com/jessegersensonchess/stockfish-nnue-docker/blob/master/Dockerfile:

```
FROM ubuntu:20.04 as builder
RUN apt update && \
    apt upgrade -y && \
    apt-get install -y git make g++ wget && \
    git clone https://github.com/official-stockfish/Stockfish && \
    cd Stockfish/src && \
    CXXFLAGS='-march=native' make -j2 profile-build ARCH=x86-64-bmi2
WORKDIR /Stockfish/src
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y libgomp1 wget && apt-get autoremove -y && apt-get autoclean
COPY --from=0 /Stockfish/src/stockfish /app/
COPY --from=0 /Stockfish/src/*.nnue /app/
WORKDIR /app
CMD ["./stockfish"]

```

My dockerfile for jupyter:

```
FROM jupyter/scipy-notebook
USER root
RUN ["bash","-c","source activate root && pip install python-chess"]
USER jovyan

```

from the stockfish directory I can build the stockfish image and confirm that the uci executable is in the WORKDIR:

```
sudo docker build -t stockfish .
sudo docker run -it stockfish bash
root@mycontainerid:/app# ls -1
nn-eba324f53044.nnue
stockfish    <-- the uci engine executable

```

from the jupyter directory I can build the jupyter image and confirm that I can import the python-chess library:

```
sudo docker build -t jupyter/scipy-notebook .
sudo docker run -d -P jupyter/scipy-notebook
in [1]: import chess.engine  <-- the library to connect to uci engines

```

Now I try to link the images using docker-compose. My yml file look like this:

```
version: '3'
services:
   this_jupyter:
      build: jupyter
      ports:
         - "8888:8888"
      volumes:
         - .:/home/joyvan
   this_stockfish:
      build: stockfish
      volumes:
         - .:/home/joyvan

```

Ive tried a few variations of the yml file without success:

```
sudo docker-compose ps
         Name                      Command              State            Ports
---------------------------------------------------------------------------------------
stockfish_this_jupyter_1     tini -g -- start-notebook.sh   Up       0.0.0.0:8888->8888/tcp
stockfish_this_stockfish_1   ./stockfish                    Exit 0

```

my question is (a) why is the stockfish container not running, and (b) where will the executable be located once I successfully link to the jupyter notebook container?

UPDATE when I start the containers with docker compose (sudo docker-compose up -d) I get the following log files,

log file for jupyter:

```
sudo docker-compose logs this_jupyter
Attaching to leela_this_jupyter_1
this_jupyter_1    | Executing the command: jupyter notebook
this_jupyter_1    | [I 23:33:10.836 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
this_jupyter_1    | [I 23:33:11.782 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.8/site-packages/jupyterlab
this_jupyter_1    | [I 23:33:11.783 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
this_jupyter_1    | [I 23:33:11.791 NotebookApp] Serving notebooks from local directory: /home/jovyan
this_jupyter_1    | [I 23:33:11.791 NotebookApp] Jupyter Notebook 6.1.4 is running at:
this_jupyter_1    | [I 23:33:11.791 NotebookApp] http://648f6d3c8eca:8888/?token=f2d986295231a8adf0a3b3263d1177512090e2309972ca2e
this_jupyter_1    | [I 23:33:11.791 NotebookApp]  or http://127.0.0.1:8888/?token=f2d986295231a8adf0a3b3263d1177512090e2309972ca2e
this_jupyter_1    | [I 23:33:11.791 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
this_jupyter_1    | [C 23:33:11.800 NotebookApp]
this_jupyter_1    |
this_jupyter_1    |     To access the notebook, open this file in a browser:
this_jupyter_1    |         file:///home/jovyan/.local/share/jupyter/runtime/nbserver-6-open.html
this_jupyter_1    |     Or copy and paste one of these URLs:
this_jupyter_1    |         http://648f6d3c8eca:8888/?token=f2d986295231a8adf0a3b3263d1177512090e2309972ca2e
this_jupyter_1    |      or http://127.0.0.1:8888/?token=f2d986295231a8adf0a3b3263d1177512090e2309972ca2e

```

and the log file for stockfish:

```
sudo docker-compose logs this_stockfish
Attaching to leela_this_stockfish_1
this_stockfish_1  | Stockfish 181020 by the Stockfish developers (see AUTHORS file)

```

# Answer
not quite the solution I was looking for but everything is working with the following Dockerfile

```
FROM nvidia/cuda:10.0-cudnn7-devel

RUN apt-get update && apt-get dist-upgrade -y && apt clean all
RUN apt-get update && apt-get install -y curl wget supervisor git clang-6.0 ninja-build protobuf-compiler libprotobuf-dev python3-pip && apt-get clean all
RUN pip3 install meson
RUN pip3 install python-chess

RUN mkdir src
WORKDIR src/
COPY . .
RUN pip3 install jupyter
WORKDIR /src/notebooks
ENV TINI_VERSION v0.6.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--"]

RUN mkdir /lczero && \
    cd ~ && \
    git clone -b release/0.26 --recurse-submodules https://github.com/LeelaChessZero/lc0.git && \
    cd lc0 &&\
    ./build.sh

RUN cp /root/lc0/build/release/lc0 /lczero && \
    file /lczero/lc0 && \
    chmod +x /lczero/lc0

RUN cd /lczero && \
    wget https://github.com/LeelaChessZero/lczero-client/releases/download/v29/lc0-training-client-linux && \
    chmod +x lc0-training-client-linux && \
    wget https://storage.lczero.org/files/networks-contrib/J92-280

RUN git clone https://github.com/official-stockfish/Stockfish.git &&\
    cd Stockfish &&\
    cd src &&\
    make help &&\
    make net &&\
    make build ARCH=x86-64-modern

COPY supervisord.conf /etc/supervisor/conf.d/
COPY settings.json /lczero/settings.json
RUN service supervisor start

CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]

# sudo docker exec -it $(sudo docker run --runtime=nvidia --name leela -it -d -p 8888:8888 leela:latest ) service supervisor start

```
> 2 votes

---
Tags: software, stockfish, programming, python
---


title: FIDE Rules On Reading DURING Game

text:
# Question
Title: FIDE Rules On Reading DURING Game
Are you allowed to read a book unrelated to chess during a FIDE rated classical tournament game? I myself have done this a few times whilst studying for exams, but was never sure if it was allowed or not. I am 2100 so no one ever mentioned it. I'm hoping someone can post a definite answer.

# Answer
> 4 votes
There are two sections of the FIDE Laws of Chess which are relevant.

> 11.3.2.1 During a game, a player is forbidden to have any electronic device not specifically approved by the arbiter in the playing venue.

and

> 11.5 It is forbidden to distract or annoy the opponent in any manner whatsoever. This includes unreasonable claims, unreasonable offers of a draw or the introduction of a source of noise into the playing area

Use of a Kindle or other electronic book is governed by the first. You will have to get the arbiter's permission to read such a device during the game (or even to have it in the playing area) and this is unlikely.

For a traditional book printed on regular paper you just need to do it in such a way that it does not disturb your opponent (i.e. don't rustle the pages, put the book down noisily, etc.) as covered by 11.5. Although you would be well advised to talk to the arbiter first to clear the fact that the book contains no chess related material.

I have seen this done during FIDE rated league matches with no problems but not in large tournaments.

# Answer
> 3 votes
It should be okay but as the rules do not explicitly address this some picky opponent and retentive director might ban it because it might somehow give you an edge.

The closest thing which I could find in the FIDE Laws of Chess is

12.3 a. During play the players are forbidden to make use of any notes, sources of information or advice, or analyse on another chessboard

12.3 b. Without the permission of the arbiter a player is forbidden to have a mobile phone or other electronic means of communication in the playing venue, unless they are completely switched off. If any such device produces a sound, the player shall lose the game. The opponent shall win. However, if the opponent cannot win the game by any series of legal moves, his score shall be a draw.

Best would be to ask the TD before the match if you can read a non chess book.

---
Tags: rules, fide
---