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 'minecraft-pi-ruby' | |
require './num_block' | |
require './timer' | |
class Timer_ctrl | |
def initialize | |
@num_mcpi = NumericalMCPI.new | |
@timer = Timer.new(1) do | |
Thread.new() 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
class Timer | |
public | |
def initialize(interval, &callback_block) | |
@loop_enable = false | |
@interval = interval | |
@callback_block = callback_block | |
end | |
def start() | |
@loop_enable = true | |
loop_start() |
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
module TNum | |
Tnull = [ | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], | |
[0,0,0,0,0,0], |
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
Max = 10**6 # 1000000 | |
res = [] | |
res_odd = [] | |
res[1] = 1 | |
res_odd[1] = 1 | |
t = 2 | |
tetrahedron = t * (t+1) * (t+2) / 6 |
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 ProblemA | |
def initialize | |
@input = [[[1,nil]], | |
[[5,nil], | |
[0,0], [0,1], [0,2], [0,3]], | |
[[12,nil], | |
[0,0], [1,0], [2,0], [3,1], [4,1], [5,1], [6,2], [7,2], [8,2], [9,3], [10,3]], | |
[[10, nil], | |
[0,2], [1,2], [2,2], [3,2], [2,1], [5,1], [6,1], [7,1], [8,1]] | |
] |
NewerOlder