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/ruby | |
| require 'pp' | |
| $rows | |
| $cols | |
| class Sokoban | |
| attr_accessor :crates, :empty_storage, :filled_storage, :playing_grid, :crate_id, :man_id, :wall_id, :floor_id, | |
| :storage_id, :crate_on_storage_id, :man_on_storage_id, :symbols, :workman, :move_coords | |
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
| def play | |
| puts "Welcome to Sokoban! The aim of the game is to put all of the crates, which are the \'" + @crate_id + "\' symbols onto the storage pallets, which are the \'" + @storage_id + "\' symbols! A list of all the symbols is available if you type \"help\", and the status of the game is available if you type \"status\"." | |
| status() | |
| loop do | |
| input = gets.chomp() | |
| pp input | |
| case input.downcase! | |
| when "help" | |
| help() | |
| when "move" |
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
| def move(direction) #Returns what the new coords would be, Sokoban.handle_move then checks if these are valid | |
| pp @coordinates | |
| case direction.downcase! | |
| when "up" | |
| move_up() | |
| when "down" | |
| move_down() | |
| when "right" | |
| move_right() | |
| when "left" |
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 'rubygems' | |
| require 'gosu' | |
| require 'pp' | |
| class GameWindow < Gosu::Window | |
| def initialize | |
| super 640, 480, false |
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 'rubygems' | |
| require 'gosu' | |
| require 'pp' | |
| class GameWindow < Gosu::Window | |
| attr_accessor :bullets, :stars |
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 'gosu' | |
| require 'pp' | |
| class GameWindow < Gosu::Window | |
| attr_reader :tilemap | |
| def initialize |
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 'gosu' | |
| require 'pp' | |
| class GameWindow < Gosu::Window | |
| attr_reader :tilemap | |
| def initialize |
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 'gosu' | |
| require 'pp' | |
| class GameWindow < Gosu::Window | |
| attr_reader :tilemap | |
| def initialize |
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
| while line = @irc.gets | |
| puts line | |
| ping_message_regex = "PING :.*\.freenode\.net" | |
| if line =~ ping_message_regex | |
| send("PRIVMSG " + @server + " PONG!") | |
| end | |
| end |
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
| def give_youtube_description(line) | |
| channel = get_input_channel(line) | |
| if line =~ /.*youtube.com.*/ | |
| url = line.gsub(/.*\:/, '').gsub(/.*youtube/, 'youtube').strip.gsub(/\ .*/, '') | |
| puts url | |
| begin | |
| page = open("http://www." + url) | |
| contents = page.read.gsub(/.*meta name="keywords" content="/m, '').gsub(/".*/m, '').strip | |
| puts channel + " " + url + " " + contents | |
| send("PRIVMSG " + channel + " :http://www." + url + " " + contents) |
OlderNewer