Delphi-PRAXiS
Seite 6 von 18   « Erste     456 7816     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz (https://www.delphipraxis.net/162412-tic-tac-toe-mal-wieder-versteh-aufgabestellung-nicht-ganz.html)

DeddyH 23. Aug 2011 13:12

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Könnte man das nicht gleich von Anfang an ordentlich aufziehen und Logik und Darstellung trennen? Ich finde, damit kann man gar nicht früh genug anfangen und gewöhnt sich dann suboptimale Arbeitsweise gar nicht erst an.

biby90 23. Aug 2011 13:16

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
ja hatte ich ja auch^^
nur wusste ich ja nicht dass es nicht funktioniert.
ich habe den Teil mit CheckForWin auskommentiert.... also es klappt alles hundert Prozent!
nur das ist eben noch die Sache die klappen muss

DeddyH 23. Aug 2011 13:18

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Nee, das hast Du nicht, Du verwendest visuelle Controls (TLabel) als Datenspeicher. Dafür sind sie aber nicht gedacht, sondern nur zur Darstellung von Daten. Ich weiß, dass man solchen Code oft findet, richtig gut ist das aber beileibe nicht.

himitsu 23. Aug 2011 13:19

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Du hast ein Parameter-Array ... wie wäre es, wenn man die Captions der Labels an diesen Parameter (beim Aufruf der Prozedur) übergibt?

mleyen 23. Aug 2011 13:21

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Jetzt kommt ihr sogar hier noch mit asm und irgendwelchen factory factory factorys.... :roll::roll:

Delphi-Quellcode:
  AIndex[1]:= Label1.Caption;
  AIndex[2]:= Label2.Caption;
  AIndex[3]:= Label3.Caption;
  AIndex[4]:= Label4.Caption;
  AIndex[5]:= Label5.Caption;
  AIndex[6]:= Label6.Caption;
  AIndex[7]:= Label7.Caption;
  AIndex[8]:= Label8.Caption;
  AIndex[9]:= Label9.Caption;

biby90 23. Aug 2011 13:22

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Na, das muss man mir ja auch sagen, dass man es mit Labels nicht machen kann.
Ich muss die halt benutzen. dann suche ich mir mal einen anderen Weg womit es klappt.

DeddyH 23. Aug 2011 13:23

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Nö, ich hätte jetzt an einen Record mit Status (der neue Typ) und zugehörigem Label gedacht sowie einem 2-dimensionalen Array desselben. Das ist zwar immer noch nicht ideal, hält aber zusammen, was zusammen gehört.

biby90 23. Aug 2011 13:24

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Zitat:

wenn man die Captions der Labels an diesen Parameter

Delphi-Quellcode:
if CheckForWin(Label9.Caption) then
das macht der Compiler nicht.
Zitat:

[Pascal Fehler] Unit1.pas(277): E2010 Inkompatible Typen: 'Array' und 'TCaption'

DeddyH 23. Aug 2011 13:25

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
Delphi-Quellcode:
if CheckForWin([Label1.Caption, Label2.Caption, Label3.Caption]) then

biby90 23. Aug 2011 13:28

AW: tic tac toe.... mal wieder:) versteh aufgabestellung nicht ganz
 
aber mit dem Label1 hat er ja 3 Gewinnmöglichkeiten.


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:18 Uhr.
Seite 6 von 18   « Erste     456 7816     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz