Skip to content

Instantly share code, notes, and snippets.

View shotarok's full-sized avatar

Shotaro Kohama shotarok

View GitHub Profile
@shotarok
shotarok / fout-quine.pl
Last active November 3, 2015 09:00
Quine shaped FreakOut Inc. logo.
$_=q{"9
zzw9stffwzjrb lzoop5x6l3xj98
rez0uehk014cs4uh72p qdhq6 o039t
pk94 zyj09rr vc4j vl4c2
0dwm4 x8c t9b wbjz
ux6w3 jc4 8t iqqv
l3gpc nd5 6t2 i2nq
xsvcy uu13 td1o 9n11j1654d7u6l6l
n1v539 f 6c7dp7k xpbxlyx7eri3wq1vk9 w
uttvi8j6qw4i68gjmdg5g3 65uw34rcvs3ldt0ue
@shotarok
shotarok / fout-quine.rb
Last active November 3, 2015 08:59
Quine of FreakOut Inc Logo
eval$s=
%w(s=%(eval$s =%w(#{$s})*"")
;base36encoded="gz7 v8c1f y6azn
l8vi pq3i129 l1lk yb6dj
3385g 95h mxb cg2f
aabtk tns yp d5a9
rqs1g ov8 dey awff
43r1a n6e0 7joo fgirz1eu3ol09r2a
43rln0 r 3n2rox3 ravoonncbxvwpddgo4 y
3vdmopycm4m1fpwltuir1l 8xk472nv87wg6uw0q
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import concurrent.futures
import sys
import subprocess
import time
from collections import defaultdict
from data import sentences
@shotarok
shotarok / Compiler Output
Last active August 29, 2015 14:04
FickleAI
[info] Running jp.ac.kyotou.kansai.fickleAI
func_entryPoint:
LDC 0
LDC 0
LDC 0
LDC 0
LDF body_entryPoint
TAP 4
body_entryPoint:
LDC 0
@shotarok
shotarok / sample.gcc
Last active August 29, 2015 14:04
SampleAI
LDC 0 ;; initial AI state
LDF 4 ;; Step Function
CONS ;; (init state, step func)
RTN
LDC 0 ;; Current AI state
LDC 1 :: AI direction move {0: up, 1: right, 2: down, 3: left}
CONS ;; (current state, move)
RTN
@shotarok
shotarok / random_walk.gcc
Created July 26, 2014 05:24
RandomWalkAI
LDC 8 ; seed number
LDF 4 ; step function
CONS
RTN
LD 0 0 ; load current AI state
LDC 1664525 ; A for 19
LDC 69069 ; B for 19
LDC 10000003; M for 19
LDF 19
AP 4
@shotarok
shotarok / LCGs.gcc
Last active August 29, 2015 14:04
Arith.gcc
LDC 8 ; now
LDC 3 ; A
LDC 5 ; B
LDC 13 ; M
LDF LCGs
AP 4
LDC 3 ; A
LDC 5 ; B
LDC 13 ; M
LDF LCGs
#include <iostream>
#include <cstring>
using namespace std;
const int N = 30;
const int LENGTH = 2*N+1;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
@shotarok
shotarok / myflatten
Created June 30, 2013 01:37
My flatten function !!
def myflatten(ary)
tmp = []
ary.each { |e|
if e.is_a? Array then
tmp.concat myflatten(e)
else
tmp.push e
end
}
return tmp
@shotarok
shotarok / gist:5367231
Last active December 16, 2015 03:08
Quick sort where space order is O(1)
# coding: utf-8
import random
def quick_sort(inlist, first, last):
if last - first < 1:
return inlist
pivot = inlist[first]
left, right = first, last
while left != right:
if inlist[right] >= pivot: