This file contains 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
# 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): |
This file contains 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
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] |
This file contains 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
# 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 |
This file contains 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
# 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} |
This file contains 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
# 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} |
This file contains 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
# 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} |
This file contains 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
# 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} |
This file contains 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
# 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 |
This file contains 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
# 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 = [] |
This file contains 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
// 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; |
NewerOlder