Skip to content

Instantly share code, notes, and snippets.

############################################################################
# Christian Paul Dehli
#
# This .py file demonstrates functionality that can be used to determine
# how much of a scene is visible to a robot (where certain obstacles block
# its line of sight). The functionality was needed for a game, so pinpoint
# accuracy was not required.
#
# The algorithm works by shooting rays out of the robot into the scene.
# Whenever a ray strikes an obstacle, the ray is deleted and the robot's
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<body style="background-color: transparent;">
<nav class="navbar navbar-default" id="external-nav" style="pointer-events: all">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
@dehli
dehli / haskell
Last active May 17, 2019 18:44
A bash script that allows you to execute Haskell files more easily.
#!/bin/bash
# A script that automatically compiles and runs Haskell files
# First paramter is the Haskell file
# Temporary file location
temp=~/../../tmp
# Compile Haskell file
@dehli
dehli / primes.py
Created July 1, 2015 21:33
Primes
# This function finds all the prime numbers that are less than a certain value
# getPrimes(10) would return [2, 3, 5, 7]
def getPrimes (n):
primes = []
for i in range(2, n):
isPrime = True
for primeVal in primes:
# Has a factor
if i % primeVal == 0: