Skip to content

Instantly share code, notes, and snippets.

@Xom
Xom / mmr_elo.md
Last active June 18, 2026 17:41
Batomon Showdown matchmaking wishes

Adapting Elo for Batomon Showdown

2026-6-15

Batomon Showdown is an upcoming async autobattler. For now, a demo is available. As of this post, the current version is 0.7.

Currently, for players near the top of the ladder, matchmaking prefetches opponents for all 16 Days, and the final rating update is computed based on all 16 opponents, regardless of the number of Days the run lasted. This prevents the player from influencing which opponents are included in the computation by manipulating the length of the run in reaction to how well the run is going and whether certain known high-rated opponents have been encountered yet.

I don't know what the current rating update formula is. But I think the most conventional and least surprising thing is to use Elo. In our particular case, I don't think we need Glicko or any other method that accounts for confidence in ratings, because we have a long "provisional" period in which the player sees thei

@Xom
Xom / unity.js
Last active February 28, 2026 15:25
Unity Cup junior year simulation
function factorial(n){
let r=1;
for(let i=2;i<=n;i++) r*=i;
return r;
}
const BINOM = []; // BINOM[n][k] is the chance for n team members to have k arrows
const CUBE_DIST = [];
for (let n=0;n<=5;n++){
@Xom
Xom / shapenames.csv
Last active January 24, 2026 04:45
An attempt to name shapes in riichi mahjong
Xom-original?
3 tanki (in context)
33 pair
34 ryanmen
35 kanchan
12 penchan
333 set (triplet)
345 run (sequence)
@Xom
Xom / yxahk.ahk
Last active May 27, 2025 21:42
Mouse macros (AutoHotKey) for Yi Xian: The Cultivation Card Game
; Mouse macros (AutoHotKey) for Yi Xian: The Cultivation Card Game
; Would be better with BlockInput to ignore user mouse movements during procedures, but BlockInput doesn't work on my computer. If you use this, you should definitely try adding BlockInput.
; demo at https://drive.google.com/file/d/18ROpgST0dG8geRo4OXfg6UoULKq_-kGG/view?usp=sharing
; middle-click to absorb
~MButton::
MouseGetPos, origX, origY
Send {LButton down}
Sleep 25
@Xom
Xom / CloudCuckooCountry.txt
Created March 30, 2024 00:38
Transcript of "Real-Time Strategy is incredible and you should play it" by CloudCuckooCountry
Transcript of https://www.youtube.com/watch?v=Rl4myN8q_KM
Real-Time Strategy is incredible and you should play it
by CloudCuckooCountry
== I love Age of Empires ==
I love Age of Empires. I only recently got into the series a few years ago with Age of Empires 2 Definitive Edition, and it was the gateway to an enormous amount of fun. Not only did it introduce me to one of the best game series of all time, and not only did it introduce me to the RTS genre as a whole, but it also led me to one of the most fun PVP multiplayer experiences I've ever had. And I normally suck at competitive games. But I've actually really enjoyed my time learning the skills to play these games, and playing with friends, in pub lobbies, on the ranked ladder, in customs, playing with mod- [interrupt by clip montage of various speakers]
== RTS is dead ==
@Xom
Xom / cardpool.txt
Last active October 25, 2023 14:56
Yi Xian guides
Each player has their own pool.
There are 8 copies of each card, except only 6 copies of Incarnation cards.
Exchanging and absorbing don't return cards to the pool!
Effects that gain a specific card create an additional copy of the card,
including Daoist Rhyme Omen choices other than At Own Pace. Generally,
effects that draw specific kinds of cards create additional duplicate
copies of cards in your pool, notably, Immortal Fates like Mental
Perception and Inheritance of Cloud Sword. At Own Pace takes a card out of
your pool, and the same is probably true of other simple draw effects such
Here's my 1000-Elo quickstart guide to chess:
I. Roughly speaking, a knight or bishop is worth 3 pawns, a rook 5, and a queen 9.
Being ahead on material is the primary form of advantage in chess, so if you can force a favorable trade, then do it. Likewise, you should do everything you can to avoid unfavorable trades.
If you get ahead on material, you can try to trade non-pawn pieces to magnify the proportion of your advantage. I read somewhere that trading pawns when you're ahead actually slightly reduces your chances of winning, but as a beginner I wouldn't spend too much effort thinking about that.
II. Your goal for the opening (other than exploiting your opponent's material blunders and not making blunders yourself) is to influence the four squares in the center of the board. That means occupying them with pawns and threatening them with pawns and pieces as much as possible.
As a minor caveat, try not to play Pawn to King 3 or Queen 3 if it would block your bishop that hasn't moved out yet
@Xom
Xom / language_models_in_games.md
Last active December 1, 2022 22:48
Language Models in Games: A Survey

Language Models in Games: A Survey (as of 2022-11-30)

From Wikipedia:

AI Dungeon is a text adventure game which uses artificial intelligence to generate content. The game's first version was made available on Google Colaboratory in May 2019, and its second version was released in December 2019. The AI model was then upgraded in July 2020.

I started reading about AI Dungeon two months ago, and I thought, it would be interesting to use a LLM (large language model, such as GPT) to derive conventional gamestate (such as health points) from arbitrary text. (There are several ways to get a boolean or numeric output from a LLM, the simplest of which is to prompt it to answer yes or no.) I found a number of existing examples, which can be classified by what kind of gamestate and interface they have.

I classify data into three kinds: conventional state, textual state, and display data. I define textual state as textual data that interacts with game mechanics via LLM

@Xom
Xom / README
Created November 12, 2022 01:04
Flavor Battle prompts
The craft_desc prompt uses the word 'dangles' so that if the generation contains 'dangl', it's rejected for repetition, and the generation is retried. (On the other hand, if the output goes ' is used to cast a magical spell called', then I keep it, because the spell name is usually different. But I should probably be checking to be sure that is indeed different from 'ray of sunshine'.)
The battle_desc prompt was a stroke of luck. The problem was to generate a complete battle with a detectable end. I had been resigned to giving up soon, when out of curiosity I tried asking, Who will win the fight? Let's think step by step. The model responded with a long block of noncommital waffling, followed by:
So... who will win the fight? Let's find out!
Round 1
Disciple of the Crane vs. Snake Fist Adept
[and so on]
I edited this result to remove mentions of weapons, and rearranged the first sentence of each round to start with a word other than 'The', so that when I began the last and unfinished line of the prompt with
@Xom
Xom / beyond_duplicate_bridge.md
Last active July 5, 2026 16:00
Beyond Duplicate Bridge: Generalizing Shuffle Duplication to Autochess, Deckbuilders, and other games

Beyond Duplicate Bridge: Generalizing Shuffle Duplication to Autochess, Deckbuilders, and other games

From Wikipedia:

Duplicate bridge [is a variant of bridge in which] the same bridge deal (the specific arrangement of the 52 cards into the four hands) is played at each table, and scoring is based on relative performance. In this way, every hand, whether strong or weak, is played in competition with others playing identical cards, and the element of skill is heightened while that of chance is reduced.

For bridge, shuffle duplication is straightforward because player choices don't affect which cards are dealt. In contrast, autochess is a genre of computer games in which players choose how many cards to draw each turn, and also choose cards to discard, causing those cards immediately to be shuffled back into the deck. A general shuffle duplication system must handle such complications.

The goal of shuffle duplication is to deal as similar a set of cards as possible while conforming to the probabilities