Skip to content

Instantly share code, notes, and snippets.

@x17x2a
x17x2a / gist:1973923
Created March 4, 2012 17:08
Code crashing Julia
adddame(a::Array{Array{Int}}, dame::Array{Int}) = push(copy(a), dame)
hitsany(dame::Array{Int}, dames::Array{Array{Int}}) = any(map((x) -> hits(dame, x), dames))
hits(a::Array{Int}, b::Array{Int}) = any(a == b) || abs(a-b)[1] == abs(a-b)[2]
function solve(x::Int, y::Int, n::Int, d::Array{Array{Int}})
if n == 0
return d
end
for px = 1:x
@x17x2a
x17x2a / gist:1973928
Created March 4, 2012 17:10
Julia crash backtrace
Solve for 1
[[1, 1]]
Solve for 2
[[1, 1], [2, 3]]
Solve for 3
[[1, 1], [2, 3], [3, 5]]
Solve for 4
[[1, 1], [2, 3], [3, 5], [4, 2]]
Solve for 5
[[1, 1], [2, 3], [3, 5], [4, 2], [5, 4]]