3-dimensionale dim-felder?!

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

 

Philon

Betreff: 3-dimensionale dim-felder?!

BeitragMo, Apr 13, 2009 16:17
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi leute!

wollt fragen wie ich das machen kann damit das geht!
also es soll ein feld einlesen mit 17*17*9 Nullen! ja echt nur nullen.

Dim change(mapx,mapy,depth) ;mapx=17, mapy=17, depth=9
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.......und so weiter....

For depth=0 To 9
For y=0 To mapy
For x=0 To mapx
Read change(x,y,0)
Next
Next
Next

Eingeproggt

BeitragMo, Apr 13, 2009 16:26
Antworten mit Zitat
Benutzer-Profile anzeigen
Du bist der Lösung schon sehr nahe denk ich Smile

Code: [AUSKLAPPEN]
For depth=0 To 8
  For y=0 To mapy-1
    For x=0 To mapx-1
      Read change(x,y,depth)
    Next
  Next
Next


Gehts so vielleicht?
Der Trick ist wie du siehst, dass von 0 weg gezählt wird, also 0 bis 8 entspricht 9 Werten Wink

EDIT: Sollte "Out of Data" kommen musst du dein Data-Feld nochmal kontrollieren, ob es wirklich 17*17*9=2601 Werte beinhaltet.
Gewinner des BCC 18, 33 und 65 sowie MiniBCC 9
  • Zuletzt bearbeitet von Eingeproggt am Mo, Apr 13, 2009 16:28, insgesamt einmal bearbeitet

Xeres

Moderator

BeitragMo, Apr 13, 2009 16:27
Antworten mit Zitat
Benutzer-Profile anzeigen
Nur nullen muss man nicht einlesen - alle Felder sind 0 bis du sie änderst.
und ansonsten:
Code: [AUSKLAPPEN]
For depth=0 To 9
For y=0 To mapy
For x=0 To mapx
Read change(x,y,depth)
Next
Next
Next
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus
T
HERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld)
 

Philon

BeitragMo, Apr 13, 2009 16:35
Antworten mit Zitat
Benutzer-Profile anzeigen
ja aber bei

Read change(x,y,depth)

zählt doch depth auch immer eins hoch oder?
sollen doch alles nullen werden.

PS wie macht man diese code-kästchen??

Eingeproggt

BeitragMo, Apr 13, 2009 16:39
Antworten mit Zitat
Benutzer-Profile anzeigen
depth ist deine dritte Dimension und in der willst du ja auch Nullen haben?
Wenn du immer Read change(x,y,0) schreibst, wird change(x,y,1), change(x,y,2) usw gar nicht bearbeitet.

Und die Code-Tags machst du mit dem Button übern Eingabefeld "Code" (Code markieren und dann drauf klicken)
Gewinner des BCC 18, 33 und 65 sowie MiniBCC 9

Xeres

Moderator

BeitragMo, Apr 13, 2009 16:41
Antworten mit Zitat
Benutzer-Profile anzeigen
Der Inhalt des Felds ist was anderes als die Koordinaten... x, y und depth geben eine Position an die mit Read dann auf einen Wert gestellt wird - also 0.


Benutz den [ code ] Button unter den Smileys Wink
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus
T
HERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld)

Tankbuster

BeitragMo, Apr 13, 2009 16:45
Antworten mit Zitat
Benutzer-Profile anzeigen
Warum nicht:

Code: [AUSKLAPPEN]
For depth=0 To 9
For y=0 To mapy
For x=0 To mapx
change(x,y,depth)=0
Next
Next
Next


Oder hab ich den eingangspost jetzt iwi falsch verstanden? o.0
Twitter
Download Jewel Snake!
Windows|Android
 

Philon

BeitragMo, Apr 13, 2009 16:50
Antworten mit Zitat
Benutzer-Profile anzeigen
oh okok
habs jetzt
aaber leider funktioniert noch nicht.

ich kriege immer noch das "out of data" teil, was auch immer das heissen soll...

ich habe nur dieses dim-feld rauskopiert und alleine gestartet, und das hat geklappt!
und mein programm funkt nich..

ok habe ALLES rausgeschnitten, wo irgendwo "change" vorkam. (ausser dem dim natürlich)
aber es funktioniert immer noch nicht??!?

was soll ich machen?

Nicdel

BeitragMo, Apr 13, 2009 16:52
Antworten mit Zitat
Benutzer-Profile anzeigen
Uns mehr Code geben? Oder sollen wir alles erraten?
Desktop: Intel Pentium 4 2650 Mhz, 2 GB RAM, ATI Radeon HD 3850 512 MB, Windows XP
Notebook: Intel Core i7 720 QM 1.6 Ghz, 4 GB DDR3 RAM, nVidia 230M GT, Windows 7
 

Philon

BeitragMo, Apr 13, 2009 16:54
Antworten mit Zitat
Benutzer-Profile anzeigen
ok soll ich alles reintun?!
ok.. ich hoffe ich darf das und ihr schauts euch mal an!

Code: [AUSKLAPPEN]
Graphics 800, 600, 16, 2
SetBuffer BackBuffer()




;--------------------------------------------------------------------Variables--------
Global pnum=3

Global mapx=17
Global mapy=17



red=   LoadImage("bilder/rot.bmp")
purple=LoadImage("bilder/lila.bmp")
blue=  LoadImage("bilder/blau.bmp")
green= LoadImage("bilder/grün.bmp")
star=  LoadImage("bilder/stern.bmp")
MaskImage star,0,0,0


terrain = LoadAnimImage("bilder/tileset.bmp",32,32,0,4)
;1=Jungle
;2=Savanna
;3=Temperate
;4=Desert



;---------------------------------------------------------------------Genes--------
pnum=3
Dim footKneeHip(pnum), coordination(pnum), longerGestation(pnum), motherChild(pnum)
Dim redSexDifferences(pnum), pairBonding(pnum), paternalProvisioning(pnum), incestAversion(pnum)
Dim larynxTongue(pnum), broccasArea(pnum), vocabulary(pnum), brainSize(pnum), diet(pnum)
Dim nerveSpeed(pnum), brainOrganization(pnum), gIntelligence(pnum), familySystem(pnum), speech(pnum)
Dim empathy(pnum), moralEmotions(pnum), reciprocity(pnum), statusSeeking(pnum), reputation(pnum)
Dim strideWalking(pnum), maleBonding(pnum), dexterity(pnum), inventions(pnum), teachingLearning(pnum)
Dim ruleObedience(pnum), freeRiderDetection(pnum), nepotism(pnum), socialCompetence(pnum)
Dim indoctrinability(pnum), tribalRituals(pnum), ancestorBeliefs(pnum), incestTaboos(pnum)
Dim bandPatriotism(pnum), similarityAttraction(pnum), socialGrooming(pnum), longDistanceHunting(pnum)
Dim technologyLevel(pnum), tribalPatriotism(pnum), combatStrength(pnum), group4(pnum)

For pnum=0 To 3
   footkneehip(pnum)=0
   coordination(pnum)=0
   longerGestation(pnum)=0
   motherChild(pnum)=0
   redSexDifferences(pnum)=0
   pairBonding(pnum)=0
   paternalProvisioning(pnum)=0
   incestAversion(pnum)=0
   larynxTongue(pnum)=0
   broccasArea(pnum)=0
   vocabulary(pnum)=0
   brainSize(pnum)=0
   diet(pnum)=0
   group4(pnum)=0
   nerveSpeed(pnum)=0
   brainOrganization(pnum)=0
   gIntelligence(pnum)=0
   familySystem(pnum)=0
   speech(pnum)=0
   empathy(pnum)=0
   moralEmotions(pnum)=0
   reciprocity(pnum)=0
   statusSeeking(pnum)=0
   reputation(pnum)=0
   strideWalking(pnum)=0
   maleBonding(pnum)=0
   dexterity(pnum)=0
   inventions(pnum)=0
   teachingLearning(pnum)=0
   ruleObedience(pnum)=0
   freeRiderDetection(pnum)=0
   nepotism(pnum)=0
   socialCompetence(pnum)=0
   indoctrinability(pnum)=0
   tribalRituals(pnum)=0
   ancestorBeliefs(pnum)=0
   incestTaboos(pnum)=0
   bandPatriotism(pnum)=0
   similarityAttraction(pnum)=0
   socialGrooming(pnum)=0
   longDistanceHunting(pnum)=0
   technologyLevel(pnum)=0
   tribalPatriotism(pnum)=0
   combatStrength(pnum)=0
Next




;------------------------------------------------------------------Dims--------
Dim map(mapx, mapy)
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Data 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
Data 1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1
Data 1,1,1,1,2,2,2,2,2,2,2,2,2,2,1,1,1,1
Data 1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1
Data 1,1,2,2,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0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

For depth=0 To 9
   For y=0 To mapy
      For x=0 To mapx
         Read change(x,y,depth)
      Next
   Next
Next


pnum=3
Dim genelvl(pnum)
genelvl(0)=0
genelvl(1)=0
genelvl(2)=0
genelvl(3)=0

pnum=3
Dim psquares(pnum)
psquares(0)=3
psquares(1)=3
psquares(2)=3
psquares(3)=3
;--------------------------------------------------------------------Loop-----------

While Not KeyHit(1)
   If KeyDown(28) Or KeyHit(57) NextMove()

   For y=0 To mapy
      For x=0 To mapx
         If territory(x,y)>-10 And territory(x,y)<0 DrawImage terrain, x*33, y*33, map(x, y)-1
         If territory(x,y)=0  DrawImage red,     x*33, y*33
         If territory(x,y)=1  DrawImage green,   x*33, y*33
         If territory(x,y)=2  DrawImage purple,  x*33, y*33
         If territory(x,y)=3  DrawImage blue,    x*33, y*33
         
         If muts(x,y)=1 Then
            DrawImage star, x*33    ,y*33
         EndIf
         
         If muts(x,y)=2 Then
            DrawImage star, x*33    ,y*33
            DrawImage star, x*33    ,y*33+10
         EndIf
         
         If muts(x,y)=3 Then
            DrawImage star, x*33    ,y*33
            DrawImage star, x*33    ,y*33+10
            DrawImage star, x*33+10, y*33
         EndIf
         
         
         If muts(x,y)>4 Then muts(x,y)=4
         If muts(x,y)=4 Then
            DrawImage star, x*33    ,y*33
            DrawImage star, x*33    ,y*33+10
            DrawImage star, x*33+10, y*33
            DrawImage star, x*33+10, y*33+10
         EndIf
         
         
         
      Next
   Next

   Flip
   Cls
   
   Text 600,  0, psquares(0)
   Text 600, 20, psquares(1)
   Text 600, 40, psquares(2)
   Text 600, 60, psquares(3)
Wend
End



;-------------------------------------------------------------------Functions-------
Function NextMove()

   updateterrainnew()
   updatemutations()
   updategenes()
   
End Function

;---------------------------
Function mutation(xPos,yPos)
   
   muts(xPos,yPos)=muts(xPos,yPos)+1
   
End Function
;---------------------------
Function updateMutations()
   ;mutations spread
   For pnum=0 To 3
      For x=1 To mapx-1
         For y=1 To mapy-1
            change(x,y,0)=0
            mut=muts(x,y)
            If territory(x,y)=pnum Then
               If territory(x-1,y-1)=pnum And muts(x-1,y-1)>mut change(x,y,0)=1
               If territory(x  ,y-1)=pnum And muts(x  ,y-1)>mut change(x,y,0)=1
               If territory(x-1,y  )=pnum And muts(x-1,y  )>mut change(x,y,0)=1
               If territory(x+1,y  )=pnum And muts(x+1,y  )>mut change(x,y,0)=1
               If territory(x+1,y-1)=pnum And muts(x+1,y-1)>mut change(x,y,0)=1
               If territory(x-1,y+1)=pnum And muts(x-1,y+1)>mut change(x,y,0)=1
               If territory(x+1,y+1)=pnum And muts(x+1,y+1)>mut change(x,y,0)=1
               If territory(x  ,y+1)=pnum And muts(x  ,y+1)>mut change(x,y,0)=1
            EndIf
         Next
      Next

      For x=1 To mapx-1
         For y=1 To mapy-1
            If change(x,y,0)=1 Then
               muts(x,y)=muts(x,y)+1
            EndIf
         Next
      Next
   Next
   
                  
   ;mutations occur
   SeedRnd MilliSecs()
   
   For y=1 To mapy-1
      For x=1 To mapx-1
         mut=Rand(0,200)
         If mut=1 And territory(x,y)>-1 mutation(x,y)   
      Next
   Next
   
   
   ;if  all squares of a player have a mutation, all mutations -1
   h=0
   pnum=0
   For pnum=0 To 3
      For x=1 To mapx-1
         For y=1 To mapy-1
            If territory(x,y)=pnum Then
               If Not muts(x,y)>0 Then h=1
            EndIf   
         Next
      Next
   
         
      If h=0 Then
         For x=1 To mapx-1
            For y=1 To mapy-1
               If territory(x,y)=pnum Then
                  muts(x,y)=muts(x,y)-1
               EndIf
            Next
         Next
         stridewalking(pnum)=1
      EndIf
      h=0
   Next
   
End Function

;---------------------------
Function updateTerrain()
   x=0
   y=0
   
   For y=1 To mapy-1
      For x=1 To mapx-1
         If territory(x, y)<0
            territory(x,y)=-1
            If territory(x-1,y-1)>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x  ,y-1)>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x+1,y-1)>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x-1,y  )>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x+1,y  )>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x-1,y+1)>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x  ,y+1)>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
            If territory(x+1,y+1)>-1 territory(x,y)=-1   Else territory(x,y)= territory(x,y)-1
         EndIf
         
      Next
   Next
   
   psquares(0)=0
   psquares(1)=0
   psquares(2)=0
   psquares(3)=0
   
   For y=1 To mapy-1
      For x=1 To mapx-1
         If territory(x,y)>-9 And territory(x,y)<0 Then
         
            If territory(x-1,y-1)>-1 Then
            
               If map(x,y)=1 territory(x,y)= territory(x-1,y-1)
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x-1,y-1))=1 territory(x,y)= territory(x-1,y-1)
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x-1,y-1))=1 Then
                     If gintelligence(territory(x-1,y-1)) territory(x,y)= territory(x-1,y-1)
                  EndIf
               EndIf
               
            EndIf
            
            ;---------
               
            If territory(x  ,y-1)>-1  Then
               If map(x,y)=1 territory(x,y)= territory(x  ,y-1)
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x  ,y-1))=1 territory(x,y)= territory(x  ,y-1)
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x  ,y-1))=1 Then
                     If gintelligence(territory(x  ,y-1)) territory(x,y)= territory(x  ,y-1)
                  EndIf
               EndIf
               
            EndIf
            
            ;---------
            

            If territory(x+1,y-1)>-1  Then
            
               If map(x,y)=1 territory(x,y)= territory(x+1,y-1)
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x+1,y-1))=1 territory(x,y)= territory(x+1,y-1)
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x+1,y-1))=1 Then
                     If gintelligence(territory(x+1,y-1)) territory(x,y)= territory(x+1,y-1)
                  EndIf
               EndIf
               
            EndIf
            
            ;---------
            
            If territory(x-1,y  )>-1    Then
            
               If map(x,y)=1 territory(x,y)= territory(x-1,y  )
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x-1,y  ))=1 territory(x,y)= territory(x-1,y  )
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x-1,y  ))=1 Then
                     If gintelligence(territory(x-1,y  )) territory(x,y)= territory(x-1,y  )
                  EndIf
               EndIf
               
            EndIf
            
            ;---------

            If territory(x+1,y  )>-1  Then
            
               If map(x,y)=1 territory(x,y)= territory(x+1,y  )
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x+1,y  ))=1 territory(x,y)= territory(x+1,y  )
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x-1,y  ))=1 Then
                     If gintelligence(territory(x+1,y  )) territory(x,y)= territory(x+1,y  )
                  EndIf
               EndIf
               
            EndIf
            
            ;---------
            
            If territory(x-1,y+1)>-1  Then
            
               If map(x,y)=1 territory(x,y)= territory(x-1,y+1)
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x-1,y+1))=1 territory(x,y)= territory(x-1,y+1)
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x-1,y+1))=1 Then
                     If gintelligence(territory(x-1,y+1)) territory(x,y)= territory(x-1,y+1)
                  EndIf
               EndIf
               
            EndIf
            
            ;---------

            If territory(x  ,y+1)>-1  Then
            
               If map(x,y)=1 territory(x,y)= territory(x  ,y+1)
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x-1,y+1))=1 territory(x,y)= territory(x  ,y+1)
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x  ,y+1))=1 Then
                     If gintelligence(territory(x  ,y+1)) territory(x,y)= territory(x  ,y+1)
                  EndIf
               EndIf
               
            EndIf
            
            ;---------

            If territory(x+1,y+1)>-1 Then
            
               If map(x,y)=1 territory(x,y)= territory(x+1,y+1)
               
               If map(x,y)=2 Then
                  If stridewalking(territory(x+1,y+1))=1 territory(x,y)= territory(x+1,y+1)
               EndIf
   
               If map(x,y)>=3 Then
                  If stridewalking(territory(x+1,y+1))=1 Then
                     If gintelligence(territory(x+1,y+1)) territory(x,y)= territory(x+1,y+1)
                  EndIf
               EndIf
               
            EndIf
            
            ;---------

         EndIf
         If territory(x,y)>-1 Then
            If territory(x,y)=0 psquares(0)=psquares(0)+1
             If territory(x,y)=1 psquares(1)=psquares(1)+1
            If territory(x,y)=2 psquares(2)=psquares(2)+1
            If territory(x,y)=3 psquares(3)=psquares(3)+1
         EndIf

      Next
   Next


End Function
;---------------------------
Function updateTerrainNew()
   x=0
   y=0
   
   For depth=0 To 9
      For y=1 To mapy-1
         For x=1 To mapx-1
         change(x,y,depth)=0
         Next
      Next
   Next
   
   
   For y=1 To mapy-1
      For x=1 To mapx-1
         If territory(x,y)>-1
            change(x,y,9)=0
            If territory(x-1,y-1)>-1 change(x,y,0)=1
            If territory(x  ,y-1)>-1 change(x,y,1)=1
            If territory(x+1,y-1)>-1 change(x,y,2)=1
            If territory(x-1,y  )>-1 change(x,y,3)=1
            If territory(x+1,y  )>-1 change(x,y,4)=1 
            If territory(x-1,y+1)>-1 change(x,y,5)=1
            If territory(x  ,y+1)>-1 change(x,y,6)=1
            If territory(x+1,y+1)>-1 change(x,y,7)=1
         EndIf
      Next
   Next
   
   psquares(0)=0
   psquares(1)=0
   psquares(2)=0
   psquares(3)=0
   
   For y=1 To mapy-1
      For x=1 To mapx-1
      
         If change(x,y,0)+change(x,y,1)+change(x,y,2)+change(x,y,3)+change(x,y,4)+change(x,y,5)+change(x,y,6)+change(x,y,7)=1 Then
            fgh=1
         EndIf
            
      
      
      Next
   Next
   
   
   
End Function
;---------------------


Function updateGenes()
   ;GROUP 1
   For pnum=0 To 3
      If footKneeHip(pnum)+coordination(pnum)=2 stridewalking(pnum)=1   
   Next
   
   ;GROUP 2
   For pnum=0 To 3
      If longerGestation(pnum)>0 Then
         If motherChild(pnum)>0 Then
            If redsexDifferences(pnum)>0 Then
               If pairBonding(pnum)>0 Then
                  If paternalProvisioning(pnum)>0 Then
                     If incestAversion(pnum)>0 Then
                        familySystem(pnum)=1
                        If longerGestation(pnum)>1 Then
                           If motherChild(pnum)>1 Then
                              If paternalProvisioning(pnum)>1 Then
                                 familySystem(pnum)=2
                                 If motherChild(pnum)>2
                                    If paternalProvisioning(pnum)>2
                                       familySystem(pnum)=3
                                    EndIf
                                 EndIf
                              EndIf
                           EndIf
                        EndIf                     
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf

   
   ;GROUP 3

      If larynxTongue(pnum)>0 Then
         If broccasArea(pnum)>0 Then
            If vocabulary(pnum)>0 Then
               speech(pnum)=1
               If larynxTongue(pnum)>1 Then
                  If broccasArea(pnum)>1 Then
                     If vocabulary(pnum)>1 Then
                        speech(pnum)=2
                        If vocabulary(pnum)>2 Then
                           speech(pnum)=3
                        EndIf
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf

   
   ;GROUP 4

      If strideWalking(pnum)>0 Then
         If maleBonding(pnum)>0 Then
            diet(pnum)=1
            longDistanceHunting(pnum)=1
            If maleBonding(pnum)>1 Then
               diet(pnum)=2
               longDistanceHunting(pnum)=2
               If maleBonding(pnum)>2 Then
                  diet(pnum)=3
                  longDistanceHunting(pnum)=3
               EndIf
            EndIf
         EndIf
      EndIf

   
   
   ;GROUP 5

      If brainSize(pnum)>0 Then
         If diet(pnum)>0 Then
            group4(pnum)=1
            If brainSize(pnum)>1 Then
               If diet(pnum)>1 Then
                  group4(pnum)=2
                  If brainSize(pnum)>2 Then
                     If diet(pnum)>2 Then
                        group4(pnum)=3
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf

   
   ;GROUP 6

      If group4(pnum)>0 Then
         If nerveSpeed(pnum)>0 Then
            If brainOrganization(pnum)>0 Then
               gIntelligence(pnum)=1
               If group4(pnum)>1 Then
                  If nerveSpeed(pnum)>1 Then
                     If brainOrganization(pnum)>1 Then
                        gIntelligence(pnum)=2
                        If group4(pnum)>2 Then
                           If nerveSpeed(pnum)>2 Then
                              If brainOrganization(pnum)>2 Then
                                 gIntelligence(pnum)=3
                              EndIf
                           EndIf
                        EndIf         
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf

   
   ;GROUP 7   

      If gIntelligence(pnum)>0 Then
         If familySystem(pnum)>0 Then
            If speech(pnum)>0 Then
               teachingLearning(pnum)=1
               If gIntelligence(pnum)>1 Then
                  If familySystem(pnum)>1 Then
                     If speech(pnum)>1 Then
                        teachingLearning(pnum)=2
                        If gIntelligence(pnum)>2 Then
                           If familySystem(pnum)>2 Then
                              If speech(pnum)>2 Then
                                 teachingLearning(pnum)=3
                                 If gIntelligence(pnum)>3 Then
                                    teachingLearning(pnum)=4
                                    If gIntelligence(pnum)>4 Then
                                       teachingLearning(pnum)=5
                                       If gIntelligence(pnum)>5 Then
                                          teachingLearning(pnum)=6
                                       EndIf
                                    EndIf
                                 EndIf         
                              EndIf
                           EndIf
                        EndIf
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf         
                     


   ;GROUP 8

      If familySystem(pnum)>0 Then
         If speech(pnum)>0 Then
            If empathy(pnum)>0 Then
               If moralEmotions(pnum)>0 Then
                  If reciprocity(pnum)>0 Then
                     If statusSeeking(pnum)>0 Then
                        If reputation(pnum)>0 Then
                           socialCompetence(pnum)=1
                           If familySystem(pnum)>1 Then
                              If speech(pnum)>1 Then
                                 If empathy(pnum)>1 Then
                                    If moralEmotions(pnum)>1 Then
                                       If reciprocity(pnum)>1 Then
                                          socialCompetence(pnum)=2
                                          If familySystem(pnum)>2 Then
                                             If speech(pnum)>2 Then
                                                If reciprocity(pnum)>2 Then                                                
                                                   socialCompetence(pnum)=3
                                                EndIf
                                             EndIf      
                                          EndIf         
                                       EndIf
                                    EndIf
                                 EndIf         
                              EndIf
                           EndIf
                        EndIf
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf                                                   

   

      
   ;GROUP 9

      If dexterity(pnum)>0 Then
         If inventions(pnum)>0 Then
            If teachingLearning(pnum)>0 Then
               technologyLevel(pnum)=1
               If inventions(pnum)>1 Then
                  If teachingLearning(pnum)>1 Then
                     technologyLevel(pnum)=2
                     If inventions(pnum)>2 Then
                        If teachingLearning(pnum)>2 Then
                           technologyLevel(pnum)=3
                           If inventions(pnum)>3 Then
                              If teachingLearning(pnum)>3 Then
                                 technologyLevel(pnum)=4
                                 If inventions(pnum)>4 Then
                                    If teachingLearning(pnum)>4 Then
                                       technologyLevel(pnum)=5
                                       If inventions(pnum)>5 Then
                                          If teachingLearning(pnum)>5 Then
                                             technologyLevel(pnum)=6
                                             If inventions(pnum)>6 Then
                                                technologyLevel(pnum)=7
                                             EndIf               
                                          EndIf         
                                       EndIf
                                    EndIf
                                 EndIf         
                              EndIf
                           EndIf
                        EndIf
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf                                                   

   
   ;GROUP 10

      If ruleObedience(pnum)>0 Then
         If freeRiderDetection(pnum)>0 Then   
            If nepotism(pnum)>0 Then
               If socialCompetence(pnum)>0 Then
                  bandPatriotism(pnum)=1
                  If ruleObedience(pnum)>1 Then
                     If freeRiderDetection(pnum)>1 Then   
                        If nepotism(pnum)>1 Then
                           If socialCompetence(pnum)>1 Then
                              bandPatriotism(pnum)=2
                              If ruleObedience(pnum)>2 Then
                                 If freeRiderDetection(pnum)>2 Then   
                                    If socialCompetence(pnum)>2 Then
                                       bandPatriotism(pnum)=3
                                    EndIf
                                 EndIf
                              EndIf
                           EndIf
                        EndIf
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf   

   
   
   ;GROUP 11
   
      If indoctrinability(pnum)>0 Then
         If tribalRituals(pnum)>0 Then
            If ancestorBeliefs(pnum)>0 Then
               If incestTaboos(pnum)>0 Then
                  If bandPatriotism(pnum)>0 Then
                     If similarityAttraction(pnum)>0 Then
                        If socialGrooming(pnum)>0 Then
                           tribalPatriotism(pnum)=1   
                           If indoctrinability(pnum)>1 Then
                              If tribalRituals(pnum)>1 Then
                                 If ancestorBeliefs(pnum)>1 Then
                                    If bandPatriotism(pnum)>1 Then
                                       If socialGrooming(pnum)>1 Then
                                          tribalPatriotism(pnum)=2   
                                          If indoctrinability(pnum)>2 Then
                                             If tribalRituals(pnum)>2 Then
                                                If ancestorBeliefs(pnum)>2 Then
                                                   If bandPatriotism(pnum)>2 Then
                                                      tribalPatriotism(pnum)=3
                                                      If tribalRituals(pnum)>3 Then                                             
                                                         tribalPatriotism(pnum)=4                                       
                                                         If tribalRituals(pnum)>4 Then                                             
                                                            tribalPatriotism(pnum)=5   
                                                         EndIf
                                                      EndIf
                                                   EndIf      
                                                EndIf
                                             EndIf      
                                          EndIf         
                                       EndIf
                                    EndIf
                                 EndIf         
                              EndIf
                           EndIf
                        EndIf
                     EndIf
                  EndIf
               EndIf
            EndIf
         EndIf
      EndIf                                                   



   ;GROUP 12
   
      combatstrength(pnum)=longDistanceHunting(pnum)+technologylevel(pnum)+tribalPatriotism(pnum)
   Next


      
End Function

Xeres

Moderator

BeitragMo, Apr 13, 2009 16:54
Antworten mit Zitat
Benutzer-Profile anzeigen
"out of data" bedeutet, das du nicht genug Werte per Data definiert hast. Read versucht also auf einen Wert zuzugreifen der nicht existiert.

Edit:
Du brauchst 10 mal ein x mal y großes Data-Feld wenn du alles in dein 3D Array füllen möchtest. Oder du verwendest restore wenn du die tiefe veränderst.
Oder - wenn da alle Werte immer 0 sein sollen - lässt du den ganzen Data Spaß ganz.
  • Zuletzt bearbeitet von Xeres am Mo, Apr 13, 2009 16:59, insgesamt einmal bearbeitet
 

matze-t

BeitragMo, Apr 13, 2009 16:55
Antworten mit Zitat
Benutzer-Profile anzeigen
Also "Out of Data" heißt, dass du zu wenig Werte mit Data angegeben hast.
So wie ich das sehe hast du nur 18*18 = 324 Nullen angegeben, du brauchst aber 18 * 18 * 9.
 

Philon

BeitragMo, Apr 13, 2009 17:35
Antworten mit Zitat
Benutzer-Profile anzeigen
boa viielen dank!!!

habe mit dem restore-befehl das problem gelöst:

Code: [AUSKLAPPEN]
Dim change(mapx,mapy,depth)
.change
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

For depth=0 To 9
   For y=0 To mapy
      For x=0 To mapx
         Read change(x,y,depth)
      Next
   Next
   Restore change
Next
 

tobias12

BeitragMo, Apr 13, 2009 17:39
Antworten mit Zitat
Benutzer-Profile anzeigen
den restore befehl solltest du am anfang der for...next schleifen anbrigen
Mein Projekteforum

Tankbuster

BeitragMo, Apr 13, 2009 19:23
Antworten mit Zitat
Benutzer-Profile anzeigen
Tankbuster hat Folgendes geschrieben:
Warum nicht:

Code: [AUSKLAPPEN]
For depth=0 To 9
For y=0 To mapy
For x=0 To mapx
change(x,y,depth)=0
Next
Next
Next


Oder hab ich den eingangspost jetzt iwi falsch verstanden? o.0
Twitter
Download Jewel Snake!
Windows|Android

Eingeproggt

BeitragMo, Apr 13, 2009 19:25
Antworten mit Zitat
Benutzer-Profile anzeigen
Matze-T hat Folgendes geschrieben:
So wie ich das sehe hast du nur 18*18 = 324 Nullen angegeben, du brauchst aber 18 * 18 * 9.
Gewinner des BCC 18, 33 und 65 sowie MiniBCC 9

Timderheld

BeitragSo, Jun 14, 2009 15:48
Antworten mit Zitat
Benutzer-Profile anzeigen
hi ich hab dazu auch ma ne frage wie kann man den 3dimensionale dim felder erstellen, also das man ein teil der ersten schicht transparent macht und die darunterliegende zum vorschein kommt
 

da_poller

BeitragSo, Jun 14, 2009 17:00
Antworten mit Zitat
Benutzer-Profile anzeigen
du hast einige arrays die IMMER 0 sind beim befüllen..

warum willst du die mit 0 befüllen? beim erstellen eines aray(Dim) sind die werte IMMER 0 Exclamation

The_Nici

BeitragSo, Jun 14, 2009 19:01
Antworten mit Zitat
Benutzer-Profile anzeigen
Timderheld hat Folgendes geschrieben:
hi ich hab dazu auch ma ne frage wie kann man den 3dimensionale dim felder erstellen, also das man ein teil der ersten schicht transparent macht und die darunterliegende zum vorschein kommt

Dim
MaskImage
DrawImage

MfG

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group