Hallo,
hab das gerade in Blitzplus (das wird wohl kaum einer kennen^^) programmiert und es läuft für ein 100x75-Feld. (Könnte auch eine exe daraus erzeugen falls erwünscht)
Grüße, BernhardCode:Graphics 400,300,16,2;Grafikauflösung SeedRnd MilliSecs();Zufallszahlen Const width=99 Const height=74 Dim bit(width,height) ;Bitfeld Dim alt(width,height) ;Backup ; ein paar Teilchen aussäen For c=0 To 500 bit(Rand(1,width-1),Rand(1,height-1))=1 Next ;Schleife Repeat Cls Color 255,255,255 ;Alle Positionen durchgehen For a=1 To width-1 For b=1 To height-1 ;in andere Matrix kopieren alt(a,b)=bit(a,b) ;Nachbarn checken anz=0 anz=anz+alt(a-1,b-1)+alt(a,b-1)+alt(a+1,b-1) anz=anz+alt(a-1,b )+ +alt(a+1,b ) anz=anz+alt(a-1,b+1)+alt(a,b+1)+alt(a+1,b+1) ;Wiedergeburt If anz=3 And bit(a,b)=0 Then bit(a,b)=1 ;Einsamkeit If anz<2 And bit(a,b)=1 Then bit(a,b)=0 ;bleibt am Leben If (anz=2 Or anz=3)And bit(a,b)=1 Then bit(a,b)=1 ;Überbevölkerung If anz>3 Then bit(a,b)=0 Next Next ;Anzeige For a=0 To width For b=0 To height If bit(a,b)=1 Then Rect 4*a,4*b,4,4 Next Next Color 255,0,0 Text 0,0,"Beenden mit ESC" ;Wartezeit Delay 100 Flip Until KeyHit(1) ;ESC End







Zitieren

Lesezeichen