Skip to content

Instantly share code, notes, and snippets.

""" Script to find the (hopefully) least number of moves to solve a Waffle (wafflegame.net/)
The program works by greedily trying to find loops, in which N squares can be moved in a circle to where they should be,
which means we have corrected N squares in N-1 moves.
There's probably a lot of room for optimizations if you want it to run in 0.0000001 seconds instead of 0.000001.
(For example; I have never seen it need n squares in a loop and then later finding a loop with a length < n which
probably means logically it doesn't need to try shorter loops than the last loop found)
Author: Anton (@ntoonio)
@ntoonio
ntoonio / randtest.py
Created March 5, 2022 15:57
To settle a debate; when still having questions left to answer on a test with not enough time to do so - is it more effective to choose a single alternative and answer that for all questions (for example checking "A" on all) than to answer randomly
import random
import time
import sys
def createTest(a, n):
l = []
for _ in range(0, n):
l.append([0 for _ in range(0, a)])
l[-1][random.randint(0, a - 1)] = 1
@ntoonio
ntoonio / uhc_controller.py
Last active June 6, 2019 22:16
A python 3 script for controlling a Ultra Hardcore game in Minecraft
#!/usr/bin/python3
from mcrcon import MCRcon
import json
import datetime
import time
import os
import json
import math
import argparse
import random
@ntoonio
ntoonio / server_download.py
Created May 13, 2019 09:08
Minecraft server download script
VERSION_MANIFEST_URL = "https://launchermeta.mojang.com/mc/game/version_manifest.json"
import json
import requests
import argparse
import urllib.request
rManifest = requests.get(VERSION_MANIFEST_URL)
manifest = rManifest.json()
<html>
<head>
</head>
<body>
<pre id="output">
</pre>
<script src="GameOfLife.js"></script>