Skip to content

Instantly share code, notes, and snippets.

View Vaguery's full-sized avatar

Bill Tozier Vaguery

View GitHub Profile
@Vaguery
Vaguery / push-program.clj
Last active July 14, 2016 16:28
An arbitrary Push program, with some input :bindings used to test it
{
:program
'[:booleans-pop \• 899300736 \… :exec-equal? :code-return-pop
#push.type.definitions.interval.Interval{:min 133/162, :max 331.08203125,
:min-open? true, :max-open? true} :intervals-generalize :char-as-set \0
:vector-print 802246192M false #{#push.type.definitions.complex.Complex{
:re 830429155, :im 143.53515625} :exec-as-set 938418139M :char->set
:tagspace-rerunall :string-indexofchar :ref-swap :scalar≤?} :complexes-nth
:boolean->set (:booleans-replacefirst [false] ["”Tã{ Ú«" "¢(F%06"]
@Vaguery
Vaguery / scalars.txt
Created July 14, 2016 12:22
442 consecutive :scalar stacks present in a Push interpreter running one program
()
()
()
(899300736)
(899300736)
(899300736)
(899300736)
(899300736)
(899300736)
(899300736)

...Now these 'letter' things are confusing at first. Personally I don't know why exactly the manufacturers seem to think we need so many different ones, and a lot of them seem to do the same thing. Tozier seems to think that this is normal and that for "advanced" applications there may even be what he calls "diacriticals". He says he's seen them online somewhere, but I am skeptical and think he was probably looking at porn or something. Even more confusingly, certain letters are clearly overloaded badly in terms of their responsibilities: A for example, seems in some places to be what the manuals refer to as "soft", and other times "hard". But there's no notational difference indicated at all!

We'll have to watch out for that (foreshadowing!).

Given a list as long and complicated as the twenty-something letters here, we decide to start at the beginning. Before we get to it, though, we probably should put the pointy thing into the wall thing so the computer goes. Several minutes pass as we watch

@Vaguery
Vaguery / spiked_tracer.clj
Last active April 7, 2016 11:25
Nic's weirdo box surface calculator
(ns push.design-spikes.clojush-running
(:use midje.sweet)
(:use clojure.pprint)
(:require [push.core :as push]
[push.interpreter.core :as i]
[push.util.legacy :as legacy]))
(def weirdo
'(in3 in3 in2 integer_shove integer_add in1 integer_mult in3 in3 integer_mult exec_do*count (exec_s in3 exec_dup (in2 integer_mult in1) integer_mult exec_do*count (in3 exec_dup (in2 integer_mult in1) integer_pop exec_y integer_add)))
)
@Vaguery
Vaguery / rewriter.clj
Created March 6, 2016 01:48
Some rewriting experiments
(defn rewrite-step
[n cutoff replacements]
(let [replaced-string
(reduce
(fn [result digit] (str result (str (nth replacements (- (int digit) 48)))))
"" (str n))]
(read-string (subs replaced-string 0 (min cutoff (count replaced-string))))))
(def temp-table
(take 10 (repeatedly #(rand-int 1000))))
@Vaguery
Vaguery / 20160128-answer-factory.md
Last active January 28, 2016 19:34
brief sketch for answer-factory manual design spike
  1. build a relatively large dataset (1000+ training cases)
  2. wire up postgres store
  • answers
    • id (key)
    • program (index)
    • genome (index)
    • instance-count
    • scores
    • timestamp
  1. 100 random answers -> datastore
@Vaguery
Vaguery / about.md
Last active January 16, 2016 01:06
novelty search on random 20-gene bb8 genomes

What's happening here

tl;dr: it's a sketch

Generated a large number of random 20-gene genomes (bb8 representation), translated those into Push programs, ran them with 21 different input combinations (input :a was an integer and :b a :float) for 300 steps, then collected the :integer stack. The result was a 21-element "feature vector", in which each entry was an entire :integer stack after running the program with the assigned input values.

As these were collected, they were stored using the feature vector (of :integer stacks) as the key.

The list above is the count of each feature vector's occurrence, followed by the vector itself. The genomes were also stored, but are not recorded here.

@Vaguery
Vaguery / description.md
Created January 9, 2016 23:47
successive point mutations of a BB8 genome's :from genes

point mutation random walk

This is a random "BB8" genome with :item fields set to the numbers 1 through 18, plus 8 additional sub-trees. Each row of the trace below it shows the translated program derived from a point mutation of the prior line's genome, where the mutation was a random change of the :from field of a randomly selected gene. The :put and :item genes have not been changed.

@Vaguery
Vaguery / pretty-much-maybe.clj
Created December 8, 2015 22:55
I feel dirty
;;...
;; (:import [org.apfloat Apfloat ApfloatMath])
(def precision 100)
;;...
(defn pretty-much-equal?
"takes two Apfloat items, subtracts one from the other, and returns `true` if the absolute difference is less a threshold set to half the current precision"
@Vaguery
Vaguery / bad-push.txt
Last active January 23, 2016 18:43
A Push program for stress-testing the new interpreter
caught exception: Value out of range for long: 1.4582948234106589E85 running
[342.44921875 227.47265625 "ࣲ࣊ݺ࿧aQᇧႂȾོቪÆભ୦՜቏ຨࢮ" \Ј 867977268 :code-pop "1෤ݢî" (:input!3 false :integer-divide true (("ᄴʗ" :input!3 :input!3 :string-yankdup 468875600) 680044766 :boolean-pop (30827267 217.14453125 true :char-notequal? 396804191) :string-fromfloat)) 223961527 :input!5 true 199.7734375 "ȑ˽౑܄ࠣჩцݺባ೜฿྅ӝိݫૄہ" "ठۏષྛ෧ࡨ಑" 16209681 :char-rotate (922763113 :char>? \' 230282795 :input!1) :input!3 "ńခ၄౶" (\μ \ᆱ (false :boolean-stackdepth :exec-y (\኱ 689117054 :input!2 :input!9 :exec-rotate) :boolean-frominteger) true :integer-inc) \ڽ 162.69921875 (:float-min 343.58203125 :integer-notequal? 212610666 :code-size) false "ף౫Ⴒ࿅లጕϗఈນੈ" :input!7 :string-fromchar "׾ቲ࿤໷ؼ,৽ؗNਰ࿟ድᄚચ୽׍ፑ" true false "ኑȵಫ൦Риލ੗čັ଒ਰ०ሄቒ൸ೝቭତ׈" :boolean-pop :code-do*count (:string-rotate 338.91015625 "ጱ݁Ǿሃ߾ݮභ້ीמփΝႝଐ٩ݫȀᅣשອ" true :boolean-shove) false 266.0234375 247.34765625 243110307 ("ʊ" \ൂ \ኺ :integer-swap false) :input!6 362347294 (136932036 :input!8 "ӃIჱ" 314.6