- 547 名前:デフォルトの名無しさん mailto:sage [2012/04/27(金) 22:35:14.09 ]
- F# 2.6GHz Core2Duo 500世代で2分57秒
let life (field : int[,]) = let height, width = field.GetLength 0, field.GetLength 1 field |> Array2D.mapi (fun y x c -> let s = seq { y - 1 .. y + 1 } |> Seq.sumBy (fun y' -> seq { x - 1 .. x + 1 } |> Seq.sumBy (fun x' -> field.[(y' + height) % height , (x' + width) % width])) match s, field.[y, x] with 4, 1 | 3, _ -> 1 | _ -> 0)
|

|