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
(def args {:age 3}) | |
(def opts {:age inc}) | |
;; Desired behavior: | |
;; (my-function args opts) => {:age 4} | |
;; | |
;; below example works, but my argument isn't actually in a seq | |
(def args {:age [3]}) |
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
db_yaml = File.expand_path(File.dirname(__FILE__) + "../../../../config/database.yml") | |
YAML.load(File.open(db_yaml)) |
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 InkReservoir | |
def contact_point | |
puts "Contact point activated" | |
end | |
end | |
class InkCartridge | |
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 Minimax | |
def score_move(board, move, current_token, depth) | |
sandbox_board = Board.new(board.state) | |
sandbox_board.move(move, current_token) | |
rules = TTTRules.new(sandbox_board) | |
if rules.game_over or depth == 0 | |
return evaluate_game(rules.game_winner, current_token, depth) | |
else | |
opponent_token = rules.other_token(current_token) |
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 MockBoard | |
def initialize(initial_state=["", "", "", "", "", "", "", "", ""]) | |
@state = initial_state | |
end | |
def move(space, token) | |
@state[space] = token | |
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
source "http://rubygems" | |
gem "resque", "~> 2.0.0.pre.1", github: "resque/resque" | |
gem "sinatra" |
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
node = @head.next_node | |
while !node.nil? do | |
node = node.next_node | |
end | |
node.next_node = Node.new(value) |
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 MockGame | |
attr_reader :last_received_move | |
def initialize(*invalid_moves) | |
@invalid_moves = invalid_moves | |
end | |
def place(move) | |
if @invalid_moves.include?(move) | |
raise TicTacToe::InvalidMove |
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
/Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/gems/rbname-0.0.6/lib/file_line.rb:23:in `update_filesystem!': undefined method `write' for File:Class (NoMethodError) | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/gems/rbname-0.0.6/lib/main.rb:76:in `take_user_suggestion!' | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/gems/rbname-0.0.6/lib/main.rb:29:in `replace_all' | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/gems/rbname-0.0.6/lib/main.rb:20:in `each' | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/gems/rbname-0.0.6/lib/main.rb:20:in `replace_all' | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/gems/rbname-0.0.6/bin/rbname:9 | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/bin/rbname:23:in `load' | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/bin/rbname:23 | |
from /Users/arlandislawrence/.rvm/gems/ree-1.8.7-2011.12@my-gemset/bin/ruby_executable_hooks:1 |
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 Game | |
attr_reader :tokens | |
def initialize | |
@tokens = [:O] | |
end | |
def make_move(space) | |
@board.place(0, :X) |
OlderNewer