Skip to content

Instantly share code, notes, and snippets.

@yamaimo
yamaimo / AlphaBetaCom.swift
Last active August 29, 2015 14:23
YWF with Swift
public class AlphaBetaCom: Player {
private var color: Board.Color
private lazy var opponent: Board.Color = self.color.opponent
private var depth: Int
public init(color: Board.Color, depth: Int = 3) {
self.color = color
self.depth = depth
}
@yamaimo
yamaimo / stairs.rb
Last active June 1, 2019 02:41
階段昇降
# 毎日『m段上ってn段下がる』を繰り返したら、x日目にd段目に初めて着いた。
# xをd,m,nで表せ。
# 文字はすべて正の整数で、m>nとする。
# https://twitter.com/hyuki/status/1134018952416321536
class Stairs
def initialize(dest, up, down)
@dest = dest
@up = up
@down = down
@yamaimo
yamaimo / snapshot.rb
Created July 26, 2020 13:31
Simple Snapshot Script
#!/usr/bin/env ruby
require 'fileutils'
USAGE =<<END_OF_USAGE
$ ./snapshot <target>.<ext>
Save snapshot of taget into HISTORY_DIR/<target>-yyyymmdd.<ext>
END_OF_USAGE
# 設定 --------------------