| 39 |
FTurnIndex: integer; |
FTurnIndex: integer; |
| 40 |
FActive: Boolean; |
FActive: Boolean; |
| 41 |
List: TList; |
List: TList; |
| 42 |
|
FEffectStone: TStoneType; |
| 43 |
FBool: Boolean; |
FBool: Boolean; |
| 44 |
|
FTerminated: Boolean; |
| 45 |
FIndex_X: integer; |
FIndex_X: integer; |
| 46 |
FIndex_Y: integer; |
FIndex_Y: integer; |
| 47 |
function GetStrings(X, Y: integer): TStoneType; |
function GetStrings(X, Y: integer): TStoneType; |
| 135 |
begin |
begin |
| 136 |
if CanSetStone(Stone, X, Y, true) = true then |
if CanSetStone(Stone, X, Y, true) = true then |
| 137 |
begin |
begin |
| 138 |
if Stone = stBlack then |
case Stone of |
| 139 |
Stone := stWhite |
stBlack: |
| 140 |
else |
Stone := stWhite; |
| 141 |
Stone := stBlack; |
stWhite: |
| 142 |
|
Stone := stBlack; |
| 143 |
|
stEffect: |
| 144 |
|
Stone := FEffectStone; |
| 145 |
|
end; |
| 146 |
result := 0; |
result := 0; |
| 147 |
for i := 0 to Count - 1 do |
for i := 0 to Count - 1 do |
| 148 |
for j := 0 to Count - 1 do |
for j := 0 to Count - 1 do |
| 175 |
begin |
begin |
| 176 |
s := GetStrings(X + m * i, Y + n * i); |
s := GetStrings(X + m * i, Y + n * i); |
| 177 |
if s = stEffect then |
if s = stEffect then |
| 178 |
for j := 0 to List.Count-1 do |
s := FEffectStone; |
|
if List[j] <> nil then |
|
|
begin |
|
|
q:=List[j]; |
|
|
s:=q^.Stone; |
|
|
break; |
|
|
end; |
|
| 179 |
if (s = stNone) or (s = stError) then |
if (s = stNone) or (s = stError) then |
| 180 |
break |
break |
| 181 |
else if s = Stone then |
else if s = Stone then |
| 191 |
Form1.PaintBox1.Repaint; |
Form1.PaintBox1.Repaint; |
| 192 |
if Visible = true then |
if Visible = true then |
| 193 |
begin |
begin |
| 194 |
|
FEffectStone := Stone; |
| 195 |
New(q); |
New(q); |
| 196 |
q^.Left := X + m * j; |
q^.Left := X + m * j; |
| 197 |
q^.Top := Y + n * j; |
q^.Top := Y + n * j; |
| 322 |
List.Delete(i); |
List.Delete(i); |
| 323 |
if List.Count = 0 then |
if List.Count = 0 then |
| 324 |
begin |
begin |
| 325 |
FActive := FBool; |
if FTerminated = true then |
| 326 |
|
FActive := false |
| 327 |
|
else |
| 328 |
|
FActive := FBool; |
| 329 |
inc(FTurnIndex); |
inc(FTurnIndex); |
| 330 |
inc(FTurnNumber); |
inc(FTurnNumber); |
| 331 |
FBuffer[FTurnIndex] := FStrings; |
FBuffer[FTurnIndex] := FStrings; |
| 378 |
|
|
| 379 |
procedure TStoneGrid.Pause; |
procedure TStoneGrid.Pause; |
| 380 |
begin |
begin |
| 381 |
FBool := false; |
if FActive = true then |
| 382 |
FActive := false; |
FActive := false; |
| 383 |
|
FTerminated := true; |
| 384 |
end; |
end; |
| 385 |
|
|
| 386 |
procedure TStoneGrid.Restart; |
procedure TStoneGrid.Restart; |
| 387 |
begin |
begin |
| 388 |
FActive := true; |
if FTerminated = true then |
| 389 |
FTurnIndex := FTurnNumber; |
begin |
| 390 |
|
FActive := true; |
| 391 |
|
FTurnIndex := FTurnNumber; |
| 392 |
|
FTerminated := false; |
| 393 |
|
end; |
| 394 |
end; |
end; |
| 395 |
|
|
| 396 |
procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType); |
procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType); |
| 407 |
FTurnNumber := 0 |
FTurnNumber := 0 |
| 408 |
else |
else |
| 409 |
FTurnNumber := Value; |
FTurnNumber := Value; |
|
FActive := false; |
|
| 410 |
FStrings := FBuffer[FTurnNumber]; |
FStrings := FBuffer[FTurnNumber]; |
| 411 |
end; |
end; |
| 412 |
|
|
| 413 |
procedure TStoneGrid.Start; |
procedure TStoneGrid.Start; |
| 414 |
begin |
begin |
| 415 |
|
FActive := false; |
| 416 |
Clear; |
Clear; |
| 417 |
|
FTerminated := false; |
| 418 |
FActive := true; |
FActive := true; |
| 419 |
end; |
end; |
| 420 |
|
|
| 454 |
end; |
end; |
| 455 |
|
|
| 456 |
begin |
begin |
| 457 |
|
Timer1.Enabled := false; |
| 458 |
Main; |
Main; |
| 459 |
if Execute = false then |
if Execute = false then |
| 460 |
begin |
begin |
| 487 |
end |
end |
| 488 |
else |
else |
| 489 |
Caption := s; |
Caption := s; |
| 490 |
|
Timer1.Enabled := true; |
| 491 |
end; |
end; |
| 492 |
|
|
| 493 |
procedure TForm1.CompStone; |
procedure TForm1.CompStone; |
| 502 |
|
|
| 503 |
procedure TForm1.GameStart; |
procedure TForm1.GameStart; |
| 504 |
begin |
begin |
| 505 |
|
Index := Player1; |
| 506 |
StoneGrid.Start; |
StoneGrid.Start; |
| 507 |
PaintBox1.Repaint; |
PaintBox1.Repaint; |
|
Index := Player1; |
|
| 508 |
Caption := '黒から始めます'; |
Caption := '黒から始めます'; |
|
Timer1.Enabled := true; |
|
| 509 |
end; |
end; |
| 510 |
|
|
| 511 |
procedure TForm1.MenuItem10Click(Sender: TObject); |
procedure TForm1.MenuItem10Click(Sender: TObject); |
| 636 |
|
|
| 637 |
procedure TForm1.Timer2Timer(Sender: TObject); |
procedure TForm1.Timer2Timer(Sender: TObject); |
| 638 |
begin |
begin |
| 639 |
if StoneGrid.ListExecute = true then |
if (StoneGrid.Active = false) and (StoneGrid.ListExecute = true) then |
| 640 |
PaintBox1.Repaint; |
PaintBox1.Repaint; |
| 641 |
end; |
end; |
| 642 |
|
|