Skip to content

Instantly share code, notes, and snippets.

@instinctive
instinctive / indonesia.md
Last active November 25, 2023 17:22
Indonesia Rules (Splotter game)
documentclass fontsize
extarticle
9pt

Indonesia

  1. Agree whether the amount of money players possess will be open or closed information.
  2. Each player takes a set of wooden markers and 100 rupiah. Place one marker on the first spot of each of the R&D tracks.
  3. Take one marker from each player and place them on the Turn Order track in a random order.
@instinctive
instinctive / bus.md
Last active November 25, 2023 17:39
BUS Rules (Splotter Game)

BUS Rules

Setup

  1. Put one of the 15 total passenger meeples on each of the four central intersections. Put 5 (4 if 3 players) time stones in The Clock area, with one of them on the home icon. Give the starting player marker to a randomly determined player.
  2. Each player takes 1 score marker, 20 action markers, and an (unlimited) supply of bus tokens and bus line sticks. Put the score marker on zero, and one bus token in the Bus Depot.
  3. In player order, each player picks two buildings from the supply and places them on any empty "A" location.
  4. In player order, each player places one bus line stick on any street without limitation.
  5. In reverse player order, each player adds one bus line stick using the normal rules for Line Extension.
@instinctive
instinctive / fpscala-02-02.md
Last active August 3, 2022 18:38
Functional Programming in Scala: Chapter 2, Exercise 2: isSorted

Functional Programming in Scala: Chapter 2, Exercise 2

Problem Statement

Write isSorted, which checks whether an Array[A] is sorted according to a given comparison function cmp(A,A) => Boolean.

Solution

The comparison function must evaluate to true for successive elements of the array.

@instinctive
instinctive / gcj-2022-r1c-a.hs
Created May 1, 2022 18:03
Google Code Jam 2022 Round 1C Problem A (Haskell)
-- boilerplate elided from gist
docase :: Int -> IO ()
docase i = do
printf "Case #%d: " i
_ <- getLine
ss <- words <$> getLine
outimp putStrLn $ solve ss
aside (x:_,_) = x

The Any Worker Problem

19391D8D-B4ED-4D20-BC30-D12CA5EBC816

In The Manhattan Project (TMP) boardgame, you may use any three of your workers to run this mine.

There are effectively six kinds of workers in TMP, the cross-product of three occupations: Laborers, Engineers, and Scientists, and two types of employment: Full Time Employee (FTE) and Contractor.

@instinctive
instinctive / seoul256.js
Last active September 6, 2021 15:39
Blink shell color theme - seoul256
black = '#4e4e4e';
red = '#d68787'; // red
green = '#5f865f'; // green
yellow = '#d8af5f'; // yellow
blue = '#85add4'; // blue
magenta = '#d7afaf'; // pink
cyan = '#87afaf'; // cyan
white = '#d0d0d0'; // light gray
lightBlack = '#626262'; // medium gray
lightRe
@instinctive
instinctive / recursion-schemes.md
Last active August 4, 2021 17:31
Recursion Scheme Thoughts

Here's an example function to determine whether a set is strongly connected with respect to an adjacency function, implemented with direct recursion:

connected :: Ord a => (a -> [a]) -> Set a -> Bool
connected f s = 
    go (take 1 $ Set.elems s) s
  where
    go _ s | Set.null s = True
    go [] _             = False
@instinctive
instinctive / Chess.md
Created May 12, 2021 03:02
Simple chess protocol

Simple Chess Protocol

Existing chess server protocols (UCI) do a lot of things we don't need. Hence this simpler protocol.

Your chess program will read and write lines of input and output. Informally, the first input line will either be black or white, indicating which side your program will play.

@instinctive
instinctive / Flutter and Android Studio.md
Created May 5, 2021 19:04
How to install Flutter and Android Studio

Additional undocumented steps needed:

  • Studio > Configure > SDK Tools > Command line tools (install them)
  • flutter config --android-sdk <path to /Sdk/>
  • flutter config --android-studio-dir <path to /Studio/>
  • export ANDROID_HOME=<path to /Sdk/>
  • export PATH=$ANDROID_HOME/platform-tools:$ANDROID_HOME/platform-tools:$PATH
  • flutter doctor
  • flutter doctor --accept-licenses
@instinctive
instinctive / hackage.js
Created March 2, 2021 03:39
Userscript to reorg the package contents pages on Hackage
// ==UserScript==
// @name hackage
// @namespace https://github.com/instinctive/
// @description Reorganize package contents pages on Hackage.
// @include /^https?://hackage\.haskell\.org/package/[^/]*$/
// ==/UserScript==
(function() {
function getStyleSmall(elt) {