オセロのゲーム
@@ -2,7 +2,6 @@ | ||
2 | 2 | Private Property CellSize As Integer = 40 |
3 | 3 | |
4 | 4 | Private _nowBoard As New Board |
5 | - Private _playerColor As Integer | |
6 | 5 | Private _computerAIPlayer1 As computerPlayer |
7 | 6 | Private _computerAIPlayer2 As computerPlayer |
8 | 7 |
@@ -95,10 +94,12 @@ | ||
95 | 94 | MessageBox.Show(String.Format("{0}対{1}で引き分け", blackCount, whiteCount)) |
96 | 95 | End If |
97 | 96 | ElseIf Not _nowBoard.CanMoveAny() Then |
98 | - If _nowBoard.CurrentColor = _playerColor Then | |
97 | + Dim currentColor As DiscColor = _nowBoard.CurrentColor | |
98 | + If _nowBoard.CurrentColor <> _computerAIPlayer1.MyColor AndAlso | |
99 | + _nowBoard.CurrentColor <> _computerAIPlayer2.MyColor Then | |
99 | 100 | _nowBoard.Pass() |
100 | 101 | End If |
101 | - If _nowBoard.CurrentColor = DiscColor.WHITE Then | |
102 | + If currentColor = DiscColor.WHITE Then | |
102 | 103 | MessageBox.Show("白は打てません。") |
103 | 104 | Else |
104 | 105 | MessageBox.Show("黒は打てません。") |