explaingit

doctorwkt/verilog_tic-tac-toe

Analysis updated 2026-07-18 · repo last pushed 2026-01-14

9VerilogAudience · developerComplexity · 3/5QuietSetup · moderate

TLDR

A Tic Tac Toe game implemented in hardware on an FPGA chip. The chip always wins or draws because every best move is pre-calculated and baked into the hardware as a lookup table.

Mindmap

mindmap
  root((repo))
    What it does
      Tic Tac Toe on FPGA
      Always wins or draws
      Pre calculated best moves
      Win and draw detection
    How it works
      Move lookup in hardware
      Serial terminal input
      Board position numbers
    Versions
      Original serial only
      HDMI display version
      Numeric keypad layout
    Tech stack
      Verilog HDL
      FPGA hardware
      Verilator simulator
      HDMI output
    Use cases
      Learn FPGA design
      Fun hardware project
      Study lookup table logic
    Audience
      FPGA hobbyists
      Hardware learners
      Tic Tac Toe fans

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Play Tic Tac Toe against unbeatable FPGA hardware using a serial terminal.

USE CASE 2

Learn how to implement game logic directly in hardware using Verilog.

USE CASE 3

Explore FPGA development by simulating the project with Verilator without needing physical hardware.

USE CASE 4

Display the game board on a monitor via HDMI while playing through serial input.

What is it built with?

VerilogFPGAVerilatorHDMI

How does it compare?

doctorwkt/verilog_tic-tac-toeagg23/openfpga-templateyii2004/tinycodesign
Stars9620
LanguageVerilogVerilogVerilog
Last pushed2026-01-142023-12-11
MaintenanceQuietDormant
Setup difficultymoderatemoderatehard
Complexity3/53/54/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 1h+

Requires an FPGA development board like TinyFPGA B2 or ULX3S, or alternatively Verilator installed for software simulation.

In plain English

This project is a Tic Tac Toe game where you play against a piece of hardware instead of a computer program. It runs on a small programmable chip called an FPGA, and the chip is good enough at the game that it will always win or at least force a draw against you. Instead of running software on a regular processor, the game logic is wired directly into the chip itself. A script pre-calculates every possible best move for the FPGA's side, and that knowledge gets baked into the hardware so the chip always picks an optimal response to your play. When you make a move, the system checks that it's valid, updates the board, looks up the best counter-move, updates the board again, and cycles back to wait for your next turn. There's also a module that watches for win conditions or draws after each move. You'd interact with the game by typing moves through a serial terminal connected to the board, where you send numbers corresponding to board positions. An alternative version contributed by another developer adds an HDMI output, so you can see the board displayed as nine colored squares on a monitor while still entering moves through the serial connection. That version renumbers the board positions to match a typical keyboard's numeric keypad, with 7-8-9 across the top and 1-2-3 across the bottom. The people most likely to use this are hobbyists and learners who already own an FPGA development board like the TinyFPGA B2 or ULX3S and want a fun, interactive project to put on it. The README doesn't go into detail about setup beyond the serial connection notes, but it does mention the project can be simulated in software called Verilator, so you could explore the logic without needing physical hardware. What's notable is the design approach: rather than computing moves on the fly, the best responses are all figured out ahead of time and turned into a lookup table embedded in the chip. This means the FPGA doesn't need to "think" during the game, it just instantly retrieves the right move, which is a natural fit for how hardware operates.

Copy-paste prompts

Prompt 1
Write a Verilog module that implements a Tic Tac Toe win checker that detects three-in-a-row for both X and O on a 3x3 board.
Prompt 2
Generate a Python script that pre-calculates every optimal Tic Tac Toe move and outputs a Verilog lookup table module for an FPGA.
Prompt 3
Write a Verilog testbench that feeds serial move inputs to a Tic Tac Toe game module and checks that the FPGA responds with valid optimal counter-moves.
Prompt 4
Create a Verilog module that takes a 3x3 Tic Tac Toe board state and outputs it as colored squares over HDMI using an FPGA.
Prompt 5
Explain how to set up Verilator to simulate a Verilog Tic Tac Toe project and feed it serial input to verify the game logic works.

Frequently asked questions

What is verilog_tic-tac-toe?

A Tic Tac Toe game implemented in hardware on an FPGA chip. The chip always wins or draws because every best move is pre-calculated and baked into the hardware as a lookup table.

What language is verilog_tic-tac-toe written in?

Mainly Verilog. The stack also includes Verilog, FPGA, Verilator.

Is verilog_tic-tac-toe actively maintained?

Quiet — no commits in 6-12 months (last push 2026-01-14).

How hard is verilog_tic-tac-toe to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is verilog_tic-tac-toe for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.