Reversi.ReversiBoard.UpdateLine C# (CSharp) Method

UpdateLine() private method

盤面の更新を1ラインずつ行う 置く場所のx座標 置く場所のy座標 置く駒の色
private UpdateLine ( int x, int y, int dx, int dy, ReversiColor color ) : void
x int
y int
dx int
dy int
color ReversiColor
return void
		private void UpdateLine(int x, int y, int dx, int dy, ReversiColor color)
		{
			int i, j;
			ReversiColor inverse_color = InverseColor(color);
			for(i=x+dx, j=y+dy; this.board[i,j] == inverse_color; i+=dx, j+=dy);
			if(!(i==x+dx && j==y+dy) && this.board[i,j]==color)
				for(i-=dx, j-=dy; !(i==x && j==y); i-=dx, j-=dy)
					this.board[i,j] = color;
		}