Jump to content



Photo
- - - - -

2D Arrays

script coding

  • Please log in to reply
21 replies to this topic

#21 mbusetti

mbusetti

    Hobbyist

  • Members
  • PipPip
  • 36 posts
  • Location:Melbourne

  • Flag: Australia

  • Favorite Pinball: Bally Bingo

Posted 28 December 2012 - 01:27 AM

Hi

 

Good suggestion.  I was trying to avoid an array but this is simplier than the array I was thinking of

 

Thanks



#22 mbusetti

mbusetti

    Hobbyist

  • Members
  • PipPip
  • 36 posts
  • Location:Melbourne

  • Flag: Australia

  • Favorite Pinball: Bally Bingo

Posted 28 December 2012 - 07:50 AM

Discovered the problem -  I delete one of the array declarations and re-typed it.  Seems to have worked!  Very weird indeed.

 

 

 

 

Hi guys

 

I’m running the following code and if I remove either one of the arrays it works fine.  If I have both I get garbage and it throws up fathom matches.   It’s like they are running away and getting results tangled.  It’s got to be in my coding. 

 

Dim pwR3Array(12,3),  pwY3Array(12,3), Got(26), I, j, k, I, m, Match, Match1

 

pwR3Array(0,0) = 9:pwR3Array(0,1) = 4:pwR3Array(0,2) = 25

pwR3Array(1,0) = 4:pwR3Array(1,1) = 25:pwR3Array(1,2) = 14

pwR3Array(2,0) = 25:pwR3Array(2,1) = 14:pwR3Array(2,2) = 6

pwR3Array(3,0) = 10:pwR3Array(3,1) = 22:pwR3Array(3,2) = 13

.                                               .                                               .

pwR3Array(11,0) = 11:pwR3Array(11,1) = 3:pwR3Array(11,2) = 17

 

pwY3Array(0,0) = 1:pwY3Array(0,1) = 19:pwY3Array(0,2) = 24

pwY3Array(1,0) = 19:pwY3Array(1,1) = 24:pwY3Array(1,2) = 20

pwY3Array(2,0) = 24:pwY3Array(2,1) = 20:pwY3Array(2,2) = 8

pwY3Array(3,0) = 15:pwY3Array(3,1) = 23:pwY3Array(3,2) = 5

.                                               .                                               .

pwY3Array(11,0) = 12:pwY3Array(11,1) = 21:pwY3Array(11,2) = 7

 

Got(1) = True : Got(5)=True : Got(10)=True

 

k = 0

  For i = 1 to 25   

    If Got(i) = True then

      numbers(k) = i ' load numbers made in game (up to this point)

      k = k + 1

     End If

  Next

‘-------------------------------------------------------------------------------------------------------------

‘Array One

For i = 0 to 11 ' look through winner combos

        Match = 0

        For j = 0 to 2 ' look through wining number combos

          For k = 0 to 8

            if pwR3Array(i,j) = numbers(k) then match = match +1 

            If match = 3 then WinnerFound

          Next

        Next

      Next

‘-------------------------------------------------------------------------------------------------------------------

‘Array Two

For l = 0 to 11 ' look through winner combos

        Match1 = 0

        For m = 0 to 2 ' look through wining number combos

          For k = 0 to 8

            if pwY3Array(l,m) = numbers(k) then match1 = match1 +1

            If match1 = 3 then WinnerFound

          Next

        Next

      Next

‘-------------------------------------------------------------------------------------------------------------------------------

 

 

Regards - Mike


Edited by mbusetti, 28 December 2012 - 09:23 AM.






Also tagged with one or more of these keywords: script, coding