Skip to content

Instantly share code, notes, and snippets.

View nayakrujul's full-sized avatar

Rujul Nayak nayakrujul

View GitHub Profile
@nayakrujul
nayakrujul / ducks.md
Created August 6, 2023 10:37
How to play the Duck Game

How to play the duck game

This is a 2-player game.

First, we start with a line of blue rubber ducks (represented here as circles):

🔵🔵🔵🔵🔵🔵🔵
@nayakrujul
nayakrujul / ducks.py
Created August 5, 2023 15:00
Play duck game vs optimal computer
from typing import Generator, Optional
BOARD_SIZE = 10
def move(board: int, squares: tuple[int]) -> int:
for sq in squares:
board = (1 << sq) ^ board
return board
bash                                                0
lisp                                                210
genetic-algorithms                                  382
code-trolling                                       505
scala                                               720
deadfish                                            992
syntax                                              1294
checksum                                            1786
clock                                               1816

alphabet 1819

@nayakrujul
nayakrujul / answers.txt
Created June 11, 2023 16:29
Programs collected from the SEDE query for the Thunno 2 corpus
r
+
Z1
kH
’Ƙ¥, «ʋ!
ɦık+Ḋkg×Jn|
ɦı35dḊʋ⁴ȥæÞ½×Jn|£
24Ė17Ɗ913+C¤?L
P
RD*p
@nayakrujul
nayakrujul / corpus.py
Created June 11, 2023 16:28
Code used to generate the Thunno 2 corpus
import collections
digraphs = collections.Counter()
trigraphs = collections.Counter()
quadgraphs = collections.Counter()
with open("programs.txt") as f:
# List of all Thunno 2 programs collected by SEDE query
export function decode(inp, prediction, min_bits = 16) {
const out = [];
let bottom = 0;
let top = 0;
let bits = 0;
let acc = 0;
let i = 0;
let consumed = 0;
while (top - bottom + 1 > 2 ** (i - inp.length + 1)) {
@nayakrujul
nayakrujul / wordle-best-openers.csv
Last active November 9, 2022 18:46
The best Wordle openers, calculated using Information Theory (see Markdown at bottom for info)
Word Information
tares 8.464541687215725
teras 8.384621063737562
pelas 8.330901493791194
peats 8.246791141310833
tears 8.134442220668841
bares 8.085543736
dores 8.08469110802232
pears 8.082520569242499
pores 8.055957327018291