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
https://paiza.jp/poh/joshibato/
kirishima.rb
https://paiza.jp/poh/joshibato/kirishima/result/4d6681fb
rio.rb
https://paiza.jp/poh/joshibato/tsubame/result/f494a598
tsubame.rb
https://paiza.jp/poh/joshibato/tsubame/result/f494a598
https://paiza.jp/poh/enshura