Fyrd Argentus Posted January 28, 2011 Report Posted January 28, 2011 I'm envisioning something akin to a multi-player game of chess at a clickie. I need a reality check on data structures possible within MD before I embark on this big project, and teaching myself the coding details. Am I correct that we are allowed ONE and only one variable to be universally stored and accessible through a clickie regardless of which player accesses it(using store and retrieve functions)? But that one variable can be an array? In the punch-card days, an Array was a numbered list of finite pre-defined length. In MD script it is of variable length, theoretically unlimited, the index number the computer might use is hidden, and an entry is 2-part consisting of "tag" and "data". Tag is text, data is anything. Correct? A variable not previously filled is "null" not zero? Is there a practical limit to the size of the array we can store? When does it start impacting server cost or whatever? Quote
Maebius Posted January 28, 2011 Report Posted January 28, 2011 (pre-note: I do NOT know MD script but am intrigued that it exists!) I've made a simple "checkers" type game for one of my programming courses, using a single variable. The challenge was to use a text string, or numeric value to hold the entire array, and for checkers, since it was only one type of "game token" I could use bit-shifting to handle if the space was occupied or not. I never got that working since it requires two types of value (red/black tokens) but did use a text-string to 'encode' the entuire board, with X being black, and O being red, and a - being an epty space. Thus the entire board would be "stored" as "XX--X-O-XX-X-O------O-----X-----, etc." the maths behind movement were simply shifting the single characters around in functions. Good luck with your project though! Im wondering if that sort of thing would work for Chess, using letters (capital or not?) for the various rooks, knights, pawns, etc. Hmmm..... Quote
Root Admin Chewett Posted January 28, 2011 Root Admin Report Posted January 28, 2011 [quote name='Fyrd Argentus' timestamp='1296226040' post='78143'] Am I correct that we are allowed ONE and only one variable to be universally stored and accessible through a clickie regardless of which player accesses it(using store and retrieve functions)? But that one variable can be an array? [/quote] Never heard you are only allowed to have one aoau (all object, all user) var. Iv got a tonn for several different things. It can be an array. [quote name='Fyrd Argentus' timestamp='1296226040' post='78143'] In the punch-card days, an Array was a numbered list of finite pre-defined length. In MD script it is of variable length, theoretically unlimited, the index number the computer might use is hidden, and an entry is 2-part consisting of "tag" and "data". Tag is text, data is anything. Correct? [/quote] arrays in mdscript can be undefined length, Allowing for adding in items randomly. the index doesnt really matter, all that matters is the name and what is stored example $test = array(); $test[1] = "hello world"; $test[] = "hello"; $test['testing'] = "boo!"; Are all valid (probably, not sure about middle, but im pretty sure it will give the index one higher than previous one given, aka 2) [quote name='Fyrd Argentus' timestamp='1296226040' post='78143'] A variable not previously filled is "null" not zero? [/quote] Yup [quote name='Fyrd Argentus' timestamp='1296226040' post='78143'] Is there a practical limit to the size of the array we can store? When does it start impacting server cost or whatever? [/quote] Not sure about Server Cost, But when you get a larger variables it will end up causing a memory allocation limit, and the script wont run. Happens when you are dealing with larger amounts of data Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.