Autor Beitrag
Satego
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Fr 21.12.07 18:41 
Hallo,

Ich schreibe gerade ein Programm (Black Jack) und wollte wissen
wie ich das mache, das immer nur eine neue karte aufgedeckt wird und nicht
gleich alle auf einmal. Habt ihr eine Idee?

Lg
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Fr 21.12.07 19:52 
Hallo!

Um Dir zu helfen, musst Du schon mehr Details herausrücken. Wie werden die Karten dargestellt? Wie hast Du das Aufdecken realisiert? usw.

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 11:10 
Die bilder decke ich mit Bild.picture.loadfromfile auf.
Wenn ich auf den button Neu klicke bekommt der computer und
der Spieler jeweils 2 Karten. Wenn man auf Hit klickt, bekommt der
Spieler immer eine neue Karte bis der Kartenwert 21 übersteigt.

Noch mehr Details?

lg

_________________
motivierter Anfänger ;)
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Sa 22.12.07 11:12 
Vllt noch ein bisschen Quellcode :wink:
:welcome:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 11:20 
hmhm das sind schon 3800 zeilen..

_________________
motivierter Anfänger ;)
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 11:29 
hast du nen virtuellen karten stapel?
zB.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
//Globale Variablen
KartenStapel:array[1..56] of byte;//1-14(1-10,B,D,K,As) (herz) 15-28(pik) 29-42(kreuz) 42-54(Karo) 
AktuelleStapelPosition:byte;

Procedure CreateKartenStapel;
var i,Karte:integer;
    VerfügbarenKarten:array[1..56] of boolean;
begin
 randomize;
 for Karte:=1 to 56 do            //Variblen initalisieren 
  VerfügbarenKarten[Karte]:=true;
 AktuelleStapelPosition:=1;       // ertse Karte, Stapel Voll
 for Karte:=1 to 56 do
 begin
  //such nach einer verfügbaren Karte
  repeat
   i:=random(56)+1; 
  until VerfügbarenKarten[i]=true;
  KartenStapel[Karte] :=i;       // Karte in den Stapel Schreiben
  VerfügbarenKarten[i]:=false;   // Karte nicht mehr Verfügbar
 end;
end;

Function GibNeueKarte:byte;//die nächste Karte aus dem Stapel 0=stapel leer, 1-14(1-10,B,D,K,As) (herz) 15-28(pik) 29-42(kreuz) 42-54(Karo) 
begin
 Result:=0;
 if AktuelleStapelPosition in [1..56] then
 begin
  Result:=KartenStapel[AktuelleStapelPosition];
  inc(AktuelleStapelPosition);
 end; 
end;

mit GibNeueKarte bekommst du immer eine neue frische Karte, bis der Stapel leer ist.

user profile iconSatego hat folgendes geschrieben:
Hallo,
.. das immer nur eine neue karte aufgedeckt wird und nicht
gleich alle auf einmal. Habt ihr eine Idee?
Lg


meinst du alle 56 möglich oder was meinst du damit?
oder meinst du die maximal 11(oder 12) karten die ein Spieler bekommen kann?
dann solttest du dir ne variable anlegen in der du speicherst wieviele Karten da schon liegen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
//Global
var
 AnzahlOffenerKarten : integer//0-12
 OffeneKarten        : array[1..12] of integer;//der Wert der Karte zB. 0=frei 1-56

und immer wenn eine neue Karte anzeigst zälhst AnzahlOffenerKarten hoch.
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 11:45 
Nein einen Stapel hab ich nicht!


ja ich meine die maximale 12 karten!

_________________
motivierter Anfänger ;)
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 11:52 
Aber wo hast du dann genau das Problem?


Zuletzt bearbeitet von LorenzS am Sa 22.12.07 11:55, insgesamt 1-mal bearbeitet
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 11:54 
mit dem array

_________________
motivierter Anfänger ;)
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 11:57 
wie siehst das array aus, bzw wie wendest du es an?
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Sa 22.12.07 12:05 
Solange du uns den relevanten Teil deines Sourcecodes nicht zeigst, kann man dir nur sehr schwer helfen. ;) Woher sollen wir wissen, wie du dein Black Jack-Spiel implementiert hast?
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 12:06 
Das array brauche ich für die neuen karten, weil ohne dem kommen die
karten alle aufeinmal!

_________________
motivierter Anfänger ;)
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 12:12 
immer die gleichen aussagen, wenn man nur ein karte freigibt wie kannst du dann alle
anzeigen?

1. Wie sieht deien anzeige aus, ist ein ein image/paintbox oder sind es 12 stück?
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 12:17 
damit ir es besser versteht.

p.s. nicht über den code wundern -> anfänger

_________________
motivierter Anfänger ;)


Zuletzt bearbeitet von Satego am Sa 22.12.07 14:16, insgesamt 1-mal bearbeitet
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 12:26 
project1 oder project2?

Das mit den absolutenpfaden für die bilder soltest du lassen.
sonst ist das programm nur bei dir ausführbar
Einloggen, um Attachments anzusehen!


Zuletzt bearbeitet von LorenzS am Sa 22.12.07 12:37, insgesamt 1-mal bearbeitet
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 12:27 
1

_________________
motivierter Anfänger ;)
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 12:29 
proj1

_________________
motivierter Anfänger ;)
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 12:40 
jetzt weis ich wieso der quelltesxt so lang ist, omg
statt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
If (karte3 =  1  ) and (Farbe3 = 1)then begin
    Bild3.picture.loadfromfile
    ('C:\Users\Tom\Desktop\3. HAK\SEN\Projekte\BLACK JACK\Kartensatz\he1.jpg');
end;

If (karte3 =  1  ) and (Farbe3 = 2)then begin
    Bild3.picture.loadfromfile
    ('C:\Users\Tom\Desktop\3. HAK\SEN\Projekte\BLACK JACK\Kartensatz\pi1.jpg');
end;

If (karte3 =  1  ) and (Farbe3 = 3)then begin
    Bild3.picture.loadfromfile
    ('C:\Users\Tom\Desktop\3. HAK\SEN\Projekte\BLACK JACK\Kartensatz\kr1.jpg');
end;

If (karte3 =  1  ) and (Farbe3 = 4)then begin
    Bild3.picture.loadfromfile
    ('C:\Users\Tom\Desktop\3. HAK\SEN\Projekte\BLACK JACK\Kartensatz\ka1.jpg');
end;
.. usw

kannst auch machen
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
 if Karte3 in [1..13] and Farbe3 in [1..4] then
  case Farbe3 of
   1:Bild3.picture.loadfromfile(format('Kartensatz\he%d.jpg',[karte3]));
   2:Bild3.picture.loadfromfile(format('Kartensatz\pi%d.jpg',[karte3]));
   3:Bild3.picture.loadfromfile(format('Kartensatz\kr%d.jpg',[karte3]));
   4:Bild3.picture.loadfromfile(format('Kartensatz\ka%d.jpg',[karte3]));  
  end;
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Sa 22.12.07 13:34 
jetzt sehe ich klarer, (achja dein proegamm ist nur noch 177 zeilen gross)
die erstellst bei jeder der 3 tasten immer 4 Karten uns zeigst sie an.

Wie solls das spiel Genau ablaufen? wann sollen welches Tasten gedrückt werden und welche bilder sllen dann angezeigt werden?
Schritt für schritt
Einloggen, um Attachments anzusehen!
Satego Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48

Vista

BeitragVerfasst: Sa 22.12.07 13:57 
Also als erster Klickt man auf New, dann soll jeder 2karten bekommen.
Danach sollen nur mehr die Tasten Hit und Stay sichtbar sein, also Taste New ist weg.
Der Kartenwert soll immer ausgerechnet werden. Wenn Spieler auf Hit drückt bekommt er eine neue
Karte, übersteigt der neue Kartenwert 21, hat man verloren. Klickt man auf Stay ist der
Computer dran, er kauft Karten bis 17, danach werden kartenwerte verglichen und gewinner ermittelt.

_________________
motivierter Anfänger ;)