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 'oekaki' | |
| require_relative 'turtle' | |
| Width, Height = 600, 450 | |
| Oekaki.app width: Width, height: Height, title: "Dragon curve" do | |
| draw do | |
| clear | |
| depth = 12 |
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 Turtle | |
| def initialize(width, height, ob) | |
| @width, @height = width, height | |
| @pen_po = Vector[0, 0] | |
| @pen = ob | |
| @dir = Vector[1, 0] | |
| @color = [65535, 65535, 65535] | |
| end | |
| attr_accessor :pen_po, :dir | |
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 'oekaki' | |
| require_relative 'turtle' | |
| Width, Height = 400, 400 | |
| Oekaki.app width: Width, height: Height, title: "Grate curve" do | |
| draw do | |
| clear(color(0xffff, 0x7dff, 0)) | |
| t = Turtle.new(Width, Height, self) |
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 'oekaki' | |
| require_relative 'turtle' | |
| Width, Height = 600, 350 | |
| Oekaki.app width: Width, height: Height, title: "Knuth curve" do | |
| draw do | |
| clear | |
| t = Turtle.new(Width, Height, self) |
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" | |
| type Player struct { | |
| name string | |
| point byte | |
| hand byte | |
| } |
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 'oekaki' | |
| W, H = 260, 220 | |
| L = 40 | |
| yoko = [[1, 1, 0, 0, 0, 0], [0, 0, 1, 0, 1, 0], [0, 1, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1], [1, 0, 1, 0, 0, 0], [1, 1, 0, 0, 0, 0]] | |
| tate = [[0, 0, 0, 0, 1], [0, 0, 1, 1, 0], [1, 0, 0, 0, 1], [0, 1, 0, 1, 0], [0, 1, 1, 0, 0], [0, 1, 1, 0, 0], [0, 0, 0, 1, 1]] | |
| Oekaki.app width: W, height: H do | |
| draw do |
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 "q50disp" | |
| W, H = 6, 5 | |
| def putout | |
| return if @memo.include?([@yoko, @tate]) | |
| @memo << (a = Marshal.load(Marshal.dump([@yoko, @tate]))) | |
| Disp.show(*a) | |
| 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
| require 'oekaki' | |
| Oekaki.app width: 420, height: 420, title: "Turtle" do | |
| draw {clear} | |
| t = Oekaki::Turtle.new | |
| t.color(0xffff, 0x45ff, 0) #orangered | |
| t.move(-200, -200) | |
| t.left(45) | |
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' | |
| Width = 30 | |
| Height = 30 | |
| class Component | |
| def initialize | |
| f = Field.new(Width, Height) | |
| f.generate(150) | |
| if ARGV[0] == "-r" |
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 SolveMaze | |
| open("maze_never_turn_left.txt") {|io| @@field = io.readlines} | |
| @@field.map! {|f| " " + f.chomp + " "} | |
| a = [" " * @@field[0].size] | |
| @@field = a + @@field + a | |
| class Position | |
| def initialize(x, y, dir = nil, parent = nil) | |
| @x, @y = x, y | |
| @kind = get[y][x] |