Skip to content

Instantly share code, notes, and snippets.

View ChristopherKing42's full-sized avatar

Christopher King ChristopherKing42

  • Milky Way Galaxy
View GitHub Profile
--Roughly based on https://github.com/Gabriel439/Haskell-Morte-Library/blob/master/src/Morte/Core.hs by Gabriel Gonzalez et al.
data Expr = Star | Box | Var Int | Lam Int Expr Expr | Pi Int Expr Expr | App Expr Expr deriving (Show, Eq)
subst v e (Var v') | v == v' = e
subst v e (Lam v' ta b ) | v == v' = Lam v' (subst v e ta) b
subst v e (Lam v' ta b ) = Lam v' (subst v e ta) (subst v e b )
subst v e (Pi v' ta tb) | v == v' = Pi v' (subst v e ta) tb
subst v e (Pi v' ta tb) = Pi v' (subst v e ta) (subst v e tb)
subst v e (App f a ) = App (subst v e f ) (subst v e a )

This gives a proof of correctness of the algorithm at node_string.rs. Unless otherwise specified, lowercase letters are used for variables for single symbols and group generators, and uppercase letters are used for variables for strings and group elements. 1 is the empty string or the identity element of a group. X$Y means every symbol of A commutes with every symbol of B (as group generators).

Let G be a right-angled coxeter group over the set of generators S. This just means that G is a group presented by aa = 1 for each a in S and any set of equations of the form ab = ba (or equivalently abab = 1) for a ≠ b. In addition, there is a linear order < over S.

The algorithm rewrites strings of the form Xa into a canonical form, assuming X is already in

import Data.Array
import qualified Data.Set as S
import Text.Printf
newtype Puzzle = Puzzle (Array (Int,Int) Int) deriving (Eq, Ord)
instance Show Puzzle where
show (Puzzle arr) = unlines [concat [printf "%02d " $ arr ! (x,y) | y <- [0..3]] | x <- [0..3]]
blank = 0
win = Puzzle $ listArray ((0,0),(3,3)) $ [1..15] ++ [0]
@ChristopherKing42
ChristopherKing42 / HyperRogue_community_quotes.md
Last active January 6, 2021 03:05
Insane HyperRogue Community Quotes

Note: Links were not in the original, but added to help the reader

  • I want every possible Turing machine running in H2xE in an arrangement that allows me to always navigate to the desired Turing machine. (The 3rd dimension is for the tape).

    - bengineer8

  • I'm surprised by how rare the googol mutant ivy kills achievement is

- Lily

from opensimplex import OpenSimplex
from PIL import Image
import random
from heapq import *
mtns = OpenSimplex(seed = random.getrandbits(32))
hills = OpenSimplex(seed = random.getrandbits(32))
bumps = OpenSimplex(seed = random.getrandbits(32))
def terrain((x,y)):
CHRISTOPHER:
Thou art denceis, and the speak
Hos most every and these for his blest constort thee army
As I do many of the seavers,
That an the manst hould have a ther cause
That the world and more than dones,
The gons, I bet my wears in the every litte.
TALBOT:
These thing is and the morses of men with all their martis with
@ChristopherKing42
ChristopherKing42 / GitCoin
Last active April 5, 2018 23:11
A new "cryptocurrency"
/u/TheKing01: 25 git coins
/u/Chiron1991: 10 git coins
/u/polypeptide147: 10 git coins
/u/benderjacob: 5 git coins
sides = 7
order = 3
F.<rotate,move> = FreeGroup(2)
G = F/[rotate**sides, move**2, (rotate*move)**order]
k = G.rewriting_system()
k.make_confluent()
print k
print [(x.Tietze(), y.Tietze()) for x,y in k.rules().items()]
move = False
rotate = True
def hyperbolicTiling(n_sides, n_order):
assert 1/2 + 1/n_sides + 1/n_order < 1
class tiling(object):
sides = n_sides
order = n_order
def __init__(self, cell = ()):
# -*- coding: utf-8 -*-
import random
born = [3,6,7,8]
die = [0,1,2,5]
size = 30
def neighbors((x,y),g):