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 CubeMaze | |
class Wall | |
def initialize(x, y, h, ob) | |
@wall = Array.new(h + 1) {Array.new(y) {Array.new(x, 1)}} | |
@x, @y = x, y | |
@cube = ob | |
end | |
attr_reader :wall | |
def break(num, n) |
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 'gtk2' | |
class GUI < Gtk::Window | |
Meth = [:wanwan, :nya] | |
def initialize(&bk) | |
super("GUI") | |
set_width_request(200) | |
box = Gtk::VBox.new |
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
parameters = [:factorial] | |
args = [[:lambda, [:n], [:if, [:<, :n, 1], 1, [:*, :n, [:factorial, [:-, :n, 1]]]]]] | |
body = [:factorial, 4] | |
ext_env = [{:factorial=>:dummy}, | |
{:+ =>[:prim, #<Proc:0x000055a6a4665a80@μSchemeR1.rb:24 (lambda)>], | |
:- =>[:prim, #<Proc:0x000055a6a4665a30@μSchemeR1.rb:25 (lambda)>], | |
:* =>[:prim, #<Proc:0x000055a6a46659e0@μSchemeR1.rb:26 (lambda)>], | |
:/ =>[:prim, #<Proc:0x000055a6a4665990@μSchemeR1.rb:27 (lambda)>], | |
:> =>[:prim, #<Proc:0x000055a6a4665940@μSchemeR1.rb:28 (lambda)>], |
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
# Gem 'rubysdl' に付属しているサンプルを modify したものです | |
require 'sdl' | |
class Object | |
def deep_clone | |
Marshal::load(Marshal.dump(self)) | |
end | |
end | |
class Pattern |
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 'cairo' | |
require_relative 'gifanime' | |
require 'matrix' | |
include Math | |
Dir.chdir("picture") #作業用ディレクトリ | |
Width = 300 | |
Surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32, Width, Width) | |
C = Cairo::Context.new(Surface) |
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
package main | |
import "fmt" | |
import "math/rand" | |
import "time" | |
var goal = 31 | |
func min_max(cards []int, turn bool, sum int) int { | |
if sum == goal { if turn {return -10} else {return 10} } | |
if sum > goal { if turn {return 10} else {return -10} } |
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 'prime' | |
module Kernel | |
def Root(*args) | |
Root.new(*args) | |
end | |
end | |
module ExRoot | |
def to_root |
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_relative 'es' | |
L = 14 #一辺の長さ(偶数にする) | |
print ES.safe_scroll(L) | |
i = 0 | |
x, y = ES.cursor_position | |
x -= 1 | |
square = ->(width) { |
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
module Kernel | |
def Thunk(&bl) | |
a = Thunk.new | |
a.value = bl | |
a | |
end | |
def Lambda(&bl) | |
Lambda.new(bl) | |
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
class Node < Struct.new(:key, :value, :left, :right) | |
def inspect | |
l, r = "", "" | |
l = ", @left='#{left}'" if left | |
r = ", @right='#{right}'" if right | |
"#<Node:@key='#{key}', @value='#{value}'#{l}#{r}>" | |
end | |
alias :to_s :inspect | |
end |