Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /Unit1.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (hide annotations) (download) (as text)
Sat Jul 18 08:48:54 2015 UTC (8 years, 7 months ago) by yamat0jp
File MIME type: text/x-pascal
File size: 15678 byte(s)
手直ししたはずのエラーが治っていなかったので今度でよくなりました
1 yamat0jp 5 unit Unit1;
2 yamat0jp 1
3     interface
4    
5     uses
6 yamat0jp 5 System.SysUtils, System.Types, System.UITypes, System.Classes,
7     System.Variants,
8     FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Menus,
9     System.Math, FMX.Objects, FMX.StdCtrls;
10 yamat0jp 1
11     const
12     Count = 8;
13    
14     type
15 yamat0jp 14 TStoneType = (stNone, stWhite, stBlack, stError, stEffect);
16 yamat0jp 1
17 yamat0jp 14 TEffectData = record
18     X, Y: integer;
19     Left, Top: integer;
20     Stone: TStoneType;
21     end;
22    
23 yamat0jp 3 TGridData = array [0 .. Count - 1] of array [0 .. Count - 1] of TStoneType;
24 yamat0jp 1
25     TPlayer = class
26     private
27     FAuto: Boolean;
28 yamat0jp 4 FStone: TStoneType;
29 yamat0jp 1 public
30     property Auto: Boolean read FAuto write FAuto;
31 yamat0jp 4 property Stone: TStoneType read FStone write FStone;
32 yamat0jp 1 end;
33    
34     TStoneGrid = class
35     private
36     FStrings: TGridData;
37 yamat0jp 7 FBuffer: array [0 .. Count * Count - 4] of TGridData;
38 yamat0jp 1 FTurnNumber: integer;
39     FTurnIndex: integer;
40 yamat0jp 9 FActive: Boolean;
41 yamat0jp 14 List: TList;
42 yamat0jp 15 FBool: Boolean;
43 yamat0jp 14 FIndex_X: integer;
44     FIndex_Y: integer;
45 yamat0jp 1 function GetStrings(X, Y: integer): TStoneType;
46     procedure SetStrings(X, Y: integer; const Value: TStoneType);
47     procedure SetTurnNumber(const Value: integer);
48     public
49 yamat0jp 14 constructor Create;
50     destructor Destroy; override;
51 yamat0jp 1 procedure Clear;
52 yamat0jp 10 function CalScore(Stone: TStoneType; X, Y: integer): integer;
53     function CanSetStone(Stone: TStoneType; X, Y: integer; Reverse: Boolean;
54 yamat0jp 7 const Visible: Boolean = false): Boolean;
55 yamat0jp 10 function NextStone(Stone: TStoneType): TPoint;
56 yamat0jp 9 procedure Start;
57     procedure Restart;
58     procedure Pause;
59 yamat0jp 14 function ListExecute: Boolean;
60     procedure Paint(Canvas: TCanvas);
61     procedure ImageCount(X, Y: integer);
62 yamat0jp 3 property Strings[X, Y: integer]: TStoneType read GetStrings
63     write SetStrings; default;
64 yamat0jp 1 property TurnNumber: integer read FTurnNumber write SetTurnNumber;
65 yamat0jp 10 property Active: Boolean read FActive;
66 yamat0jp 1 end;
67    
68     TForm1 = class(TForm)
69     Timer1: TTimer;
70     MainMenu1: TMainMenu;
71 yamat0jp 5 MenuItem1: TMenuItem;
72     MenuItem2: TMenuItem;
73     MenuItem3: TMenuItem;
74     MenuItem4: TMenuItem;
75     MenuItem5: TMenuItem;
76     MenuItem6: TMenuItem;
77     MenuItem7: TMenuItem;
78     PaintBox1: TPaintBox;
79 yamat0jp 7 MenuItem8: TMenuItem;
80     MenuItem9: TMenuItem;
81     MenuItem10: TMenuItem;
82     MenuItem11: TMenuItem;
83     MenuItem12: TMenuItem;
84 yamat0jp 14 Timer2: TTimer;
85     Image1: TImage;
86     Image2: TImage;
87     Image3: TImage;
88     Image4: TImage;
89 yamat0jp 15 Image5: TImage;
90 yamat0jp 1 procedure FormCreate(Sender: TObject);
91     procedure FormDestroy(Sender: TObject);
92     procedure Timer1Timer(Sender: TObject);
93     procedure FormResize(Sender: TObject);
94 yamat0jp 5 procedure MenuItem4Click(Sender: TObject);
95     procedure MenuItem2Click(Sender: TObject);
96 yamat0jp 7 procedure PaintBox1Tap(Sender: TObject; const Point: TPointF);
97     procedure PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
98 yamat0jp 5 Shift: TShiftState; X, Y: Single);
99     procedure PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
100     procedure MenuItem6Click(Sender: TObject);
101 yamat0jp 7 procedure PaintBox1Resize(Sender: TObject);
102     procedure MenuItem8Click(Sender: TObject);
103     procedure MenuItem10Click(Sender: TObject);
104     procedure MenuItem11Click(Sender: TObject);
105 yamat0jp 14 procedure Timer2Timer(Sender: TObject);
106 yamat0jp 1 private
107 yamat0jp 5 { Private ���� }
108 yamat0jp 1 StoneGrid: TStoneGrid;
109     Index: TPlayer;
110     Size: integer;
111     procedure CompStone;
112     procedure GameStart;
113     procedure ChangePlayer;
114     public
115 yamat0jp 5 { Public ���� }
116 yamat0jp 1 end;
117    
118     var
119     Player1: TPlayer;
120     Player2: TPlayer;
121    
122     Form1: TForm1;
123    
124     implementation
125    
126 yamat0jp 5 {$R *.fmx}
127 yamat0jp 7 {$R *.Windows.fmx MSWINDOWS}
128 yamat0jp 1 { TStoneGrid }
129    
130 yamat0jp 10 function TStoneGrid.CalScore(Stone: TStoneType; X, Y: integer): integer;
131 yamat0jp 1 var
132     i, j: integer;
133     begin
134 yamat0jp 10 if CanSetStone(Stone, X, Y, true) = true then
135 yamat0jp 1 begin
136 yamat0jp 10 if Stone = stBlack then
137     Stone := stWhite
138 yamat0jp 3 else
139 yamat0jp 10 Stone := stBlack;
140 yamat0jp 3 result := 0;
141     for i := 0 to Count - 1 do
142     for j := 0 to Count - 1 do
143 yamat0jp 10 if CanSetStone(Stone, i, j, false) = true then
144 yamat0jp 3 inc(result);
145 yamat0jp 9 FStrings := FBuffer[FTurnIndex];
146 yamat0jp 3 end
147     else
148 yamat0jp 1 begin
149 yamat0jp 9 FStrings := FBuffer[FTurnIndex];
150 yamat0jp 3 result := -1;
151 yamat0jp 1 end;
152     end;
153    
154 yamat0jp 10 function TStoneGrid.CanSetStone(Stone: TStoneType; X, Y: integer;
155 yamat0jp 7 Reverse: Boolean; const Visible: Boolean): Boolean;
156 yamat0jp 1 var
157 yamat0jp 14 i: integer;
158 yamat0jp 4 p: Boolean;
159 yamat0jp 14 q: ^TEffectData;
160 yamat0jp 4 procedure Method(m, n: integer);
161 yamat0jp 3 var
162 yamat0jp 4 s: TStoneType;
163 yamat0jp 15 j, k: integer;
164 yamat0jp 1 begin
165 yamat0jp 4 if p = false then
166     Exit;
167     i := 1;
168 yamat0jp 3 while true do
169 yamat0jp 4 begin
170     s := GetStrings(X + m * i, Y + n * i);
171     if (s = stNone) or (s = stError) then
172     break
173 yamat0jp 10 else if s = Stone then
174 yamat0jp 4 if i > 1 then
175     begin
176 yamat0jp 15 if (result = false) and (Reverse = true) then
177     SetStrings(X, Y, Stone);
178 yamat0jp 4 result := true;
179     if Reverse = true then
180 yamat0jp 1 begin
181 yamat0jp 4 for j := 1 to i - 1 do
182 yamat0jp 7 begin
183 yamat0jp 15 Form1.PaintBox1.Repaint;
184 yamat0jp 14 if Visible = true then
185     begin
186     New(q);
187     q^.Left := X + m * j;
188     q^.Top := Y + n * j;
189     q^.Stone := Stone;
190     q^.X := 0;
191     q^.Y := 0;
192     List.Add(q);
193     SetStrings(q^.Left, q^.Top, stEffect);
194 yamat0jp 15 for k := 1 to 10 do
195     begin
196     Sleep(10);
197     Application.ProcessMessages;
198     end;
199 yamat0jp 14 end
200     else
201     SetStrings(X + m * j, Y + n * j, Stone);
202 yamat0jp 7 end;
203 yamat0jp 4 break;
204 yamat0jp 3 end
205     else
206 yamat0jp 1 begin
207 yamat0jp 4 p := false;
208 yamat0jp 3 break;
209 yamat0jp 4 end;
210     end
211     else
212     break
213 yamat0jp 3 else
214 yamat0jp 4 inc(i);
215     end;
216 yamat0jp 3 end;
217    
218     begin
219 yamat0jp 17 result := false;
220 yamat0jp 15 if Visible = true then
221     begin
222     FBool := FActive;
223     FActive := false;
224     end;
225 yamat0jp 14 p := true;
226     if GetStrings(X, Y) = stNone then
227 yamat0jp 9 begin
228 yamat0jp 14 Method(-1, -1);
229     Method(-1, 0);
230     Method(-1, 1);
231     Method(0, -1);
232     Method(0, 1);
233     Method(1, -1);
234     Method(1, 0);
235     Method(1, 1);
236 yamat0jp 9 end;
237 yamat0jp 1 end;
238    
239     procedure TStoneGrid.Clear;
240     var
241     i, j: integer;
242     begin
243 yamat0jp 3 for i := 0 to Count - 1 do
244     for j := 0 to Count - 1 do
245     Strings[i, j] := stNone;
246     Strings[3, 3] := stBlack;
247     Strings[4, 4] := stBlack;
248     Strings[4, 3] := stWhite;
249     Strings[3, 4] := stWhite;
250 yamat0jp 7 FTurnNumber := 0;
251     FTurnIndex := 0;
252 yamat0jp 10 FBuffer[0] := FStrings;
253 yamat0jp 1 end;
254    
255 yamat0jp 14 constructor TStoneGrid.Create;
256     begin
257     inherited;
258     List := TList.Create;
259     end;
260    
261     destructor TStoneGrid.Destroy;
262     var
263     i: integer;
264     begin
265     for i := 0 to List.Count - 1 do
266     Dispose(List[i]);
267     List.Free;
268     inherited;
269     end;
270    
271 yamat0jp 1 function TStoneGrid.GetStrings(X, Y: integer): TStoneType;
272     begin
273 yamat0jp 3 if (X >= 0) and (X < Count) and (Y >= 0) and (Y < Count) then
274 yamat0jp 4 result := FStrings[X, Y]
275 yamat0jp 3 else
276     result := stError;
277 yamat0jp 1 end;
278    
279 yamat0jp 14 procedure TStoneGrid.ImageCount(X, Y: integer);
280     begin
281     FIndex_X := X;
282     FIndex_Y := Y;
283     end;
284    
285     function TStoneGrid.ListExecute: Boolean;
286     var
287     p: ^TEffectData;
288     i: integer;
289     begin
290     if List.Count = 0 then
291     result := false
292     else
293     begin
294     for i := 0 to List.Count - 1 do
295     begin
296     p := List.List[i];
297     if p^.X < FIndex_X - 1 then
298     p^.X := p^.X + 1
299     else if p^.Y < FIndex_Y - 1 then
300     begin
301     p^.X := 0;
302     p^.Y := p^.Y + 1;
303     end
304     else
305     begin
306     SetStrings(p^.Left, p^.Top, p^.Stone);
307     Dispose(p);
308     List[i] := nil;
309     end;
310     end;
311     for i := List.Count - 1 downto 0 do
312     if List[i] = nil then
313     List.Delete(i);
314     if List.Count = 0 then
315     begin
316 yamat0jp 15 FActive := FBool;
317 yamat0jp 14 inc(FTurnIndex);
318     inc(FTurnNumber);
319     FBuffer[FTurnIndex] := FStrings;
320     end;
321     result := true;
322     end;
323     end;
324    
325 yamat0jp 10 function TStoneGrid.NextStone(Stone: TStoneType): TPoint;
326 yamat0jp 1 var
327     i, j, m, n: integer;
328     begin
329 yamat0jp 3 n := -1;
330     for i := 0 to Count - 1 do
331     for j := 0 to Count - 1 do
332 yamat0jp 1 begin
333 yamat0jp 10 m := CalScore(Stone, i, j);
334 yamat0jp 3 if (n = -1) or ((m > -1) and (n > m)) then
335 yamat0jp 1 begin
336 yamat0jp 3 n := m;
337     result := Point(i, j);
338 yamat0jp 1 end;
339     end;
340     if n = -1 then
341 yamat0jp 3 result := Point(-1, -1);
342 yamat0jp 1 end;
343    
344 yamat0jp 14 procedure TStoneGrid.Paint(Canvas: TCanvas);
345     var
346     i: integer;
347     k, m, n: integer;
348     s: TBitmap;
349     p: ^TEffectData;
350     begin
351     m := Form1.Image3.Bitmap.Width;
352     n := Form1.Image3.Bitmap.Height;
353 yamat0jp 15 k := Form1.Size;
354 yamat0jp 14 for i := 0 to List.Count - 1 do
355     begin
356     p := List[i];
357     if p^.Stone = stBlack then
358     s := Form1.Image1.Bitmap
359     else
360     s := Form1.Image2.Bitmap;
361     Canvas.DrawBitmap(s, RectF(p^.X * m, p^.Y * n, (p^.X + 1) * m,
362     (p^.Y + 1) * n), RectF(p^.Left * k, p^.Top * k, (p^.Left + 1) * k,
363     (p^.Top + 1) * k), 1);
364     end;
365     end;
366    
367 yamat0jp 9 procedure TStoneGrid.Pause;
368     begin
369 yamat0jp 15 FBool := false;
370 yamat0jp 10 FActive := false;
371 yamat0jp 9 end;
372    
373     procedure TStoneGrid.Restart;
374     begin
375 yamat0jp 10 FActive := true;
376     FTurnIndex := FTurnNumber;
377 yamat0jp 9 end;
378    
379 yamat0jp 1 procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType);
380     begin
381 yamat0jp 3 if (X >= 0) and (X < Count) and (Y >= 0) and (Y < Count) then
382     FStrings[X, Y] := Value;
383 yamat0jp 1 end;
384    
385     procedure TStoneGrid.SetTurnNumber(const Value: integer);
386     begin
387     if Value > FTurnIndex then
388 yamat0jp 4 FTurnNumber := FTurnIndex
389 yamat0jp 12 else if Value < 0 then
390     FTurnNumber := 0
391 yamat0jp 3 else
392     FTurnNumber := Value;
393 yamat0jp 10 FActive := false;
394 yamat0jp 3 FStrings := FBuffer[FTurnNumber];
395 yamat0jp 1 end;
396    
397 yamat0jp 9 procedure TStoneGrid.Start;
398     begin
399     Clear;
400     FActive := true;
401     end;
402    
403 yamat0jp 1 { TForm1 }
404    
405     procedure TForm1.ChangePlayer;
406     var
407     i, j, m, n: integer;
408     s: string;
409     procedure Main;
410     begin
411     if Index = Player1 then
412 yamat0jp 17 begin
413     Index := Player2;
414     s := '������������';
415     end
416 yamat0jp 3 else
417 yamat0jp 17 begin
418 yamat0jp 3 Index := Player1;
419 yamat0jp 17 s := '������������';
420     end;
421 yamat0jp 1 end;
422     function Execute: Boolean;
423     var
424     i, j: integer;
425 yamat0jp 17 m: integer;
426     n: integer;
427 yamat0jp 1 begin
428 yamat0jp 3 result := false;
429 yamat0jp 17 with StoneGrid do
430     for i := 0 to Count - 1 do
431     for j := 0 to Count - 1 do
432     if CanSetStone(Index.Stone, i, j, false) = true then
433     begin
434     for m := 0 to Count - 1 do
435     for n := 0 to Count - 1 do
436     if GetStrings(m, n) <> Index.Stone then
437     begin
438     result := true;
439     Exit;
440     end;
441     result := false;
442     end;
443 yamat0jp 1 end;
444 yamat0jp 3
445 yamat0jp 1 begin
446 yamat0jp 3 Main;
447 yamat0jp 1 if Execute = false then
448     begin
449 yamat0jp 3 Main;
450 yamat0jp 1 if Execute = false then
451     begin
452 yamat0jp 17 Timer1.Enabled := false;
453 yamat0jp 9 StoneGrid.Pause;
454 yamat0jp 3 m := 0;
455     n := 0;
456     for i := 0 to Count - 1 do
457     for j := 0 to Count - 1 do
458     case StoneGrid[i, j] of
459     stBlack:
460     inc(m);
461     stWhite:
462     inc(n);
463 yamat0jp 1 end;
464 yamat0jp 17 Caption := s;
465 yamat0jp 1 if m > n then
466 yamat0jp 4 s := 'Player1 Win:' + #13#10
467 yamat0jp 3 else if m < n then
468 yamat0jp 4 s := 'Player2 Win:' + #13#10
469 yamat0jp 3 else
470     s := 'Draw:' + #13#10;
471 yamat0jp 7 Showmessage(s + '(Player1) ' + IntToStr(m) + #13#10 + '(Player2) ' +
472     IntToStr(n));
473 yamat0jp 17 end
474     else
475     Caption := s;
476     end
477     else
478     Caption := s;
479 yamat0jp 1 end;
480    
481     procedure TForm1.CompStone;
482     var
483     s: TPoint;
484     begin
485 yamat0jp 10 s := StoneGrid.NextStone(Index.Stone);
486     StoneGrid.CanSetStone(Index.Stone, s.X, s.Y, true, true);
487 yamat0jp 5 PaintBox1.Repaint;
488 yamat0jp 7 ChangePlayer;
489 yamat0jp 1 end;
490    
491     procedure TForm1.GameStart;
492     begin
493 yamat0jp 9 StoneGrid.Start;
494 yamat0jp 5 PaintBox1.Repaint;
495 yamat0jp 3 Index := Player1;
496 yamat0jp 17 Caption := '�������n������';
497 yamat0jp 3 Timer1.Enabled := true;
498 yamat0jp 1 end;
499    
500 yamat0jp 7 procedure TForm1.MenuItem10Click(Sender: TObject);
501     begin
502 yamat0jp 9 StoneGrid.Restart;
503 yamat0jp 7 Timer1.Enabled := true;
504     end;
505    
506     procedure TForm1.MenuItem11Click(Sender: TObject);
507 yamat0jp 17 var
508     i: integer;
509 yamat0jp 7 begin
510     with StoneGrid do
511 yamat0jp 17 begin
512     i := TurnNumber;
513 yamat0jp 7 if Sender = MenuItem11 then
514     TurnNumber := TurnNumber + 1
515     else
516     TurnNumber := TurnNumber - 1;
517 yamat0jp 17 if (i = TurnNumber) then
518     Exit
519     else
520     Pause;
521     end;
522 yamat0jp 14 PaintBox1.Repaint;
523 yamat0jp 12 ChangePlayer;
524 yamat0jp 7 end;
525    
526 yamat0jp 5 procedure TForm1.MenuItem2Click(Sender: TObject);
527 yamat0jp 1 begin
528 yamat0jp 3 GameStart;
529 yamat0jp 1 end;
530    
531 yamat0jp 5 procedure TForm1.MenuItem4Click(Sender: TObject);
532 yamat0jp 1 begin
533 yamat0jp 5 Close;
534 yamat0jp 1 end;
535    
536 yamat0jp 5 procedure TForm1.MenuItem6Click(Sender: TObject);
537     begin
538 yamat0jp 7 Player1.Auto := MenuItem6.IsChecked;
539     Player2.Auto := MenuItem7.IsChecked;
540 yamat0jp 10 MenuItem10Click(Sender);
541 yamat0jp 5 end;
542    
543 yamat0jp 7 procedure TForm1.MenuItem8Click(Sender: TObject);
544     begin
545 yamat0jp 9 StoneGrid.Pause;
546 yamat0jp 7 end;
547    
548 yamat0jp 5 procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
549 yamat0jp 1 var
550     i, j: integer;
551     begin
552 yamat0jp 17 for i := 0 to Count - 1 do
553 yamat0jp 1 begin
554 yamat0jp 17 for j := 0 to Count - 1 do
555 yamat0jp 1 begin
556 yamat0jp 3 case StoneGrid.Strings[i, j] of
557     stWhite:
558 yamat0jp 14 Canvas.DrawBitmap(Image4.Bitmap, RectF(0, 0, Image4.Bitmap.Width,
559     Image4.Bitmap.Height), RectF(i * Size, j * Size, (i + 1) * Size,
560 yamat0jp 7 (j + 1) * Size), 1);
561 yamat0jp 3 stBlack:
562 yamat0jp 14 Canvas.DrawBitmap(Image3.Bitmap, RectF(0, 0, Image3.Bitmap.Width,
563     Image3.Bitmap.Height), RectF(i * Size, j * Size, (i + 1) * Size,
564     (j + 1) * Size), 1);
565 yamat0jp 15 stEffect:
566     continue;
567 yamat0jp 14 else
568 yamat0jp 15 Canvas.DrawBitmap(Image5.Bitmap, RectF(0, 0, Image5.Bitmap.Width,
569     Image5.Bitmap.Height), RectF(i * Size, j * Size, (i + 1) * Size,
570     (j + 1) * Size), 1);
571 yamat0jp 1 end;
572 yamat0jp 15 Canvas.DrawLine(PointF(0, j * Size), PointF(Count * Size, j * Size), 1);
573 yamat0jp 1 end;
574 yamat0jp 15 Canvas.DrawLine(PointF(i * Size, 0), PointF(i * Size, Size * Count), 1);
575 yamat0jp 1 end;
576 yamat0jp 17 Canvas.DrawLine(PointF(Count * Size, 0),
577     PointF(Count * Size, Count * Size), 1);
578     Canvas.DrawLine(PointF(0, Count * Size),
579     PointF(Count * Size, Count * Size), 1);
580 yamat0jp 14 if StoneGrid.Active = false then
581     StoneGrid.Paint(Canvas);
582 yamat0jp 1 end;
583    
584 yamat0jp 7 procedure TForm1.PaintBox1Resize(Sender: TObject);
585     begin
586     Size := Min(ClientWidth, ClientHeight) div Count;
587     end;
588    
589 yamat0jp 5 procedure TForm1.FormCreate(Sender: TObject);
590 yamat0jp 1 begin
591 yamat0jp 5 StoneGrid := TStoneGrid.Create;
592 yamat0jp 14 StoneGrid.ImageCount(Form1.Image1.Bitmap.Width div Form1.Image3.Bitmap.Width,
593     Form1.Image1.Bitmap.Height div Form1.Image3.Bitmap.Height);
594 yamat0jp 5 Player1 := TPlayer.Create;
595     Player2 := TPlayer.Create;
596     Player1.Stone := stBlack;
597     Player2.Stone := stWhite;
598     Player2.Auto := true;
599     with PaintBox1.Canvas do
600 yamat0jp 1 begin
601 yamat0jp 5 StrokeDash := TStrokeDash.Solid;
602     Stroke.Color := TAlphaColors.Black;
603     StrokeThickness := 3;
604 yamat0jp 1 end;
605 yamat0jp 7 PaintBox1Resize(Sender);
606 yamat0jp 5 GameStart;
607 yamat0jp 1 end;
608    
609 yamat0jp 5 procedure TForm1.FormDestroy(Sender: TObject);
610     begin
611     StoneGrid.Free;
612     Player1.Free;
613     Player2.Free;
614     end;
615    
616 yamat0jp 7 procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
617 yamat0jp 5 Shift: TShiftState; X, Y: Single);
618     begin
619 yamat0jp 7 PaintBox1Tap(Sender, PointF(X, Y));
620 yamat0jp 5 end;
621    
622 yamat0jp 1 procedure TForm1.Timer1Timer(Sender: TObject);
623     begin
624 yamat0jp 10 if (StoneGrid.Active = true) and (Index.Auto = true) then
625 yamat0jp 1 begin
626 yamat0jp 3 Timer1.Enabled := false;
627     CompStone;
628     Timer1.Enabled := true;
629 yamat0jp 1 end;
630     end;
631    
632 yamat0jp 14 procedure TForm1.Timer2Timer(Sender: TObject);
633     begin
634     if StoneGrid.ListExecute = true then
635     PaintBox1.Repaint;
636     end;
637    
638 yamat0jp 1 procedure TForm1.FormResize(Sender: TObject);
639     begin
640 yamat0jp 3 Size := Min(ClientWidth, ClientHeight) div Count;
641 yamat0jp 5 PaintTo(Canvas);
642 yamat0jp 1 end;
643    
644 yamat0jp 7 procedure TForm1.PaintBox1Tap(Sender: TObject; const Point: TPointF);
645 yamat0jp 1 begin
646 yamat0jp 11 if Index.Auto = false then
647     begin
648 yamat0jp 10 MenuItem10Click(Sender);
649     if StoneGrid.CanSetStone(Index.Stone, Floor(Point.X / Size),
650 yamat0jp 7 Floor(Point.Y / Size), true, true) = true then
651 yamat0jp 5 begin
652     PaintBox1.Repaint;
653 yamat0jp 7 ChangePlayer;
654 yamat0jp 5 end;
655     end;
656 yamat0jp 1 end;
657    
658     end.

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