Skip to content

Instantly share code, notes, and snippets.

class Race
def initialize(racers)
@racers = racers.map { |rc| rc.new }
results = @racers.map { |_r| 1 }
@racers.each do |r|
r.set_turn_results(1, 1, results)
end
@goaled = []
end
@parrot-studio
parrot-studio / Arcana.ts
Last active November 26, 2019 08:11
ccptsのドメイン設計
// 値オブジェクト:アルカナ
export default class Arcana {
private _arcanaCode: string
private _cost: number
constructor(code: string, cost: number) {
this._arcanaCode = code
if (this.cost >= 0) {
this._cost = cost
@parrot-studio
parrot-studio / BF.kt
Last active April 11, 2019 06:41
BrainF**k interpreter by Kotlin
object BF {
private val commends = mapOf(
'>' to "pinc",
'<' to "pdec",
'+' to "inc",
'-' to "dec",
'.' to "out",
',' to "inp",
'[' to "jmp",
']' to "ret"
# https://paiza.jp/logic_summoner/challenges/logics_skill_4005
def mark(board, table, w, max, color, base, ind)
return if table[ind]
return unless color == board[ind]
r = ind % w
table[ind] = base
mark(board, table, w, max, color, base, ind - 1) if r > 0 # left
mark(board, table, w, max, color, base, ind + 1) if r < w - 1 # right
mark(board, table, w, max, color, base, ind - w) if ind >= w # up
@parrot-studio
parrot-studio / bf.exs
Last active January 17, 2017 10:37
BrainF**k interpreter by Elixir
defmodule BF do
@cmap %{
">" => :pinc,
"<" => :pdec,
"+" => :inc,
"-" => :dec,
"." => :out,
"," => :inp,
"[" => :jmp,
"]" => :ret
https://paiza.jp/moshijo
https://paiza.jp/poh/hatsukoi/
https://paiza.jp/poh/ando
glasses
https://paiza.jp/poh/ando/share/f872136d
santa
https://paiza.jp/poh/ando/share/b8c73b8b
swimwear
https://paiza.jp/poh/ando/share/841f1803
# coding: utf-8
def read_data(count)
c = count.to_i
return if c < 0
ret = []
count.times do
s = gets
next unless s
ret << s.to_i
end
@parrot-studio
parrot-studio / mini.rb
Last active December 28, 2015 02:18
miniが待てないんだよщ(゚Д゚щ)
# encoding: utf-8
require 'mail'
MAIL_ENCODING = 'ISO-2022-JP'
MYADDR = "hogehoge"
def send_message
mes = "mini来た!!"
m = Mail.new