Home > Back-end >  C gobang
C gobang

Time:11-14

Void __fastcall TForm1: : Label1Click (TObject * Sender)
{
Int k;
String s1.
A=TLabel * (TLabel *) Sender;
K=a - & gt; The Tag;
X=(k - 1)/19;
Y=(k - 1) % 19;
If (flag==0) {
Hb] [k - 1 - & gt; Picture=Image4 - & gt; Picture;
flag=1;//black subscript 1
Luozi [x] [y]=1;
}
The else {
Hb] [k - 1 - & gt; Picture=Image3 - & gt; Picture;
Flag=0;
Luozi [x] [y]=2;//white subscript 2
}
Hb] [k - 1 - & gt; The Visible=true;
Injudge ();
}

Judge calls injudge high number winning or losing, is how to realize the pieces positioning and then to determine if?

CodePudding user response:

The x, y, not all calculate? In x, y as a starting point, on the left side of the pieces in a row, on the right side of the pieces in a row, whether combined horizontal reached 5, similar to other three direction, pay attention to the border,

CodePudding user response:

Don't know what is your program interface, with 2 d Label array board to do?

CodePudding user response:

Don't know what is your program interface, with 2 d Label array board to do?
Prev:C
  • Related