C#オセロのコマの反転について
Posted: 2014年2月19日(水) 01:40
C#でコンソールアプリケーションのオセロを作っているのですがコマの反転に躓いてしまいわからないです。
お願いします
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
//盤面のサイズ
const int BOARDSIZE = 8;
//状態の定義
const int NONE = 0; //なし
const int BLACK = 1; //黒
const int WHITE = 2; //白
//盤面の初期化
static int[,] board = new int[BOARDSIZE,BOARDSIZE];
//プレイヤー
//static int player, cpu;
//メイン関数
static void Main(string[] args)
{
Init(); //盤面初期化
disp(); //盤面表示
} //Main END
//盤面初期化
static void Init()
{
board[BOARDSIZE / 2 - 1, BOARDSIZE / 2 - 1] = WHITE;
board[BOARDSIZE / 2 - 1, BOARDSIZE / 2] = BLACK;
board[BOARDSIZE / 2, BOARDSIZE / 2 - 1] = BLACK;
board[BOARDSIZE / 2, BOARDSIZE / 2] = WHITE;
}//Init END
//盤面表示
static void disp()
{
int i, j;
for (i = 0; i < BOARDSIZE; i++)
{
for (j = 0; j < BOARDSIZE; j++)
{
switch (board[i, j])
{
case NONE:
Console.Write("□");
break;
case BLACK:
Console.Write("●");
break;
case WHITE:
Console.Write("○");
break;
default:
Console.Write("er");
break;
}
}
Console.WriteLine("");
}
}//disp END
} //クラス Program END
} //ネーム ConsoleApplication1 END