Using Claude to generate Z3/Python code for solving chessboard puzzles
By
John
Summary
The author explores using Claude (an LLM) to generate Z3/Python code to solve a chess puzzle: placing all pieces (king, queen, two bishops, two knights, two rooks) on a 6x5 board with bishops on opposite colors and no piece attacking another. This is part of a series comparing LLM code generation capabilities, following previous posts using Claude and ChatGPT to generate Prolog for similar chess problems.
Source

Key quotes
· 3 pulledPlace all the pieces—king, queen, two bishops, two knights, and two rooks—on a 6 × 5 chessboard, with the requirement that the two bishops be on opposite colored squares and no piece is attacking another.
I've written a couple posts lately on getting an LLM to generate code to solve chess problems. The first used Claude to generate Prolog and the second used ChatGPT to generate Prolog. This post will use Claude to generate Z3/Python code.
Incidentally, it's common for 'piece' to exclude pawns, as above. But then what do you call all the things on
You might also wanna read
Getting Good Results from Claude Code
dzombak.com·10mo agoA Practical Guide to Using Claude Code for AI-Assisted Development
The article provides a detailed guide on using Claude Code, an AI coding tool, to implement new features in a complex codebase. It emphasize
Building a Programming Language with Claude Code: A Case Study in AI-Assisted Development
The author details their experience building a new programming language called Cutlet over four weeks using Claude Code, an AI programming a
Claude Code for GTM: AI-Powered Lead Generation Software for Automated Go-to-Market Workflows
Claude Code for GTM is an AI-powered lead generation software that helps businesses automate their go-to-market workflows through natural la
Practical AI Adoption: Using Claude for Deterministic Simulation Testing at TigerBeetle
The article documents the author's experience using Claude AI to solve a technical problem at TigerBeetle involving deterministic simulation
Claude Code Debugs Low-Level Bug in Post-Quantum Cryptography Implementation
The author describes their experience implementing ML-DSA, a post-quantum signature algorithm, in Go over four days. Despite completing the
