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
class Maze | |
def initialize(s) | |
@m = s.dup | |
@d = r(@m.index('A'),@m.index("\n")+1) | |
end | |
def r(a,w) | |
n = [[1,a]] | |
until n.empty? do | |
d,i = n.shift |
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
# An experiment with using the normal parser instead of the scanner. | |
class AlphaCSV | |
%%{ | |
machine alphacsv; | |
textdata = 0x20..0x21 | 0x23..0x2b | 0x2d..0x7e; | |
cr = 0x0d; | |
lf = 0x0a; | |
comma = 0x2c; | |
dquote = 0x22; |
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
_thor() { | |
COMP_WORDBREAKS=${COMP_WORDBREAKS//:} | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts=`thor help | tail -n +2 | awk '{print $2}'` | |
opts="${opts} `thor list | tail -n +3 | awk '{print $2}'`" |
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
require 'logger' | |
require 'net/http' | |
require 'open-uri' | |
#Roshan Khan | |
#CS 590B | |
#HW4 - HMM | |
class Fasta | |
attr_accessor :dna, :html |
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 | |
require 'minitest/autorun' | |
module Poker | |
Suits = { 'C' => :club, | |
'D' => :diamond, | |
'H' => :heart, | |
'S' => :spade } |
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
require 'chunky_png' | |
image = ChunkyPNG::Image.from_file('input.png') | |
# Put your logic to pixelize `image` here. | |
image.save('output.png') |
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 | |
# monte carlo simulation for mini | |
class Mini | |
attr_reader :score | |
def initialize(p) | |
@p = p | |
@score = [0, 0] |
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 | |
# monte carlo simulation for mini | |
class Mini | |
attr_reader :score | |
def initialize(*p) | |
@p = p | |
@score = [0, 0] |
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 | |
# monte carlo simulation for mini | |
class Mini | |
attr_reader :score | |
def initialize(*p) | |
@p = p | |
@score = [0, 0] |
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 | |
require 'camping' | |
Camping.goes :Mini | |
class Mini::Game | |
attr_reader :score | |
def initialize(*p) |
OlderNewer