Almost a week ago I challenged myself to find out if it was possible to create an opening builder that combined ChatGPT and Stockfish, so I could create an opening book/course with a single push of a button.
I got a single negative comment on Twitter for trying to see if it was possible. As if it is worse that the engines use prose to explain chess vs. just showing them to us.
Maybe it is inane machine slop right now, but I’m not a professional at coding, I’m a hobbyist with not much experience in this area. So, If I can make something that works I’m pretty sure that it only will get better in the coming months and years.
Then there is of course the question, should we try to create something that potentially could replace chess writers? I think it is a fair question, but I think there always will be a demand for a human view, maybe AI products will make sure that writers put in the extra 10%? And if this material helps someone play better chess isn’t that okay? Either way, I think if you get angry with an engine generating words you should also be angry at it for generating moves.
For the generation of this first test repertoire I have used the GPT-4o-mini model. I found out that the GPT-4o model was quite expensive to use. The purple is when I tested out GPT-4o, which was better, but it would have been a much more expensive project. At $20.60 I think it is an acceptable cost for the many, many prompts I have tested the last week!
How does it work?
I have created a two-part script. The first step is to generate the repertoire and select all the moves. In the script, I define the goal of the repertoire. In this case, you all voted for a White 1. e4 rep that was for intermediate players and it had to be dynamic. I decided to specify it to all moves against the Sicilian and Include moves that occur 15% of the time or more. I used the Lichess opening explorer as a reference point for this and to get win% of all the moves.
The moves were selected based on a 3-way scoring system:
1. Stockfish eval
2. Win%
3. ChatGPT score for alignment with the opening goal
This then gave an average score for each move. For this repertoire, I decided to include a maximum of 3 moves that were within 0.4 centipawns of the top moves as candidate moves. This then gave ChatGPT something to think about for its scoring.
Here is part of the decision process for the first move:
### Summary of Trade-offs
- **Nf3**: Offers flexibility and a balanced approach, allowing for various transpositions. Best for players who enjoy strategic play without committing to a specific plan too early.
- **Nc3**: Leads to a solid, closed structure that is strategic in nature. While it is safe, it may not provide the dynamic positions an intermediate player might desire.
- **d4**: The most dynamic option, providing immediate tactical chances and aggressive play. However, it requires good preparation and knowledge of tactical themes, which may be challenging for some intermediate players.
### Conclusion
For an intermediate player aiming to create a dynamic opening repertoire, **d4 (Smith-Morra Gambit)** is the best choice. It offers exciting tactical possibilities and the potential for rapid development, catering to players who thrive on creating imbalances and seeking active play. However, if the player prefers a more strategic and flexible approach, **Nf3** is a solid alternative. **Nc3** can be considered if the player is looking for a safer, more positional game, but it may not fulfill the desire for dynamic play.
In the repertoire, the second move picked is 2. Nf3 even though ChatGPT awarded more points to 2. d4. I could alter the point scoring to give ChatGPT more control in later experiments, but this is just how far I got in one week. And I must admit I did not get enough sleep this week!
Once the entire repertoire was generated and saved as a PGN with the raw move data, I developed a second script to refine the data and create meaningful annotations.
I tested on a position from the Winawer and I have selected some outputs on this position after 1. e5 e6 2. d4 d5 3. Nc3 Bb4 4. a3:
In the position after 4...Bxc3+, Black seizes the opportunity to capture the knight on c3, simultaneously delivering a check that compels White to respond. This bold move not only snatches a valuable piece but also disrupts White's development and opens lines for Black's remaining pieces. However, this capture does come at a cost; the bishop on c3 can become a target, and the pawn structure may become compromised if White recaptures with bxc3. Nevertheless, this energetic choice aligns beautifully with an attacking mindset, fostering an environment ripe for tactical skirmishes and dynamic play as Black seeks to exploit White's weaknesses.
The move 4...Bxc3+ serves as a strategic coup, leveraging the pressure on the center while simultaneously disrupting White's pawn structure. By exchanging the bishop for the knight, Black not only gains the initiative but also opens the b-file for potential counterplay against White's queenside. This exchange can lead to doubled pawns for White, which may become a long-term weakness, while Black's pieces are harmoniously placed to exert influence over the center and the open lines. This move aligns seamlessly with our repertoire, setting the stage for dynamic play and tactical opportunities in the ensuing middlegame.
The move 4... Bxc3+ is a striking choice that immediately disrupts White's harmony, forcing a critical decision. By capturing the knight, Black not only gains a central piece but also compels White to respond, potentially leading to doubled pawns after bxc3. This opens the b-file for Black's rooks and creates dynamic opportunities for counterplay. While White may recover material with dxe4, Black can seize the initiative with moves like Qg4, targeting the e4 pawn and keeping pressure on White's position. This approach aligns beautifully with an aggressive repertoire, emphasizing active piece play and tactical chances, essential for cultivating a sharp and engaging style.
I have learned from this that it is a balancing act to create a good prompt that gives ChatGPT enough data to write something meaningful, but also not to make too strict guidelines. There is still a lot of meaningful information about tactics and the positions that I potentially could feed into the script, but again, this is where I got and now it is time to share the repertoire with you.
You can download the pgn below or preview it on Chessbase. It is quite lengthy at 214,000 words, which is maybe the double of a Lifetime repertoire on Chessable!
Maybe because of this reason, I cannot load it on Lichess. The length of the annotations is also something I want to cut down. And yes, I have tried to ask ChatGPT to be a little more economical with its words..
Preview: The Silicon Sicilian Slayer
Lichess Study with just the moves (*added a shorter annotation style too)
Okay, let me hear your thoughts and ideas!
/Martin
This is a fascinating experiment, and the failure is ChatGPT's, not yours. It just isn't good at writing about chess. A lot of sound and fury in its annotations, signifying very little, given how often it's wrong about stuff. The fact that it describes the Dragon as a passive setup is hilarious.
it's actually very good, i wish you had informed me, i can help you to save on cost and run on easier and for a longer time!