Develop and Download Open Source Software

Browse Subversion Repository

Diff of /Unit1.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 20 by yamat0jp, Sat Jul 18 21:05:05 2015 UTC revision 23 by yamat0jp, Sat Jul 18 23:47:44 2015 UTC
# Line 41  type Line 41  type
41      List: TList;      List: TList;
42      FEffectStone: TStoneType;      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;
# Line 135  begin Line 136  begin
136    if CanSetStone(Stone, X, Y, true) = true then    if CanSetStone(Stone, X, Y, true) = true then
137    begin    begin
138      case Stone of      case Stone of
139      stBlack:        stBlack:
140        Stone := stWhite;          Stone := stWhite;
141      stWhite:        stWhite:
142        Stone := stBlack;          Stone := stBlack;
143      stEffect:        stEffect:
144        Stone := FEffectStone;          Stone := FEffectStone;
145      end;      end;
146      result := 0;      result := 0;
147      for i := 0 to Count - 1 do      for i := 0 to Count - 1 do
# Line 174  var Line 175  var
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          s:=FEffectStone;          s := FEffectStone;
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
# Line 190  var Line 191  var
191                Form1.PaintBox1.Repaint;                Form1.PaintBox1.Repaint;
192                if Visible = true then                if Visible = true then
193                begin                begin
194                  FEffectStone:=Stone;                  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;
# Line 321  begin Line 322  begin
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;
# Line 374  end; Line 378  end;
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);
# Line 398  begin Line 407  begin
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    
# Line 444  var Line 454  var
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
# Line 476  begin Line 487  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;
# Line 490  end; Line 502  end;
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);
# Line 625  end; Line 636  end;
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    

Legend:
Removed from v.20  
changed lines
  Added in v.23

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26