Gra w życie

Prosta gra w życie napisana na studia w C++. Przykład online to http://pmav.eu/stuff/javascript-game-of-life-v3.1.1/ gra2 Kawałek kodu
#include 

class Game{
public:
Game(){}

Game( int width , int height ){
this -> array.resize( height );

for( int iPositionHeight = 0 ; iPositionHeight < height ; iPositionHeight++ ){
                        this -> array[ iPositionHeight ].resize( width );
}

this -> classWidth = width;
this -> classHeight = height;
}

void createArray( int width , int height ){
this -> array.resize( height );

for( int iPositionHeight = 0 ; iPositionHeight < height ; iPositionHeight++ ){
                        this -> array[ iPositionHeight ].resize( width );
}

this -> classWidth = width;
this -> classHeight = height;
}

void step(){
std::vector< std::vector< bool > > tmpArray;

tmpArray.resize( this -> classHeight );

for( int iPositionHeight = 0 ; iPositionHeight < this -> classHeight ; iPositionHeight++ ){
tmpArray[ iPositionHeight ].resize( this -> classWidth );
}
Gra2z.zip Download

Dodaj komentarz

Witryna wykorzystuje Akismet, aby ograniczyć spam. Dowiedz się więcej jak przetwarzane są dane komentarzy.