1 / 5

V11

V11. Auflösen der Formen Abräumen der Reihen. Erweiterung der Klasse ultris. class ultris { private: … void aufloesen() void aufruecken() public: … }.  10 . Wenn eine Form den Boden erreicht, wird sie auf die Spielfeldmatrix projeziert

bonner
Télécharger la présentation

V11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. V11 Auflösen der Formen Abräumen der Reihen

  2. Erweiterung der Klasse ultris class ultris { private: … void aufloesen() void aufruecken() public: … }

  3.  10  • Wenn eine Form den Boden erreicht, wird sie auf die Spielfeldmatrix projeziert • Jede Form wird in ihre Einzelbausteine „aufgelöst“ (void ultris::aufloesen()) • Die Spielfeldmatrix merkt sich, an welchen Stellen sich Bausteine befinden • Insbesondere stellt die Spielfeldmatrix fest, ob eine Reihe vollständig ist • Vollständige Reihen werden „abgeräumt“ und die Reihen darüber „aufgerückt“ (void ultris::aufruecken()) Spielfeld  20 

  4. void ultris::aufloesen() { int zz, ss; // Position in der Matrix des Spielfelds for ( int z = 0; z < aktuelle_form()->h; z++ ) // Form wird „steinweise“ durchwandert { zz = zeile + z; // Position des nten Steins in der Matrix wird bestimmt (Zeile) for ( int s = 0; s < aktuelle_form()->b; s++ ) { ss = spalte + s; // die Position des nten Steins wird bestimmt (Spalte) if ( aktuelle->form()->data[z][s] ) { spielfeld[zz][ss] = 1; // Wenn Stein  Position im Spielfeld wird markiert fuellstand[zz]++; // und der Füllstandzähler der Reihe wird erhöht } }

  5. void ultris::aufruecken() { for ( int z = 19, int a = 0; z >= 0; ) { if ( fuellstand[z] == 10 ) { for ( zz = z -1; zz >= 0; zz-- ) { for ( s= 0; s < 10; s++ ) { spielfeld[zz+1][s] = spielfeld[zz][s]; fuellstand[zz+1] = fuellstand[zz]; } } } else zz--; } }

More Related