Skip to content

Instantly share code, notes, and snippets.

View TheTomster's full-sized avatar

Thomas Wright TheTomster

View GitHub Profile
-- ufo santa candy blaster
-- cc-by-sa (c) 2019 tom wright
-- minbytes.com
--[[
notes and ideas
music
spike balls that make you drop coins

Keybase proof

I hereby claim:

  • I am thetomster on github.
  • I am trwright (https://keybase.io/trwright) on keybase.
  • I have a public key ASAad4yvgZThkJ0UhOf7phZpVWgxoGigEV55KKf2qnQ_sgo

To claim this, I am signing this object:

#include <ctype.h>
#include <stdio.h>
int main(int argc, char **argv)
{
char line[8192];
char *j, c;
while (fgets(line, sizeof(line), stdin)) {
if (line[0] == '>') {
printf("%s", line);
package main
import "bufio"
import "fmt"
import "os"
type Signal uint16
type Registry map[string]Component
package main
import "bufio"
import "fmt"
import "os"
import "strconv"
import "strings"
const (
on = iota
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
int lg2(int a, int b)
{
char af[256];
char bf[256];
snprintf(af, 256, "%d%d", a, b);
snprintf(bf, 256, "%d%d", b, a);
! Copyright (C) 2014 Tom Wright.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel random sequences math.order grouping
math.parser io math ;
IN: threes
: bigpiece ( board -- n ) 0 [ min ] reduce 3 max ;
: regulars ( -- x )
{ 1 2 3 1 2 3 } clone ;
\ RNG
variable rseed
\ magic numbers
16807 constant a
2147483647 constant m
: rinit time&date 5 0 do a * + loop rseed ! ;
: rstep rseed @ a * m mod rseed ! ;
: valid-seed m swap / begin rstep rseed @ <= until ;
: rint dup valid-seed rseed @ swap mod ;
rinit
t = table ->
@head 'item', 'price', 'qty'
for thing in shop
@row thing.name, thing.price, thing.qty
; Euler 1
(defun divides (x y)
(zerop (mod y x)))
(defun sum (l)
(reduce #'+ l))
(defun range (a b)
(loop for i from a to b collecting i))