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 19 by yamat0jp, Sat Jul 18 15:23:51 2015 UTC revision 21 by yamat0jp, Sat Jul 18 22:36:44 2015 UTC
# Line 39  type Line 39  type
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;
# Line 133  var Line 135  var
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        stWhite:
142        Stone := stBlack;        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
# Line 169  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          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
# Line 191  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;
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;    FTerminated:=true;
   FActive := false;  
382  end;  end;
383    
384  procedure TStoneGrid.Restart;  procedure TStoneGrid.Restart;
385  begin  begin
386    FActive := true;    if FTerminated = true then
387    FTurnIndex := FTurnNumber;    begin
388        FActive := true;
389        FTurnIndex := FTurnNumber;
390        FTerminated:=false;
391      end;
392  end;  end;
393    
394  procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType);  procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType);
# Line 398  begin Line 405  begin
405      FTurnNumber := 0      FTurnNumber := 0
406    else    else
407      FTurnNumber := Value;      FTurnNumber := Value;
   FActive := false;  
408    FStrings := FBuffer[FTurnNumber];    FStrings := FBuffer[FTurnNumber];
409  end;  end;
410    
411  procedure TStoneGrid.Start;  procedure TStoneGrid.Start;
412  begin  begin
413    Clear;    Clear;
414      FTerminated:=false;
415    FActive := true;    FActive := true;
416  end;  end;
417    
# Line 490  end; Line 497  end;
497    
498  procedure TForm1.GameStart;  procedure TForm1.GameStart;
499  begin  begin
500      Index := Player1;
501    StoneGrid.Start;    StoneGrid.Start;
502    PaintBox1.Repaint;    PaintBox1.Repaint;
   Index := Player1;  
503    Caption := '黒から始めます';    Caption := '黒から始めます';
   Timer1.Enabled := true;  
504  end;  end;
505    
506  procedure TForm1.MenuItem10Click(Sender: TObject);  procedure TForm1.MenuItem10Click(Sender: TObject);
# Line 625  end; Line 631  end;
631    
632  procedure TForm1.Timer2Timer(Sender: TObject);  procedure TForm1.Timer2Timer(Sender: TObject);
633  begin  begin
634    if StoneGrid.ListExecute = true then    if (StoneGrid.Active = false)and(StoneGrid.ListExecute = true) then
635      PaintBox1.Repaint;      PaintBox1.Repaint;
636  end;  end;
637    

Legend:
Removed from v.19  
changed lines
  Added in v.21

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