You are browsing as a guest. Sign up (or log in) to start making projects!

GoldenElf

@GoldenElf

Joined June 7th, 2026

  • 5Devlogs
  • 2Projects
  • 1Ships
  • 7Votes
Ship Pending review

# Tractor (Card Game)

I created this desktop game because I wanted to have a simple game I could train an AI on and learn about machine learning techniques. I've finally finished the full game implementation that you can [download](https://github.com/GoldenElf58/tractor-ai/releases/latest) and play right now. Now I can begin training a machine learning model you'll eventually be able to play against.

## About Tractor
Tractor (AKA Upgrade/Shengji/升级) is a popular Chinese trick-taking card game where players score by capturing specific cards rather than winning tricks. Certain plays can also consist of multiple cards, making strategy more complex.

## About This Project
This project is a playable desktop implementation of Tractor supporting Windows, macOS, and Linux. The long-term goal is to train a machine learning model to play Tractor.

The initial plan was just to make a minimal working implementation of Tractor that an AI could interact with, but it evolved to become a fully playable desktop game with an interactive GUI. One thing that was surprisingly difficult to implement was handling Tractors and consecutive pairs. I had to redesign ho plays were represented to support plays with more card amount possibilities. I also had to implement helper functions for filtering and sorting cards based on specific criteria, making it much easier to handle the many edge cases involving consecutive pairs.

## Future Plans
Now that the core game is complete and playable, my next goal will be to create a machine learning model that learns to play Tractor through self-play. It'll also be an opportunity to explore reinforcement learning using frameworks like PyTorch on a much more complex problem than the small introductory projects I've done before.

  • 5 devlogs
  • 38h
Try project → See source code →
Open comments for this post

9h 45m 11s logged

Devlog #04 - GUI Improvements

This update focuses on making Tractor fully playable, adding needed game screens and polishing the overall experience.

Highlights include:

  • Main menu
  • Between-round summary
  • Game over screen
  • Improved pass-and-play support with hand hiding between turns
  • Player name customization
  • Resizable window
  • Faster startup time
  • Several bug fixes

The latest version is now available on the GitHub Releases page.

Better Pass-and-Play

There is now a start turn button while playing that keeps the current player’s hand hidden until they are ready to begin. This makes local pass-and-play much more practical by preventing players from accidentally seeing each other’s cards.

Game Flow

At the end of each round, a round summary screen is now shown that includes the winner, team scores, level changes, trump information, and other round details. The game over screen is also shown at the end of the game to show the winner and the final levels of each team.

Bug Fixes

  • Fixed issues that prevented GUI builds from launching correctly on some platforms
  • Fixed bug with the determination of pair trick winners
  • Fixed round transition issues

Future Plans

  • The long-term goal is still to train a machine learning model to play Tractor.
  • Continue to improve the interface and gameplay experience.
0
0
2
Open comments for this post

7h 6m 42s logged

Devlog #03 - Implemented Tractors and Consecutive Pairs

This update adds support for Tractors and Consecutive Pairs, labels players’ plays and bids with their names, and includes several bug fixes.
Also, the project hasn’t shipped yet, but you can still download and try the latest version on the GitHub Releases page.

Gameplay Improvements

Players can now play Consecutive Pairs, including Tractors, which are pairs of cards in the same suit that are consecutive in power. This makes the game essentially* feature complete in terms of gameplay functionality.
*Some rule sets also include throws. They are not currently panned because they significantly increase implementation complexity.

GUI Improvements

  • The players’ locations (relative to the active player) are labeled with their names (currently “Player 1”, “Player 2”, etc.).
  • Plays containing more than two cards can now be shown (previously unneeded, but now necessary with the addition of Tractors and Consecutive Pairs).
  • Offense and defense points are now displayed throughout the game.

Bug Fixes

  • Fixed the round leader not updating correctly.
  • Fixed the trick leader not updating correctly.
  • Fixed an issue where players were incorrectly forced to play a pair if they were out of the led suit when a pair was available and a pair was led.
  • Fixed a miscalculation of the offense and defense points obtained in a round (also causing incorrect round transitions).

Future Plans

  • Add main menu.
  • Show more information about the game.
  • Ship the game once the above are done.
  • Long term: Create an AI (using machine learning) to play against.
0
0
4
Open comments for this post

5h 33m 39s logged

Devlog #02 - Expanded Gameplay GUI

This update makes the game now fully playable through the GUI and includes various bug fixes. The attached video shows the new GUI in action during a trick and a half of gameplay.

Also, the project hasn’t shipped yet, but you can still download and try the latest version on the GitHub Releases page.

GUI Improvements

I expanded the GUI to work in all phases of the game, so you now no longer need the terminal to play. It also now displays information such as the:

  • current bid
  • trump suit and dominant rank
  • cards played in the current trick
  • other turn information

Gameplay Improvements

Added an Auto button during the drawing round that automatically passes a player’s turn if passing is their only legal move (similar to a previous terminal feature).

Bug Fixes

  • Fixed card corner transparency so the cards’ rounded corners render correctly.
  • Fixed several move generation bugs.

Future Plans

  • Add main menu.
  • Show more information about the game.
  • Decide on game variant and implement tractors and complicated throws.
  • Ship the game once it’s feature-complete.
  • Long term: Create an AI (using machine learning) to play against.
0
0
3
Open comments for this post

6h 45m 39s logged

I implemented a card selection UI for players’ turns. I spent a lot of time polishing the hover and selection/deselection animations. The attached video shows game play of two tricks: the first with a pair lead and the second with a single-card lead. Next steps are to provide more information than just the players’ hands and to extend this functionality to the drawing/bidding and burying phases.

0
0
2
Open comments for this post

8h 25m 17s logged

  1. Implemented the core Tractor game logic and a playable terminal UI. The game is functional, though not all edge cases have been tested yet and invalid input may still cause crashes.
  2. Wrote a README with installation and usage instructions.
  3. Set up a GitHub Actions workflow to automatically build and publish the Windows, macOS, and Linux executables.
0
0
10

Followers

Loading…