A publicly available implementation of knewjade's NNUE based search heuristic for HATETRIS.

Overview

HATETRIS-public-beamsearch

A publicly available implementation of knewjade's NNUE based search heuristic for HATETRIS.

Based on knewjade's original work and description here.

This is the code used to obtain the current record of 302 points.

Setup

This should work in any environment that has rust set up, but we have only tried it on Linux based systems, so we can't promise that.

We assume familiarity with a command line system.

First clone the repository

git clone [email protected]:thecog19/HATETRIS-public-beamsearch.git

Then build and run with this command:

cargo run --release

This should install all dependencies and run the program. We output logs to stdout so you should pipe them somewhere if you want to review them. Something like

mkdir Output\ Logs/
cargo run --release 2>&1 | tee -a Output\ Logs/NAME-OF-OUTPUT-LOG.txt

should suffice

The Network

By default we start with a fully untrained network. On our machine we saw a drastic improvement after one generation and took only about three weeks to reach 302 points. Check your logs to see how the network is performing. By default the data lives in the Training folder.

If the program crashes, you can just re-run it and as long as the training folder is populated, things will resume normally. You may want to check for a dangling file in these scenarios.

In Training/Aeon X/Generation Y/Replay/, files will be of the type parent_xxx.bin and move_xxx.bin. If either one is interrupted mid-write for a given timestep, you will have to delete both the move file and the parent file for that timestep in order for the beam search to resume properly. The previous timesteps are not affected and will not need to be deleted.

If training, then in Training/Aeon X/Generation Y/Training/, files will be of the type epoch_xxx.bin. These can also fail mid-write; if so, you will need to delete the file from the most recent timestep. The other epochs will not be affected.

Training

Training functions by taking a given well, and running a mini-beam search on it, exploring the potential of the well. It generates a few child wells, which are rated based on their performance as the beamsearch rolls out. Wells that end in defeat are rated poorly, ones that do not are rated better. We explore twice the training beam depth, if the game ends in the 0 <-> beam depth move range, we rate it -1, if it ends in the beam-depth <-> beam-depth*2 range, we scale it between the best result and -1 to account for how close it got to being the "best" well of that generation. We do this for wells gathered from the last generation of games. We'll link to the longer description here, when we write it. For now, read knewjades description and go look at the code!

Loop Prevention

HATETRIS includes loop prevention rules, but by default our emulator doesn't include those rules, since they involve (in the worst case) checking the entire history of the game up to that point. We have a function in emulator.rs, network_heuristic_loop(), which would replace the standard network_heuristic() function and return not just the legal, loop-prevented, moves, but also return (if present) a game history showing the would-be loop. If your training stalls out because the master beam has an unbounded score, then what probably happened is that you hit an infinite loop; if so, try out network_heuristic_loop().

This function has not been tested at all, and even fewer guarantees are made about it than about the rest of the code.

Metaparameters

Metaparameters live in the constants file. They are "self-documenting" in that we didn't write a lot of documentation for them, but here are some you may want to tweak.

  • WELL_HEIGHT, WIDTH: Dimensions of the well itself.
  • HIDDEN: Number of hidden nodes in the network. More hidden nodes means a potentially better network, but will increase evaluation time.
  • CONVOLUTIONS: A list of the (x,y) rectangles used for convolutions. If you want a different shape, or want to add more shapes, use these.
  • MINIBATCH: How many positions are used for each epoch of the neural network training.
  • MAX_EPOCHS: How many epochs the neural network is trained for.
  • MASTER_BEAM_WIDTH: The size of the master beam search for a full generation. This beam search is done once per generation.
  • TRAINING_BEAM_WIDTH: The size of the small beams used to evaluate each position within an epoch.
  • TRAINING_BEAM_DEPTH: The number of timesteps to run the small beams for.
  • THREAD_NUMBER: Number of threads available. Change based on your CPU and computational availability.
  • AEON: Bookkeeping; used to separate multiple training runs from each other.
You might also like...
A webhook-based Discord slash command library

Slashook A webhook-based Discord slash command library. This is a WIP project. Please note breaking changes can occur within minor releases until vers

A cell-based esoteric programming language

Tape A cell-based esoteric programming language Tape is a cell-based, brainfuck-like programming language that has a readable syntax and a non-wasted

A collection of compilers based around compiling a high level language to a Brainfuck dialect.
A collection of compilers based around compiling a high level language to a Brainfuck dialect.

tf A collection of compilers based around compiling a high level language to a Brainfuck dialect. Built at, and for, the VolHacks V hackathon during O

Nimbus is a framework for building parachain consensus systems on cumulus-based parachains.

Cumulo -- Nimbus ⛈️ Nimbus is a framework for building parachain consensus systems on cumulus-based parachains. Given the regular six-second pulse-lik

cargo extension for flashing embedded rust programs via dfu based on jacobrosenthals cargo-hf2

cargo-dfu This crate provides a cargo subcommand to flash ELF binaries via dfu Most STM chips will probably work with this, although you might need to

A Rust Based GMod Module for finding system info.

gm_sysinfo Fetching System Information in Rust to Lua. Installation Download the Module. Compile it. Cry because it doesn't work. Spend 2 hours debugg

Pbot - pan93412's extensible userbot, which is full-documented, enginnered and based on Actor model.

pbot pan93412's extensible user bot, which is full-documented, engineered and based on Actor model. Usage Run cargo run --release [--features modules

Single-future, #![no_std] executor based on event bitmasks

Single-future, #![no_std] executor based on event bitmasks

Cloud-Based Microservice Performance Profiling Tool

Revelio Systems Revelio Systems is a student startup sponsored by UT Austin's Inventors Program in partnership with Trend Micro. Team: Tejas Saboo, So

Owner
Felipe
Felipe
Hi I'm Sophy, a discord bot in devlopment, soon I'll be available to help everyone (❁´◡`❁)

Sophy Bot Hi I'm Sophy, a discord bot in devlopment, soon I'll be available to help everyone (❁´◡`❁) Contribution Do you like me and want to help me?

Far Dragi 0 May 30, 2022
A library to access BGPKIT Broker API and enable searching for BGP data archive files over time from public available data sources.

BGPKIT Broker BGPKIT Broker is a online data API service that allows users to search for publicly available BGP archive files by time, collector, proj

BGPKIT 10 Nov 30, 2022
A Garry's Mod module that lets you check which fonts are available on the system

gm_fontsx Since apparently we're never getting a proper way to check for installed fonts on Garry's Mod, this has to exist ?? Usage require("fontsx")

Earu 4 Mar 14, 2022
MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine

MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box. For more information about features go to our documentation.

MeiliSearch 31.6k Dec 30, 2022
Equilibrium substrate-based node implementation and runtime

Equilibrium & Genshiro Equilibrium is a DeFi 2.0 cross-chain money market protocol with high leverage. With Equilibrium users can: Lend: lend out asse

null 6 Apr 18, 2023
dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle!

dm-jitaux is a Rust-based JIT compiler using modified auxtools, dmasm and Inkwell LLVM wrapper for boosting Byond DM performance without any hassle (such as rewriting/refactroing your DM code).

SS220 20 Dec 13, 2022
mdzk is a plain text Zettelkasten system that is based on the mdBook API.

mdzk A lovingly designed system and static publishing tool for your plain text Zettelkasten mdzk is a plain text Zettelkasten system that is based on

mdzk 176 Jan 4, 2023
The Voting example based on MoonZoon and Solana.

Voting example The Rust-only Voting example based on MoonZoon and Solana. MoonZoon is a Rust Fullstack Framework. Solana is a decentralized blockchain

Martin Kavík 26 Dec 8, 2022
A rust-based extension module for Halo 3: MCC PC

halo3-rs This project is a rust-based extension module for Halo 3 in the Master Chief Collection on PC. The DLL wrapper contains a collection of patch

null 2 Sep 19, 2021
A Github Actions based CI release template for Rust binaries

Rust CI Release Template A Github Actions based CI release template. This repo serves as a live template, and reference for building your own CI power

null 60 Dec 9, 2022