Skip to content

Instantly share code, notes, and snippets.

View Johnicholas's full-sized avatar
💭
I may be slow to respond.

Johnicholas Hines Johnicholas

💭
I may be slow to respond.
View GitHub Profile
@Johnicholas
Johnicholas / _Chalcraft-Greene automaton (attempt, possible bug)
Last active August 29, 2023 17:07
Chalcraft-Greene automaton (attempt, possible bug)
a Penrose gist

Keybase proof

I hereby claim:

  • I am johnicholas on github.
  • I am johnicholas (https://keybase.io/johnicholas) on keybase.
  • I have a public key ASAqlBjh92nay9QAaE-WwmXcxtjjcQkmHEUh1OuJ4Gm_UQo

To claim this, I am signing this object:

@Johnicholas
Johnicholas / game.txt
Created September 19, 2021 20:06
flickgame
{"gameLink":"www.flickgame.org","canvasses":[[2052,"0",7,"6",152,"0",9,"6",151,"0",10,"6",151,"0",10,"6",151,"0",10,"6",151,"0",9,"6",152,"0",9,"6",151,"0",9,"6",152,"0",8,"6",152,"0",9,"6",151,"0",9,"6",151,"0",9,"6",151,"0",9,"6",151,"0",9,"6",151,"0",9,"6",151,"0",9,"6",151,"0",8,"6",152,"0",8,"6",152,"0",8,"6",151,"0",8,"6",152,"0",8,"6",151,"0",8,"6",152,"0",8,"6",151,"0",9,"6",150,"0",9,"6",150,"0",9,"6",149,"0",10,"6",100,"0",16,"1",33,"0",9,"6",99,"0",20,"1",33,"0",5,"6",100,"0",23,"1",135,"0",28,"1",130,"0",32,"1",127,"0",35,"1",123,"0",39,"1",119,"0",42,"1",117,"0",45,"1",113,"0",48,"1",111,"0",51,"1",108,"0",54,"1",104,"0",58,"1",101,"0",60,"1",99,"0",29,"1",2,"2",32,"1",96,"0",29,"1",4,"2",32,"1",93,"0",30,"1",5,"2",33,"1",91,"0",30,"1",5,"2",35,"1",88,"0",31,"1",6,"2",36,"1",85,"0",32,"1",7,"2",37,"1",82,"0",33,"1",8,"2",38,"1",79,"0",35,"1",8,"2",39,"1",76,"0",37,"1",8,"2",41,"1",32,"0",7,"1",32,"0",40,"1",8,"2",42,"1",31,"0",18,"1",19,"0",42,"1",8,"2",44,"1",29,"0",79,"1",8,"2",45,"1",28,"0",79
@Johnicholas
Johnicholas / readme.txt
Created April 27, 2021 00:16
Deeper & Deeper (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
console.log(JSON.stringify(parser.parse("(first (list 1 (+ 2 3) 9))")) == JSON.stringify(["first",["list",1,["+",2,3],9]]));
let primitives = {
"first": (args) => {
if (args.length != 1) {
console.error("first called with unexpected number of arguments: ", args.length);
}
let the_arg = args[0];
let the_first_of_the_arg = the_arg[0];
return the_first_of_the_arg;
// Takes a three-element list, and returns X if it is won for X,
// O if it is won for O, and null if it is not won
function tripleIsWon(triple) {
var count_x = 0;
var count_y = 0;
for (var i = 0; i < 3; i += 1) {
if (triple[i] == "X") {
count_x += 1;
} else if (triple[i] == "O") {
count_y += 1;
@Johnicholas
Johnicholas / index.js
Created August 5, 2017 18:52
Example of simple AI
// utility functions
function dist(a, b) {
let dx = a.x - b.x;
let dy = a.y - b.y;
return Math.sqrt(dx * dx + dy * dy);
}
// GLOBALS GLOBALS GLOBALS
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
def helper(a):
if len(a) == 0
# base case
return 0, 0
else:
# recursive case
best_prefix_total, best_span_total = helper(a[1:])
# TODO
return foo, bar
#lang racket
(require rackunit
"prover.rkt")
(check-equal? (resolve '(or P) '(or Q)) 'no-resolvent)
(check-equal? (resolve '(or P) '(or (not P))) '(or))
(check-equal? (resolve '(or P (not Q)) '(or Q (not R))) '(or P (not R)))
(test-case
<?php
// a is not optional, b is optional, c is optional
function foo($a, $b = "b", $c = "c")
{
// does something complicated
}
// I want to call foo with a set to "x", b set to default, and c set to "y", but foo("x", "y") isn't the right syntax.
// so I wrap foo, like this:
function bar($a, $c = "c")
{