Skip to content

Instantly share code, notes, and snippets.

View DanaL's full-sized avatar

Dana Larose DanaL

View GitHub Profile
# For my untitled roguelike, I want to procedurally generate the
# map of the surface. After reading/skimming many articles and blog
# posts, I hit on the diamond-square algorithm. Some of the examples
# I'd seen produced nice enough maps, and I was able to understand
# how it worked better than, say, Perlin Noise. My roguelike is going
# to be done in Rust, but I find Python way easier to prototype in.
# So, here's my attempt to implement the diamond-square algorithm
# (https://en.wikipedia.org/wiki/Diamond-square_algorithm)
import math
@DanaL
DanaL / gist:39f3e6c2791460405982ab9be04d2af7
Created February 24, 2020 05:19
A diamond square alg implementation for terrain generation
# For my untitled roguelike, I want to procedurally generate the
# map of the surface. After reading/skimming many articles and blog
# posts, I hit on the diamond-square algorithm. Some of the examples
# I'd seen produced nice enough maps, and I was able to understand
# how it worked better than, say, Perlin Noise. My roguelike is going
# to be done in Rust, but I find Python way easier to prototype in.
# So, here's my attempt to implement the diamond-square algorithm
# (https://en.wikipedia.org/wiki/Diamond-square_algorithm)
from enum import Enum
@DanaL
DanaL / .txt
Created December 27, 2018 15:16
Verbose output for day 24 of Advent of Code
This file has been truncated, but you can view the full file.
Q1: 26868
Immunes: 155
Stalemate at boost:, 84
Immunes: 413
Stalemate at boost:, 88
Immunes: 140
Stalemate at boost:, 89
Round: 1
Infection 3 attacks Immume 0 for 145404, 26 of 2987 killed.
Immume 1 attacks Infection 7 for 271260, 7 of 5519 killed.
@DanaL
DanaL / euler.fs
Last active November 6, 2018 13:46
Decided to poke at F# a bit and am trying a few Project Euler problems in it
(* Euler problem 1
I know you can just straight calculate the sum but
that wouldn't teach me much about F# :P
*)
open System
[<EntryPoint>]
let main argv =
let sum =
[1..999]
@DanaL
DanaL / schemer.ss
Last active October 19, 2018 23:06
Exercises and scheme code from the Little Schemer
(define atom?
(lambda (x)
(and (not (pair? x)) (not (null? x)))
))
(define lat? (lambda (l)
(cond (
(null? l) #t)
((atom? (car l)) (lat? (cdr l)))
(else #f)
@DanaL
DanaL / fetchgpx.py
Created July 25, 2012 20:46
Quick hacked together script to extract .gpx files of workouts from my Garmin Connect account.
import re
import json
import os
import mechanize
def get_activity_id(activity):
return activity['activity']['activityId']
def get_activity_type(activity):
return activity['activity']['activityType']['key']