FMS Posted December 22, 2017 Posted December 22, 2017 (edited) Hello, Maybe a simple question, but i got some strange results whit this code. i din't expected a empty $gridlist[$i * $x] when I _ArrayDisplay($gridlist) Or is mine code strangley written where I'm not aware of??? thnx, FMS Global $grid[10][10] Global $gridlist[ubound($grid,1) * ubound($grid,2)] For $i = 0 to ubound($grid,1) - 1 For $x = 0 to ubound($grid,2) - 1 If Random(-1 , 1) >= 0 Then $gridlist[$i * $x] = 0 Else $gridlist[$i * $x] = 1 EndIf If @error Then $gridlist[$i * $x] = 2 EndIf Next Next _ArrayDisplay($gridlist) Edited December 22, 2017 by FMS as finishing touch god created the dutch
kylomas Posted December 22, 2017 Posted December 22, 2017 (edited) ..snip.. Edited December 22, 2017 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
FMS Posted December 22, 2017 Author Posted December 22, 2017 15 minutes ago, kylomas said: FMS, 0*any number = 0... Kylomas thnx...... as finishing touch god created the dutch
kylomas Posted December 23, 2017 Posted December 23, 2017 I snipped it cause this would not account for "blank" cells, just 0 filled cells... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
jchd Posted December 23, 2017 Posted December 23, 2017 But yes, that's the problem. Empty cells were never assigned a numeric values, just emtpy string as default value. Global $grid[10][10] Global $gridlist[ubound($grid,1) * ubound($grid,2)] For $i = 0 to ubound($grid,1) - 1 For $x = 0 to ubound($grid,2) - 1 If Random(-1 , 1) >= 0 Then $gridlist[$i * 10 + $x] = 0 Else $gridlist[$i * 10 + $x] = 1 EndIf If @error Then $gridlist[$i * 10 + $x] = 2 EndIf Next Next _ArrayDisplay($gridlist) This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now