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
# TODO | |
# | |
# Handle adding more water units than cave capacity (use something like | |
# cave.overflow?) | |
module RockBottom | |
# | |
# Represents one column in the cave. | |
# | |
# You only care about how many water units the column contains - which is |
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
module Chess | |
module Pieces | |
# | |
# Implements a basic, abstract chess piece. | |
# | |
# This piece can move to any square on the board provided that | |
# said square is either empty or occupied by an enemy piece - this | |
# guy teleports. It's the subclass' responsibility to provide the |
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
require 'set' | |
# | |
# Analyzes Twitter conversations. | |
# | |
# Usage: | |
# | |
# Instantiate a TwitterConversation::Graph object and feed it some | |
# sample tweets: | |
# |
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
module Stacker | |
module Construct | |
class Construct | |
# Read extra data from the input, parse it and return the new position | |
# from where to continue parsing or nil if a grammar error is found. | |
def parse(input, pos) | |
pos | |
end |
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
#! /usr/bin/env ruby | |
require 'irb' | |
dir = File.expand_path("~/.draughts/") | |
unless File.directory? dir | |
print "LOG: ~/.draughts dir does not exist, creating..." | |
Dir.mkdir dir | |
puts "done." | |
end |
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
class MarkovChain | |
def initialize(states, transitions=nil) | |
@states = states | |
@graph = empty_graph | |
@transitions = build_transitions(transitions) if transitions | |
end | |
def transitions=(transitions) | |
@graph = empty_graph | |
@transitions = build_transitions(transitions) if transitions |
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
# Run from bin/testbot | |
Draughts::AI::Board.each do |b| | |
Draughts::AI::Move.each do |m| | |
['black', 'white'].each do |c| | |
p = Draughts::AI::Play.first(board: b, move: m, color: c) | |
if p | |
result = p.legal | |
Draughts::AI::Play.all(board: b, move: m, color: c).destroy | |
Draughts::AI::Play.create(board: b, move: m, color: c, legal: result) | |
end |
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
<?php | |
require_once('../wp-load.php'); | |
/* | |
* -------------------------------------------------------------------- | |
* SELECT | |
* -------------------------------------------------------------------- | |
/* |
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
class S; def initialize *w; @s=w; end; def method_missing *w;@s<<w;self;end;def | |
to_ary;[@s.map{ |e| e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e] }.join.strip];end;end | |
def Object.const_missing(c);S.new c;end; ###### https://gist.github.com/2354740 | |
puts This.is.a.sentence.represented.by.a.Ruby.expression(",").try.it.out! ##### |
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
$(document).ready -> | |
if $("#map").length > 0 | |
class MapManager | |
constructor: -> | |
@defaultLat = -12.043333 | |
@defaultLng = -77.028333 | |
@latEl = $("#experience_latitude") | |
@lngEl = $("#experience_longitude") | |
coords = @initialCoords() |
OlderNewer