Skip to content

Instantly share code, notes, and snippets.

@Xom
Xom / yxahk.ahk
Created September 23, 2024 04:43
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 September 24, 2023 03: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

@Xom
Xom / cincopaus_orderedpairs.csv
Last active June 2, 2018 16:24
Cinco Paus wand effects ordered-pairs cooccurrence table using atseajournal.com data as of May 2018
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 50 columns, instead of 23 in line 4.
Cinco Paus wand effects ordered-pairs cooccurrence table using atseajournal.com data as of May 2018,Bleed,Break Wall,Build Wall,Called Shot,Charge Right,Chargeable,Charm Ghost,Continuing Ray,Corpse Explode,Corpse Treasure,Double Hit,Duplicate,Earthquake,Execute,Explode,Find Treasure,Forget,Freeze Left,Gem Kill,Grab Treasure,Heal Bottom,Hit,Identify,Instant,Kill Frog,Kill Lizard,Kill Rooster,Kill Twin,Move Door,Next Man Down,Niche Treasure,Penetrating Ray,Pillar Treasure,Polymorph,Proc Hit,Protect,Refracting Ray,Refresh Top,Short Ray,Shrimp Cocktail,Side Hit,Sleep,Slingshot,Spawn Shrimp,Teleport Other,Teleport Self,Thorn,Wall Hit,Wormhole
Bleed,0,4,7,0,15,2,0,3,0,1,0,1,0,0,7,3,0,4,0,3,8,0,2,6,0,0,0,4,3,0,4,7,7,6,10,8,4,9,3,0,6,9,0,3,5,6,4,9,1
Break Wall,2,0,0,5,5,3,5,2,1,1,1,2,3,6,9,1,1,1,4,5,3,3,5,5,8,6,1,2,3,6,0,8,0,1,5,4,2,5,3,5,6,3,1,1,1,2,3,4,2
Build Wall,5,6,0,6,6,3,7,0,2,0,3,0,6,0,7,1,2,1,2,2,9,2,4,3,6,2,5,3,1,3,3,5,2,4,5,8,1,5,1,2,8,5,2,1,6,3,8,5,2
Called Shot,3,3,2,0,5,2,2,2,1,1,1,1,2,6,6,0,0,3,0,3,6,
@Xom
Xom / xhr.js
Created February 26, 2017 04:04
XMLHttpRequest wrapped in ES6 Promise
// https://github.com/mdn/js-examples/blob/master/promises-test/index.html
xhr = function(url, responseType) {
return new Promise(function(resolve, reject) {
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.responseType = responseType;
request.onload = function() {
if (request.status === 200) {
resolve(request.response);
} else {
@Xom
Xom / Back Template.txt
Created November 20, 2014 19:36
Card Types for Tsumego
{{FrontSide}}{{Extra}}