Thu 07 May 2026

Metropolis Shift - A Game for GUI Automation Bots

Posted by Al Sweigart in misc   

PLAY THE GAME ONLINE - I made a single-page browser game inspired by the clock scene in Fritz Lang's Metropolis — a futile, attention-demanding job that never quite stays done. You must click the orange buttons to turn them all green, and re-click any buttons that turn orange. You gain points when they are ALL green, and lose points if ANY are orange. This game can be played by hand or it can be used to test GUI automation tools such as PyAutoGUI (as explained in the book, Automate the Boring Stuff with Python.) The project is based in a git repo.

Read more...


Thu 07 May 2026

The Simplest MCP Example Possible in Python

Posted by Al Sweigart in misc   

A large language models is, at its core, a giant blob of many billions or trillions of floating point numbers which generate text following an initial prompt. By themselves, they don't have access to clocks, calendars, web browsers, calculators, or Python interpreters. MCP (Model Context Protocol) is a standard for giving LLMs access to tools like these. This blog post has a basic example of how you can run an LLM on your local laptop (using Ollama) and give it access to the Python programs you write (using FastMCP). (This blog post assumes you have basic experience with Python, installing Python packages, and running commands on the terminal.)

Read more...


Mon 04 May 2026

Python Truth Table Generator

Posted by Al Sweigart in misc   

I used an LLM to make a teaching demonstration web app: enter a Python expression using Boolean operators and it shows you the complete truth table for it. For example, you can enter a and b and it shows you all four combinations. Or you can enter ((a or b) and (c or d)) and not (a and d) and it shows you all 16 combinations. It also works offline, so you can save the .html file and use it anywhere. Explore it here: Python Truth Table Generator

Read more...


Thu 09 April 2026

Just a Huge List of the Prime Numbers

Posted by Al Sweigart in misc   

Prime numbers are whole numbers greater than 1 that only have 1 and themselves as factors: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137 and so on. It's surprisingly hard to find a just a huge list on the internet of them (even Wikipedia only lists the first thousand), so I made this page. To save on bandwidth, this page uses JavaScript code to generate them in batches of 100,000 prime numbers at a time. Click the Generate 100,000 More Primes button at the bottom to continue the list of primes. (Right-click the page and View Source to examine code comments to see how the JavaScript works.)

Read more...


Thu 09 April 2026

Can Large Language Models Understand Caesar Cipher? (April 2026)

Posted by Al Sweigart in misc   

Yes, even the "instant" or non-deep thinking models can understand Caesar Cipher text. As a quick test, I presented several different LLMs with the following (encrypted with key 13): PNA LBH HAQREFGNAQ GUVF GRKG? VS FB, PNYY ZR OL ANZR: PUEVFGBCURE ...which, when shifted back 13 spaces in the alphabet, is the original plaintext: CAN YOU UNDERSTAND THIS TEXT? IF SO, CALL ME BY NAME: CHRISTOPHER

Read more...


Wed 08 April 2026

Nested Loops Visualization Tool

Posted by Al Sweigart in misc   

Nested loops are a concept that beginner programmers sometimes have trouble with, so I created a nested loop visualization tool using Claude Opus 4.6 to demonstrate the behavior of nested loops using a clock interface. The loops are represented by clock hands and just as a seconds clock hand must make a full loop before the minutes hand increments by one, the innermost loops must complete a full loop to increment the outer loops. The web page works offline, so you can save it and share it anywhere.

Read more...


Wed 18 March 2026

Al Sweigart's Quickstart uv Tutorial

Posted by Al Sweigart in misc   

uv (written in lowercase even if it begins a sentence) is a Python package and project manager that has seen rapid popular adoption by the Python community. This is not a full tutorial nor necessarily a good tutorial for you (the uv documentation is great for that) but it's mainly a writing exercise for myself to think about the parts of uv that I use. It's a quickstart, with just the commands I used on my macbook to use it with terse notes that make sense to me. If a sentence exists in this tutorial, it's something I feel I should memorize like a flashcard. As such, it often lacks context or supporting details.

Read more...


Mon 16 March 2026

François Morellet Generator (JavaScript)

Posted by Al Sweigart in misc   

In the New York Museum of Modern Art, there's a piece by Francois Morellet titled Random Distribution of 40,000 Squares Using the Odd and Even Numbers of a Telephone Directory. It's a 200 by 200 grid, and Morellet would have his wife or one of his sons read out numbers from the phone book as a source of random odd and even numbers, and he'd mark the grid so that he could later paint them red or blue. This was 1960, so he had to do it manually. (I always thought it odd that his wife and sons aren't included in the credits.) Here in the 21st century, I knocked out a Morellet Python package in 15 minutes to generate them in milliseconds. But I wanted a more accessible version, so using Claude Opus 4.6 I vibe coded a JavaScript version with a few more features.

Read more...


Fri 13 February 2026

List of Free LLM AIs for Coding (February 2026)

Posted by Al Sweigart in misc   

Large language models (LLMs), the generative AIs that respond to text-based questions, can be a useful resource for learning to program. This blog post is a simple list of LLM services that are free, do not require a credit card to use, and have a web interface. I'll update this blog post from time to time. Assume that free services may have daily usage limits, and that sites that don't require registration may limit how much you can use them before signing up for a free account.

Read more...