AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Unentschieden ! Wie definiere ich es

Ein Thema von harryi · begonnen am 5. Okt 2008 · letzter Beitrag vom 8. Okt 2008
 
harryi

Registriert seit: 29. Sep 2008
14 Beiträge
 
#1

Unentschieden ! Wie definiere ich es

  Alt 5. Okt 2008, 23:22
Hallo,

ich habe hier mal ein Spiel geschrieben als Schulaufgabe.
Alle Proceure festgelegt.

Es ist das bekannte 3 gewinnt Spiel auch TicTaeToe genannt.

-Wie definiere ich, dass wenn alle Felder( Buttons) angeklickt sind und keiner
procedure Gewinner aktiviert? Dann ist nämlich unentschieden für Beiden.

(- Ich freue mich auch gerne über Verbesserungsvorschläge und Tipps für meinen Design usw.)




Hier mal mein Gewinnprocedure:

Delphi-Quellcode:
procedure TForm1.Gewinner;
begin
// ___________ Gewinnerdefinition___________ \\
                 // 1-2-3 \\
                // 4-5-6 \\
               // 7-8-9 \\



//Player 1 = O gewinnt!

// [Player Win 1.1] 1-2-3
if (Button1.caption='O') and (Button2.caption='O') and (Button3.caption='O') then
Form2.Show;
if (Button1.caption='O') and (Button2.caption='O') and (Button3.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.2] 4-5-6
if (Button4.caption='O') and (Button5.caption='O') and (Button6.caption='O') then
Form2.Show;
if (Button4.caption='O') and (Button5.caption='O') and (Button6.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.3] 7-8-9
if (Button7.caption='O') and (Button8.caption='O') and (Button9.caption='O') then
Form2.Show;
if (Button7.caption='O') and (Button8.caption='O') and (Button9.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.4] 1-4-7
if (Button1.caption='O') and (Button4.caption='O') and (Button7.caption='O') then
Form2.Show;
if (Button1.caption='O') and (Button4.caption='O') and (Button7.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.5] 2-5-8
if (Button2.caption='O') and (Button5.caption='O') and (Button8.caption='O') then
Form2.Show;
if (Button2.caption='O') and (Button5.caption='O') and (Button8.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.6] 3-6-9
if (Button3.caption='O') and (Button6.caption='O') and (Button9.caption='O') then
Form2.Show;
if (Button3.caption='O') and (Button6.caption='O') and (Button9.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.7] 1-5-9
if (Button1.caption='O') and (Button5.caption='O') and (Button9.caption='O') then
Form2.Show;
if (Button1.caption='O') and (Button5.caption='O') and (Button9.caption='O') then
Panel2.Caption:='gewonnen';

// [Player Win 1.8] 3-5-7
if (Button3.caption='O') and (Button5.caption='O') and (Button7.caption='O') then
Form2.Show;
if (Button3.caption='O') and (Button5.caption='O') and (Button7.caption='O') then
Panel2.Caption:='gewonnen';






//Player 2 = X gewinnt!

// [Player Win 2.1] 1-2-3
if (Button1.caption='X') and (Button2.caption='X') and (Button3.caption='X') then
Form3.Show;
if (Button1.caption='X') and (Button2.caption='X') and (Button3.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.2] 4-5-6
if (Button4.caption='X') and (Button5.caption='X') and (Button6.caption='X') then
Form3.Show;
if (Button4.caption='X') and (Button5.caption='X') and (Button6.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.3] 7-8-9
if (Button7.caption='X') and (Button8.caption='X') and (Button9.caption='X') then
Form3.Show;
if (Button7.caption='X') and (Button8.caption='X') and (Button9.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.4] 1-4-7
if (Button1.caption='X') and (Button4.caption='X') and (Button7.caption='X') then
Form3.Show;
if (Button1.caption='X') and (Button4.caption='X') and (Button7.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.5] 2-5-8
if (Button2.caption='X') and (Button5.caption='X') and (Button8.caption='X') then
Form3.Show;
if (Button2.caption='X') and (Button5.caption='X') and (Button8.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.6] 3-6-9
if (Button3.caption='X') and (Button6.caption='X') and (Button9.caption='X') then
Form3.Show;
if (Button3.caption='X') and (Button6.caption='X') and (Button9.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.7] 1-5-9
if (Button1.caption='X') and (Button5.caption='X') and (Button9.caption='X') then
Form3.Show;
if (Button1.caption='X') and (Button5.caption='X') and (Button9.caption='X') then
Panel2.Caption:='gewonnen';

// [Player Win 2.8] 3-5-7
if (Button3.caption='X') and (Button5.caption='X') and (Button7.caption='X') then
Form3.Show;
if (Button3.caption='X') and (Button5.caption='X') and (Button7.caption='X') then
Panel2.Caption:='gewonnen'


Danke
Angehängte Dateien
Dateityp: rar p9_154.rar (561,3 KB, 15x aufgerufen)
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:24 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz