Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /Unit1.pas

Parent Directory Parent Directory | Revision Log Revision Log


Revision 19 - (hide annotations) (download) (as text)
Sat Jul 18 15:23:51 2015 UTC (8 years, 7 months ago) by yamat0jp
File MIME type: text/x-pascal
File size: 15467 byte(s)
stEffectを正しく認識できていないことが判明

訂正しました
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 yamat0jp 19 if s = stEffect then
172     for j := 0 to List.Count-1 do
173     if List[j] <> nil then
174     begin
175     q:=List[j];
176     s:=q^.Stone;
177     break;
178     end;
179 yamat0jp 4 if (s = stNone) or (s = stError) then
180     break
181 yamat0jp 10 else if s = Stone then
182 yamat0jp 4 if i > 1 then
183     begin
184 yamat0jp 15 if (result = false) and (Reverse = true) then
185     SetStrings(X, Y, Stone);
186 yamat0jp 4 result := true;
187     if Reverse = true then
188 yamat0jp 1 begin
189 yamat0jp 4 for j := 1 to i - 1 do
190 yamat0jp 7 begin
191 yamat0jp 15 Form1.PaintBox1.Repaint;
192 yamat0jp 14 if Visible = true then
193     begin
194     New(q);
195     q^.Left := X + m * j;
196     q^.Top := Y + n * j;
197     q^.Stone := Stone;
198     q^.X := 0;
199     q^.Y := 0;
200     List.Add(q);
201     SetStrings(q^.Left, q^.Top, stEffect);
202 yamat0jp 19 for k := 1 to 100 do
203 yamat0jp 15 begin
204 yamat0jp 19 Sleep(1);
205 yamat0jp 15 Application.ProcessMessages;
206     end;
207 yamat0jp 14 end
208     else
209     SetStrings(X + m * j, Y + n * j, Stone);
210 yamat0jp 7 end;
211 yamat0jp 4 break;
212 yamat0jp 3 end
213     else
214 yamat0jp 1 begin
215 yamat0jp 4 p := false;
216 yamat0jp 3 break;
217 yamat0jp 4 end;
218     end
219     else
220     break
221 yamat0jp 3 else
222 yamat0jp 4 inc(i);
223     end;
224 yamat0jp 3 end;
225    
226     begin
227 yamat0jp 17 result := false;
228 yamat0jp 15 if Visible = true then
229     begin
230     FBool := FActive;
231     FActive := false;
232     end;
233 yamat0jp 14 p := true;
234     if GetStrings(X, Y) = stNone then
235 yamat0jp 9 begin
236 yamat0jp 14 Method(-1, -1);
237     Method(-1, 0);
238     Method(-1, 1);
239     Method(0, -1);
240     Method(0, 1);
241     Method(1, -1);
242     Method(1, 0);
243     Method(1, 1);
244 yamat0jp 9 end;
245 yamat0jp 1 end;
246    
247     procedure TStoneGrid.Clear;
248     var
249     i, j: integer;
250     begin
251 yamat0jp 3 for i := 0 to Count - 1 do
252     for j := 0 to Count - 1 do
253     Strings[i, j] := stNone;
254     Strings[3, 3] := stBlack;
255     Strings[4, 4] := stBlack;
256     Strings[4, 3] := stWhite;
257     Strings[3, 4] := stWhite;
258 yamat0jp 7 FTurnNumber := 0;
259     FTurnIndex := 0;
260 yamat0jp 10 FBuffer[0] := FStrings;
261 yamat0jp 1 end;
262    
263 yamat0jp 14 constructor TStoneGrid.Create;
264     begin
265     inherited;
266     List := TList.Create;
267     end;
268    
269     destructor TStoneGrid.Destroy;
270     var
271     i: integer;
272     begin
273     for i := 0 to List.Count - 1 do
274     Dispose(List[i]);
275     List.Free;
276     inherited;
277     end;
278    
279 yamat0jp 1 function TStoneGrid.GetStrings(X, Y: integer): TStoneType;
280     begin
281 yamat0jp 3 if (X >= 0) and (X < Count) and (Y >= 0) and (Y < Count) then
282 yamat0jp 4 result := FStrings[X, Y]
283 yamat0jp 3 else
284     result := stError;
285 yamat0jp 1 end;
286    
287 yamat0jp 14 procedure TStoneGrid.ImageCount(X, Y: integer);
288     begin
289     FIndex_X := X;
290     FIndex_Y := Y;
291     end;
292    
293     function TStoneGrid.ListExecute: Boolean;
294     var
295     p: ^TEffectData;
296     i: integer;
297     begin
298     if List.Count = 0 then
299     result := false
300     else
301     begin
302     for i := 0 to List.Count - 1 do
303     begin
304     p := List.List[i];
305     if p^.X < FIndex_X - 1 then
306     p^.X := p^.X + 1
307     else if p^.Y < FIndex_Y - 1 then
308     begin
309     p^.X := 0;
310     p^.Y := p^.Y + 1;
311     end
312     else
313     begin
314     SetStrings(p^.Left, p^.Top, p^.Stone);
315     Dispose(p);
316     List[i] := nil;
317     end;
318     end;
319     for i := List.Count - 1 downto 0 do
320     if List[i] = nil then
321     List.Delete(i);
322     if List.Count = 0 then
323     begin
324 yamat0jp 15 FActive := FBool;
325 yamat0jp 14 inc(FTurnIndex);
326     inc(FTurnNumber);
327     FBuffer[FTurnIndex] := FStrings;
328     end;
329     result := true;
330     end;
331     end;
332    
333 yamat0jp 10 function TStoneGrid.NextStone(Stone: TStoneType): TPoint;
334 yamat0jp 1 var
335     i, j, m, n: integer;
336     begin
337 yamat0jp 3 n := -1;
338     for i := 0 to Count - 1 do
339     for j := 0 to Count - 1 do
340 yamat0jp 1 begin
341 yamat0jp 10 m := CalScore(Stone, i, j);
342 yamat0jp 3 if (n = -1) or ((m > -1) and (n > m)) then
343 yamat0jp 1 begin
344 yamat0jp 3 n := m;
345     result := Point(i, j);
346 yamat0jp 1 end;
347     end;
348     if n = -1 then
349 yamat0jp 3 result := Point(-1, -1);
350 yamat0jp 1 end;
351    
352 yamat0jp 14 procedure TStoneGrid.Paint(Canvas: TCanvas);
353     var
354     i: integer;
355     k, m, n: integer;
356     s: TBitmap;
357     p: ^TEffectData;
358     begin
359     m := Form1.Image3.Bitmap.Width;
360     n := Form1.Image3.Bitmap.Height;
361 yamat0jp 15 k := Form1.Size;
362 yamat0jp 14 for i := 0 to List.Count - 1 do
363     begin
364     p := List[i];
365     if p^.Stone = stBlack then
366     s := Form1.Image1.Bitmap
367     else
368     s := Form1.Image2.Bitmap;
369     Canvas.DrawBitmap(s, RectF(p^.X * m, p^.Y * n, (p^.X + 1) * m,
370     (p^.Y + 1) * n), RectF(p^.Left * k, p^.Top * k, (p^.Left + 1) * k,
371     (p^.Top + 1) * k), 1);
372     end;
373     end;
374    
375 yamat0jp 9 procedure TStoneGrid.Pause;
376     begin
377 yamat0jp 15 FBool := false;
378 yamat0jp 10 FActive := false;
379 yamat0jp 9 end;
380    
381     procedure TStoneGrid.Restart;
382     begin
383 yamat0jp 10 FActive := true;
384     FTurnIndex := FTurnNumber;
385 yamat0jp 9 end;
386    
387 yamat0jp 1 procedure TStoneGrid.SetStrings(X, Y: integer; const Value: TStoneType);
388     begin
389 yamat0jp 3 if (X >= 0) and (X < Count) and (Y >= 0) and (Y < Count) then
390     FStrings[X, Y] := Value;
391 yamat0jp 1 end;
392    
393     procedure TStoneGrid.SetTurnNumber(const Value: integer);
394     begin
395     if Value > FTurnIndex then
396 yamat0jp 4 FTurnNumber := FTurnIndex
397 yamat0jp 12 else if Value < 0 then
398     FTurnNumber := 0
399 yamat0jp 3 else
400     FTurnNumber := Value;
401 yamat0jp 10 FActive := false;
402 yamat0jp 3 FStrings := FBuffer[FTurnNumber];
403 yamat0jp 1 end;
404    
405 yamat0jp 9 procedure TStoneGrid.Start;
406     begin
407     Clear;
408     FActive := true;
409     end;
410    
411 yamat0jp 1 { TForm1 }
412    
413     procedure TForm1.ChangePlayer;
414     var
415     i, j, m, n: integer;
416     s: string;
417     procedure Main;
418     begin
419     if Index = Player1 then
420 yamat0jp 17 begin
421     Index := Player2;
422     s := '������������';
423     end
424 yamat0jp 3 else
425 yamat0jp 17 begin
426 yamat0jp 3 Index := Player1;
427 yamat0jp 17 s := '������������';
428     end;
429 yamat0jp 1 end;
430     function Execute: Boolean;
431     var
432     i, j: integer;
433 yamat0jp 17 m: integer;
434     n: integer;
435 yamat0jp 1 begin
436 yamat0jp 18 for i := 0 to Count - 1 do
437     for j := 0 to Count - 1 do
438     if StoneGrid.CanSetStone(Index.Stone, i, j, false) = true then
439     begin
440     result := true;
441     Exit;
442     end;
443 yamat0jp 3 result := false;
444 yamat0jp 1 end;
445 yamat0jp 3
446 yamat0jp 1 begin
447 yamat0jp 3 Main;
448 yamat0jp 1 if Execute = false then
449     begin
450 yamat0jp 3 Main;
451 yamat0jp 1 if Execute = false then
452     begin
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 end;
504    
505     procedure TForm1.MenuItem11Click(Sender: TObject);
506 yamat0jp 17 var
507     i: integer;
508 yamat0jp 7 begin
509     with StoneGrid do
510 yamat0jp 17 begin
511     i := TurnNumber;
512 yamat0jp 7 if Sender = MenuItem11 then
513     TurnNumber := TurnNumber + 1
514     else
515     TurnNumber := TurnNumber - 1;
516 yamat0jp 17 if (i = TurnNumber) then
517     Exit
518     else
519     Pause;
520     end;
521 yamat0jp 14 PaintBox1.Repaint;
522 yamat0jp 12 ChangePlayer;
523 yamat0jp 7 end;
524    
525 yamat0jp 5 procedure TForm1.MenuItem2Click(Sender: TObject);
526 yamat0jp 1 begin
527 yamat0jp 3 GameStart;
528 yamat0jp 1 end;
529    
530 yamat0jp 5 procedure TForm1.MenuItem4Click(Sender: TObject);
531 yamat0jp 1 begin
532 yamat0jp 5 Close;
533 yamat0jp 1 end;
534    
535 yamat0jp 5 procedure TForm1.MenuItem6Click(Sender: TObject);
536     begin
537 yamat0jp 7 Player1.Auto := MenuItem6.IsChecked;
538     Player2.Auto := MenuItem7.IsChecked;
539 yamat0jp 5 end;
540    
541 yamat0jp 7 procedure TForm1.MenuItem8Click(Sender: TObject);
542     begin
543 yamat0jp 9 StoneGrid.Pause;
544 yamat0jp 7 end;
545    
546 yamat0jp 5 procedure TForm1.PaintBox1Paint(Sender: TObject; Canvas: TCanvas);
547 yamat0jp 1 var
548     i, j: integer;
549     begin
550 yamat0jp 18 if StoneGrid.Active = false then
551     StoneGrid.Paint(Canvas);
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 1 end;
581    
582 yamat0jp 7 procedure TForm1.PaintBox1Resize(Sender: TObject);
583     begin
584     Size := Min(ClientWidth, ClientHeight) div Count;
585     end;
586    
587 yamat0jp 5 procedure TForm1.FormCreate(Sender: TObject);
588 yamat0jp 1 begin
589 yamat0jp 5 StoneGrid := TStoneGrid.Create;
590 yamat0jp 14 StoneGrid.ImageCount(Form1.Image1.Bitmap.Width div Form1.Image3.Bitmap.Width,
591     Form1.Image1.Bitmap.Height div Form1.Image3.Bitmap.Height);
592 yamat0jp 5 Player1 := TPlayer.Create;
593     Player2 := TPlayer.Create;
594     Player1.Stone := stBlack;
595     Player2.Stone := stWhite;
596     Player2.Auto := true;
597     with PaintBox1.Canvas do
598 yamat0jp 1 begin
599 yamat0jp 5 StrokeDash := TStrokeDash.Solid;
600     Stroke.Color := TAlphaColors.Black;
601     StrokeThickness := 3;
602 yamat0jp 1 end;
603 yamat0jp 7 PaintBox1Resize(Sender);
604 yamat0jp 5 GameStart;
605 yamat0jp 1 end;
606    
607 yamat0jp 5 procedure TForm1.FormDestroy(Sender: TObject);
608     begin
609     StoneGrid.Free;
610     Player1.Free;
611     Player2.Free;
612     end;
613    
614 yamat0jp 7 procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
615 yamat0jp 5 Shift: TShiftState; X, Y: Single);
616     begin
617 yamat0jp 7 PaintBox1Tap(Sender, PointF(X, Y));
618 yamat0jp 5 end;
619    
620 yamat0jp 1 procedure TForm1.Timer1Timer(Sender: TObject);
621     begin
622 yamat0jp 10 if (StoneGrid.Active = true) and (Index.Auto = true) then
623 yamat0jp 3 CompStone;
624 yamat0jp 1 end;
625    
626 yamat0jp 14 procedure TForm1.Timer2Timer(Sender: TObject);
627     begin
628     if StoneGrid.ListExecute = true then
629     PaintBox1.Repaint;
630     end;
631    
632 yamat0jp 1 procedure TForm1.FormResize(Sender: TObject);
633     begin
634 yamat0jp 3 Size := Min(ClientWidth, ClientHeight) div Count;
635 yamat0jp 5 PaintTo(Canvas);
636 yamat0jp 1 end;
637    
638 yamat0jp 7 procedure TForm1.PaintBox1Tap(Sender: TObject; const Point: TPointF);
639 yamat0jp 1 begin
640 yamat0jp 11 if Index.Auto = false then
641     begin
642 yamat0jp 10 MenuItem10Click(Sender);
643     if StoneGrid.CanSetStone(Index.Stone, Floor(Point.X / Size),
644 yamat0jp 7 Floor(Point.Y / Size), true, true) = true then
645 yamat0jp 5 begin
646     PaintBox1.Repaint;
647 yamat0jp 7 ChangePlayer;
648 yamat0jp 5 end;
649     end;
650 yamat0jp 1 end;
651    
652     end.

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