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' | |
| Width, Height = 500, 450 | |
| Oekaki.app width: Width, height: Height, title: "Sierpinski gasket" do | |
| draw do | |
| clear | |
| x1, y1 = Width / 2, Height - Width * 0.5 * Math.sqrt(3) | |
| x2, y2 = 0, Height |
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 'gosu' | |
| require 'rmagick' | |
| require 'chipmunk' | |
| Width, Height = 600, 600 | |
| Wall_h = 20 | |
| class MyWindow < Gosu::Window | |
| def initialize | |
| super Width, Height, 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
| #http://obelisk.hatenablog.com/entry/2017/12/01/041951 | |
| #B1リットル: 空(0), 入れる(1), B1→B2に移す(2) | |
| #B2リットル: 空(3), 入れる(4), B2→B1に移す(5) | |
| B1, B2 = 8, 5 | |
| TO = 1 | |
| def move(mass, f, t) | |
| if (a = mass - t) >= f | |
| t += f |
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
| Square = 6 | |
| is_used = Array.new(Square + 1) {Array.new(Square + 1) {[false, false]}} | |
| count = 0 | |
| route = lambda do |x, y, is_first_time| | |
| if x == Square and y == Square | |
| if is_first_time | |
| route.call(0, 0, false) | |
| else | |
| count += 1 |
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
| function rxuG() | |
| { | |
| var KkNoAR = "YkuOKC7i{\"GUy%x"; | |
| return KkNoAR; | |
| } |
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
| height, width = gets.split.map(&:to_i) | |
| window = [] | |
| height.times {window << gets.chomp.chars.map(&:to_i)} | |
| num = gets.to_i | |
| wgtsize = [] | |
| num.times {wgtsize << gets.split.map(&:to_i)} | |
| height.times do |h| | |
| (width - 1).times {|w| window[h][w + 1] += window[h][w]} | |
| 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' | |
| Width, Height = 400, 300 | |
| CircumcircleR = 0.8 | |
| def incircle(a, b, c) | |
| l, m, n = (b - a).norm, (c - b).norm, (a - c).norm | |
| q = l + m + n | |
| po = a * (m / q) + b * (n / q) + c * (l / q) |
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 './miniopengl' | |
| require 'parallel' | |
| filenames = [] | |
| 1.upto(5) {|i| filenames << "./polyhedrons_obj/r" + ("%02d" % i) + ".obj"} | |
| data = [] | |
| filenames.each do |fn| | |
| open(fn, "r") do |io| | |
| ar = [[], []] |
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' | |
| Width, Height = if ARGV.size == 2 | |
| ARGV.map(&:to_i) | |
| else | |
| [1000, 700] | |
| end | |
| Max_r, Min_r = 40, 10 | |
| ColorMax = 65535 |
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
| #include <stdio.h> | |
| char *keyboard_linein() { | |
| char buf[1000]; | |
| fgets(buf, 1000, stdin); | |
| printf("%s\n", buf); | |
| return buf; | |
| } |