This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE BangPatterns #-} | |
--Enables strict arguments, the X in mandelbrot | |
import Data.Complex | |
import Data.List | |
maxIter :: Int | |
maxIter = 50 | |
xMin, xMax, xPrecision, yMin, yMax, yPrecision :: Double |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Applicative | |
import Control.Concurrent | |
import System.Console.ANSI | |
import Data.List.Split | |
import Data.Char | |
mainGridString :: IO String | |
mainGridString = readFile "grid" | |
parseGrid :: String -> Grid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle, random | |
from lsystemconfig import * | |
stack = [] | |
def iterateLSystem(system, rule): | |
mutatedLSystem = "" | |
for char in system: | |
charAccountedFor = False | |
for oneRule in rule: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Complex | |
import Data.List | |
main=let(q,w,e,r,t,y,u)=(-2,1,0.01,-1.25,1.25,0.01,9)in writeFile"m.pgm"(("P2\n"++(show$length[q,(q+e)..w])++" "++(show$length[t,(t-y)..r])++"\n1\n")++((unlines.map(unwords.map(unwords.map show)))$((map.map)(\x->if x==(-1)then[0]else[x]))((map.map)(\c->(\c->if(magnitude$((iterate((\b a->a^2+b)c)(0:+0))!!u))>2then-1else 1)c)[[a:+b|a<-[q,(q+e)..w]]|b <-[t,(t-y)..r]]))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'cinch' | |
class CodeRunner | |
include Cinch::Plugin | |
match /(ruby|python|haskell|perl|cjam):.+/, use_prefix: false | |
def runCode(code, interpreter) | |
badKeywords = ["\`", "popen", "gets", "STDIN", "interact", "input", "system", "File", "file", "IO", "eval", "exec", "open", "write", "read", "Socket"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import colorsys | |
import cmath | |
import math | |
from multiprocessing import Process, Queue | |
# max: maximum coord to render to | |
# min: minimum coord to render to | |
# step: how much 1 pixel counts as | |
# chunkFactor: how many images to split it up into - allows for multithreading |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def safeMoveCursor(stdscr, direction, screenPosition, screenSize, cursorPosition, padX, padY): | |
if direction == "up": | |
if cursorPosition[0] == 0: | |
if screenPosition[0] > 0: | |
screenPosition[0] -= 1 | |
else: | |
stdscr.move(cursorPosition[0] - 1, cursorPosition[1]) | |
elif direction == "down": | |
if cursorPosition[0] == screenSize[0] - 1: | |
if screenPosition[0] < padY - screenSize[0]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV.length != 1 | |
puts "Must take input file as single argument." | |
exit | |
end | |
program = ARGF.read.split(?\n)#.map{|line| line.split() } | |
pointer = [0, 0] | |
direction = :right #left up down | |
stack = [] | |
ins = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Language specification | |
# A @bueue program is a simple number | |
# The @bueue interpreter generates the collatz sequence | |
# of that number and interprets each number in it as | |
# a small subprogramm. | |
# | |
# There is a queue available which can store bits. | |
# Opcodes mod 10: | |
# 0 - enque 0 | |
# 1 - enque 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def genBF(seed, length) | |
prng = Random.new(seed) | |
program = "" | |
loopDepth = 0 | |
length.times do | |
ins = [?+, ?-, ?<, ?>, ?,, ?., ?+, ?-, ?<, ?>, ?,, ?., ?[, ?]].sample(random: prng) | |
ins = ?[ if loopDepth <= 0 and ins == ?] | |
loopDepth += 1 if ins == ?[ | |
loopDepth -= 1 if ins == ?] | |
program += ins |
OlderNewer