Skip to content

Instantly share code, notes, and snippets.

View jbum's full-sized avatar

Jim Bumgardner jbum

View GitHub Profile
# these projections come from http://mathworld.wolfram.com/GnomonicProjection.html
def gnomonic(lat, lon, clat, clon): # point, centroid both given in radians
# print "g",lat,lon,clat,clon
cosc = sin(clat) * sin(lat) + cos(clat) * cos(lat) * \
cos(lon - clon) # cosine of angular distance
x = (cos(lat) * sin(lon - clon)) / cosc
y = (cos(clat) * sin(lat) - sin(clat) * cos(lat) * cos(lon - clon)) / cosc
return (x, y)
def ignomonic(gx, gy, clat, clon):
def pointPhysics():
global pts # array of points on a sphere, specified as (lat,lon) pairs
new_pts = []
for i in xrange(nbrPoints):
(clat,clon) = pts[i] # center point for gnomonic projection (projects to 0,0)
fx,fy = (0,0)
for j in xrange(nbrPoints):
if j == i:
continue
jlat,jlon = pts[j]
# KenKen (aka Calcudoku, Mathdoku, Kendoku, Inkies) - contributed by Jim Bumgardner
# https://en.wikipedia.org/wiki/KenKen
#
# Puzzles sourced from the Inkies collection at Krazydad.com
from Numberjack import *
#
# Ensure that the sum of the segments
# in cc == res
# KenKen/Inky Solver using NumberJack - Jim Bumgardner
from Numberjack import *
#
# Ensure that the sum of the segments
# in cc == res
#
bStats = {'cnt':0,'failures':0,'backtracks':0,'walltime':0,'propags':0,'checks':0}
# KenKen/Inky Solver using NumberJack - Jim Bumgardner
from Numberjack import *
#
# Ensure that the sum of the segments
# in cc == res
#
bStats = {'cnt':0,'failures':0,'backtracks':0,'walltime':0,'propags':0,'checks':0}
# KenKen/Inky Solver using NumberJack - Jim Bumgardner
from Numberjack import *
#
# Ensure that the sum of the segments
# in cc == res
#
bStats = {'cnt':0,'failures':0,'backtracks':0,'walltime':0,'propags':0,'checks':0}
# KenKen/Inky Solver using NumberJack - Jim Bumgardner
from Numberjack import *
#
# Ensure that the sum of the segments
# in cc == res
#
bStats = {'cnt':0,'failures':0,'backtracks':0,'walltime':0,'propags':0,'checks':0}
# Hidato
#
# Sample Hidato Solver - Jim Bumgardner
from Numberjack import *
import random
def get_neighbors(idx, width, height): # get list of indices of neighbor cells
cx = idx % width
cy = idx // width
# Hidato
#
# Sample Hidato Solver - Jim Bumgardner
from Numberjack import *
def get_neighbors(idx, width, height): # get list of indices of neighbor cells
cx = idx % width
cy = idx // width
nebs = []
@jbum
jbum / spiral_faceplate.pde
Created August 22, 2015 18:25
Processing sketch to produce fibonacci faceplate
// Jim Bumgardner 2015
import processing.pdf.*;
boolean outputPDF = true;
boolean outputNumbers = false;
boolean addFrameHoles = true;
String outputFileName = "test_spiral_11_5";
float mmToPoints = 2.83464567;
float mmtoInches = 0.0393701;