Two Plus Two Poker Forums Help me please! Programming assignment!
 Register FAQ Search Today's Posts Mark Forums Read Video Directory TwoPlusTwo.com

 Notices

 08-06-2012, 01:40 PM #16 journeyman     Join Date: Apr 2011 Posts: 366 Re: Help me please! Programming assignment! @iosys: Wow... you didn't understand even one word I wrote. I don't think you even read what I wrote. I really think you just saw some text there, assumed what you think I might write, and responded to that. Literally nothing in your response had anything to do with what I said. @Tarkyo: I think you're in over your head on this project. If your instructor believes he has given all the tools to solve the problem to the point that he is completely unwilling to help you, then either 1) he's an idiot or 2) you are way behind in this class. Either way, you might want to consider dropping it.
 08-06-2012, 06:51 PM #17 bacon wannabe     Join Date: Sep 2004 Posts: 17,019 Or drop it regardless cause flash is dead.
 08-06-2012, 08:12 PM #18 _Pooh_Bah_   Join Date: Feb 2005 Location: UK Posts: 9,154 Re: Help me please! Programming assignment! Tarkyo, the 2D array is a representation of the game-state, "the board". I will try to explain. OK, so you have been taught "Arrays", and it's just the 2D that is confusing, right? An array is a single named variable, that holds multiple other variables inside it in order. These internal variables are accessed using the array notation, eg. myarray[4] returns the 5th "slot" from the array myarray (arrays start counting at zero). OK so far? So, an array can be visualised such as a rack of boxes each box may or may not hold a thing. kinda like this: Code: ```myarray = new Array(6); looks like: myarray [ ] [ ] [ ] [ ] [ ] [ ] 0 1 2 3 4 5``` An array 6 slots in size - 6 empty boxes. you might use this to store some variables, like characters, or integers. e.g. Code: ```myarray[5] = 't'; myarray[4] = 'a'; myarray[3] = 'w'; now some of the slots are filled, it looks like: myarray [ ] [ ] [ ] [w] [a] [t] 0 1 2 3 4 5``` OK, that's standard 1D array. A 2D array is just the same, no more tricky. just harder to visualize, a little. It is simply a normal array, but each slot contains another array. like this: Code: ```myarray = new Array(6); looks like: myarray [ ] [ ] [ ] [ ] [ ] [ ] 0 1 2 3 4 5 myarray[0] = new Array(6); myarray[1] = new Array(6); myarray[2] = new Array(6); myarray[3] = new Array(6); myarray[4] = new Array(6); myarray[5] = new Array(6); now each slot holds an array of length 6, looks like: [ ] [ ] [ ] [ ] [ ] [ ] 5 [ ] [ ] [ ] [ ] [ ] [ ] 4 [ ] [ ] [ ] [ ] [ ] [ ] 3 [ ] [ ] [ ] [ ] [ ] [ ] 2 [ ] [ ] [ ] [ ] [ ] [ ] 1 myarray [ ] [ ] [ ] [ ] [ ] [ ] 0 0 1 2 3 4 5``` In a 2d array, they are accessed just the same, but you need to stick another array notation on the end since you are "going two arrays deep" to get at the variable. e.g. myarray[0][5] would get you the top-left corner, myarray[3][0] would get you near the middle on the bottom row, and so on. OK, see how this might now provide suitable tool to represent the state of a connect-4 board? Hope so
 08-08-2012, 04:33 PM #19 Pooh-Bah     Join Date: Dec 2003 Location: US Posts: 3,623 Re: Help me please! Programming assignment! A 1D array is a vector. A 2D array is a matrix. Think of it as Cartesian coordinates using only positive whole numbers.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are Off Refbacks are Off Forum Rules

All times are GMT -4. The time now is 03:13 PM.

 Contact Us - Two Plus Two Publishing LLC - Privacy Statement - Top