關於此代碼:方法名稱預期錯誤 - C#
我正在爲TIC TAC TOE遊戲製作Windows窗體應用程序。這是其中的一種方法。它對角地,水平地,垂直地檢查贏家。
錯誤:
在& &語句的右手邊,我得到一個錯誤說「有望方法名稱」。我無法弄清楚這個錯誤。我希望有人能幫忙。
private void checkForwinner()
{
bool there_is_a_winner= false;
//horizontal check
if((A1.Text==A2.Text)&& (A2.Text==A3.Text)(!A1.Enabled))
there_is_a_winner=true;
else if((B1.Text==B2.Text)&& (B2.Text==B3.Text)(!A2.Enabled))
there_is_a_winner=true;
else if ((C1.Text == C2.Text) && (C2.Text == C3.Text)(!A3.Enabled))
there_is_a_winner = true;
//Vertical Check
else if ((A1.Text == B1.Text) && (B1.Text == C1.Text)(!A1.Enabled))
there_is_a_winner = true;
else if ((A2.Text == B2.Text) && (B2.Text == C2.Text)(!B1.Enabled))
there_is_a_winner = true;
else if ((A3.Text == B3.Text) && (B3.Text == C3.Text)(!C1.Enabled))
there_is_a_winner = true;
//Diagonal Check
else if ((A1.Text == B2.Text) && (B2.Text == C3.Text)(!A1.Enabled))
there_is_a_winner = true;
else if ((A3.Text == B2.Text) && (B2.Text == C1.Text)(!C1.Enabled))
there_is_a_winner = true;
}
'(A2.Text == A3.Text)(!A1.Enabled)'是什麼意思?那是你的問題。 –