This file contains hidden or 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
import Data.List (foldl') | |
import Data.List.Split (chunksOf) | |
-- Main: | |
main :: IO () | |
main = print $ run input == output | |
-- Test-Data: |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>OMG Particles!</title> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.25.0"></script> | |
<style type="text/css"> | |
body { | |
background: #222; |
This file contains hidden or 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
import Data.List | |
import Control.Arrow | |
import System.Random | |
-- Core Life Engine | |
life = f 3 >>> map (map (q 3 >>> uncurry s)) | |
s n 1 | n < 3 = 0 -- There is no 'off-by-one' error here |
This file contains hidden or 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
#!/usr/bin/env ruby | |
class Array | |
def transpose | |
width = self.map {|e| e.length}.max | |
trans = [] | |
(0..width - 1).each do |col| | |
self.each do |row| | |
element = row[col] | |
(trans[col] ||= []) << element |