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
# Playfair Cipher | |
class PlayfairCipher | |
AZ = ('A'..'Z').to_a - ['J'] | |
def initialize keyword | |
@square = keyword.upcase.gsub(/[^A-Z]/, '').gsub('J', 'I').split('').uniq | |
AZ.each{|x| @square.push x unless @square.include? x} | |
@square = 0.step(20, 5).collect{|x| @square.slice x,5} | |
@h = AZ.collect{|x| AZ.collect{|y| "'#{x+y}' => '#{convert x, y}'"}}.flatten.join ', ' | |
@h = eval "{#{@h}}" | |
@rh = @h.invert |
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 Skier | |
def initialize app | |
app.strokewidth 2 | |
@x0, @y0 = 0, 20 | |
@img1 = app.oval @x0 + 25, @y0 - 20, 5, 5 | |
@img2 = app.line @x0 + 5, @y0, @x0 + 25, @y0 - 15 | |
@img3 = app.line @x0 + 5, @y0 - 13, @x0 + 20, @y0 - 15 | |
@img4 = app.line @x0, @y0, @x0 + 30, @y0 | |
@img5 = app.line @x0, @y0, @x0 + 30, @y0 - 10 | |
@img5.hide |
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
# Shoes Large Analog Clock written by Douglas Allen | |
Shoes.app :width => 1024, | |
:height => 760, | |
:title => 'Welcome to Shoes' do | |
@radius = 600 | |
@centerx = width / 2 | |
@centery = height / 2 | |
@msg = para ""#, margin: 4, align: 'center' |
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
# Roids - Exploring Everyday Things with R and Ruby: Chapter 7 - Schooling Fish and Flocking Birds | |
# https://github.com/sausheong/everyday/blob/master/Chapter%207%20-%20Schooling%20Fish%20and%20Flocking%20Birds/roids.rb | |
# | |
# Edited a little bit for Purple Shoes | |
require 'matrix' | |
# Boids - http://www.red3d.com/cwr/boids/ | |
FPS = 48 |
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 'java' | |
require 'swt' | |
module Swt::Widgets | |
import org.eclipse.swt.widgets.Layout | |
end | |
display = Swt::Widgets::Display.new | |
shell = Swt::Widgets::Shell.new display, Swt::SWT::SHELL_TRIM | |
shell.setLayout Swt::Layout::RowLayout.new |
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
# This Text Game was written by Jared H. | |
# His original code is: https://gist.github.com/2500159 | |
# and https://gist.github.com/2554879 | |
# | |
# Slightly revised by ashbb for Red Shoes. | |
require_relative 'text_game_map' | |
require_relative 'text_game_helper' | |
Shoes.app title: "Guardians at the Threshold", width: 700, height: 700 do |
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
# This Text Game was written by Jared H. | |
# Original code is: https://gist.github.com/2500159 | |
class Map | |
attr_accessor :reincarnate, :jewel_hallway, :jewel_cavern, :jewel_stairway, :name, :i | |
def initialize | |
@reincarnate = false | |
@jewel_hallway = false | |
@jewel_cavern = false |
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
# little marble solitaire game | |
# by lljk | |
# | |
# revised for Green and Purple Shoes by ashbb | |
# | |
class SolitaireMarble < Shoes::Widget | |
attr_accessor :x, :y | |
def initialize(x, y) |
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
# asteroids game by lljk | |
# have fun! | |
# revised for Green and Purple Shoes by ashbb | |
# But in this code, the ship doesn't rotate on Green Shoes | |
class Shoes::Widget | |
def move x, y | |
@ele.move x, y | |
end |
NewerOlder