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
player(x). | |
player(o). | |
#domain player(P). | |
next(x,o). | |
next(o,x). | |
first_player(x). | |
{ happens(mark(P,C),T) } :- |
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
pos(go). | |
pos(jail). | |
pos(park_place). | |
pos(boardwalk(santa_cruz)). | |
ui_space(P) :- pos(P). | |
ui_title('Monopoly!!!!!'). | |
piece(dog). |
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
package as.adamsmith.etherealdialpad.dsp; | |
import android.media.AudioFormat; | |
import android.media.AudioManager; | |
import android.media.AudioTrack; | |
public class Dac extends UGen { | |
private final float[] localBuffer; | |
private boolean isClean; |
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
var sys = require('sys'); | |
var http = require('http'); | |
var buffer = require('buffer'); | |
var child_process = require('child_process'); | |
var Buffer = buffer.Buffer; | |
var PORT = 8765; | |
var SAMPLE_RATE = 44100; |
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
%%%% | |
%%%% A chromatic maze generator | |
%%%% | |
% By Adam M. Smith ([email protected]) | |
% This answer set program was designed to work with the Potassco (the Potsdam | |
% Answer Set Solving Collection) tools, namely "clingo". | |
%% Chromatic Mazes |
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
$ clingo instance.lp encoding.lp visualization.lp | lonsdaleite -cu | |
http://chart.googleapis.com/chart?chl=graph{node[shape=circle,style=filled,fillcolor=white,fixedsize=true];64[pos=%222,8!%22];58[pos=%225,7!%22];48[pos=%224,6!%22,fillcolor=black,fontcolor=white];47[pos=%223,6!%22];46[pos=%222,6!%22,fillcolor=black,fontcolor=white];45[pos=%221,6!%22];39[pos=%224,5!%22];37[pos=%222,5!%22];36[pos=%221,5!%22,fillcolor=black,fontcolor=white];33[pos=%227,4!%22];30[pos=%224,4!%22,fillcolor=black,fontcolor=white];27[pos=%221,4!%22,fillcolor=black,fontcolor=white];23[pos=%226,3!%22,fillcolor=black,fontcolor=white];22[pos=%225,3!%22];21[pos=%224,3!%22];19[pos=%222,3!%22];15[pos=%227,2!%22];14[pos=%226,2!%22,fillcolor=black,fontcolor=white];6[pos=%227,1!%22,fillcolor=black,fontcolor=white,shape=doublecircle];4[pos=%225,1!%22];47--48;46--47;45--46;39--48;37--46;36--45;36--37;30--39;27--36;22--23;21--30;21--22;14--23;14--15;6--15}&cht=gv:neato |
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
package as.adamsmith.riddle.instructions | |
import java.util.concurrent._ | |
object InstructionBuilders { | |
def after[A](children: Instruction[A]*) = children.reduce(After(_, _)) | |
def during[A](children: Instruction[A]*) = children.reduce(During(_, _)) | |
def choose[A](children: Instruction[A]*) = | |
Resolve(() => children((math.random * children.length).asInstanceOf[Int]) ) | |
def call[A](f: => Instruction[A]) = Resolve(() => f) |
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
// this is a snippet from RSAudioDemoActivity#run | |
Process.setThreadPriority(Process.THREAD_PRIORITY_AUDIO); | |
short samples[] = new short[BLOCK_FRAMES]; | |
Allocation out = Allocation.createSized(renderScript, Element.I16(renderScript), samples.length, Allocation.USAGE_SCRIPT); | |
synth.set_block_frames(BLOCK_FRAMES); | |
synth.bind_block_out(out); | |
synth.set_sample_rate(SAMPLE_RATE_IN_HZ); |
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
-- Sample script to make an HTTP request with query parameters | |
local response = http.request { | |
url = 'http://www.random.org/integers/', | |
params = { | |
num=1, min=0, max=1, format='plain', | |
rnd='new', col=1, base=10 | |
} | |
} | |
if tonumber(response.content) == 0 then | |
return 'heads' |
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
node(1..100). | |
1 { arc(A,B):node(A):node(B) }. | |
%arc(A,C) :- arc(A,B), arc(B,C). | |
%% intent: forall( nodes(a,b,c), implies( and(arc(a,b), arc(b,c)), arc(a,c) ) ). | |
var(a;b;c). | |
bind(V,N):node(N) :- var(V). | |
bot :- bind(a,A), bind(b,B), not arc(A,B). |