namespace Igo
type Igo private() =
member this.Print (bs : int) (ws : int) =
let goban pos (bs : int) (ws : int) =
if ((bs ^^^ ws) >>> pos) &&& 1 = 1 then
[| "●"; "○"; |].[(bs >>> pos &&& 1 ^^^ 1 ||| ws >>> pos &&& 1)]
else
match pos with
| 0 -> "┌"
| 20 -> "└"
| 4 -> "┐"
| 24 -> "┘"
| _ when pos = ((5*5-1)/2)
-> "╋"
| _ when (pos % 5 = 0)
-> "├"
| _ when (pos % 5 = 4)
-> "┤"
| _ when (pos / 5 = 0)
-> "┬"
| _ when (pos / 5 = 4)
-> "┴"
| _
-> "┼"
for pos in [0..24] do
printf "%s" (goban pos bs ws)
if (pos % 5 = 4) then
printfn ""
printfn ""
member this.Run () =
let GetNumber (mode : int) =
let msg =
match mode with
| 0 -> "黒石のビットを入力してください。"
| _ -> "白石のビットを入力してください。"
printfn "%s" msg
let input = stdin.ReadLine().Replace(" ", "").TrimStart([|'0';|])
try
System.Convert.ToInt32(input, 2)
with
| _ -> 0
let writer () =
let bs = GetNumber 0
if 0 <= bs then
let ws = GetNumber 1
if 0 <= ws then
this.Print bs ws
true
else
false
else
false
while writer () do
()
()
static member Start() =
(new Igo()).Run();
()