All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
Bluesky
Twitter
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Using Claude to generate Z3/Python code for solving chessboard puzzles

By

John

12h ago· 7 min readenInsight

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

Twitter / XUsing Claude to generate Z3/Python code for solving chessboard puzzlesjohndcook.com

Key quotes

· 3 pulled
Place 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
Snippet from the RSS feed
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. The puzzle is one

You might also wanna read