Hi Thomas, Yes, after I've looked at a few sources it does start to look a lot like algebra. One more question--why did you use doc string and replace your # comment lines?
Best Regards, Hayden -----Original Message----- From: gamers-boun...@audyssey.org [mailto:gamers-boun...@audyssey.org] On Behalf Of Thomas Ward Sent: Saturday, November 27, 2010 4:48 PM To: Gamers Discussion list Subject: Re: [Audyssey] USA Blackjack 1.0 Released! Hi Hayden, Ah, I see. Well, as a matter of fact arrays are very useful. In fact, I'd go as far as to say a programmer that doesn't understand and can't use arrays can't program anything very productive as software such as games depend heavily on the use of arrays to keep track of large amounts of data. They are, perhaps, one of the most importantconcepts to master in computer programming. Here is a few practical examples of using arrays in games. In Mysteries of the Ancients did you ever wonder how the game keeps track of if Angela is walking/running on stone, dirt, ledges, chasms, etc? It is very simple really. The entire game level is loaded into a large array, and every time Angela takes a step the WalkLeft() and WalkRight() function checks the array to see if the next step is a chasm, lava pit, fire pit, or if the surface has changed from stone floor to a crumbling ledge, etc. If the array has a wall there the player stops moving and can't move forward. There are other ways to do collision detection mathematically, but an array is the most basic and most practical way to keep track of a large map like that. Many board games like Ches also use arrays. To create a Chess board you would define an 8 by 8 2d array and then populate the board with the game pieces. Instead of checking a game pieces location with every other piece on the board manually you can just check the array if there is something in your way. For example, doing something like piece = board[4][4] will return the piece if any that would be located at (4, 4).Of course, there is another way to do this and it would be a tedious task of checking the location of all 32 game pieces and see if any of them is located at (4, 4) when you can simplify that just by using an array as shown above. As I said just about every board game I can think of would use an array to store information like this. In Monopoly you might use an array/list to keep track of the name of each square. board = ["Go", "Mediterranean Avenue", "Income Tax", "Baltic Avenue", "Chance", "Reeding Railroad"} The advantage of an array or list here would be huge. Instead of having to manually write 32 if statements to return the name of each and every square you can simply populate an array with those names and get the name of the square just by passing it the player's location on the board print "You are at " + board[x] + ".\n" would print out the name of the square. If you have multiple squares of the same type you can handle them with one if statement instead of multiple if statements like this. if board[x] == "Chanse": draw_chance() #End if Without the array here you would have to check each chanse square individually like this. if x == 5: draw_chance() #End if if x == 25: draw_chance() #End if As you can see for a very large program an array would save large amounts of time in programming and save you from many headaches. With an array here you could simplify something as determining if the player is on a chance square by seeing if the location returns that type rather than going around the entire board checking the board square by square. Anyway, I'm glad you braught this issue up. One of the things I'm trying to do with the tutorial as well as creating sample games in Python is to try and get some of the key concepts of programming explained in language perhaps the common person can understand. I've always had a nack for things like programming and pick up concepts rather easily. Other people, such as yourself, are completely baffled by concepts and ideas that are crystal clear to me. One reason I think that is because most programmers like other computer geeks just aren't able to speak plane English without tossing in technical termonology and advanced concepts that the common person just doesn't understand, and in my experience most people just aren't very good math students. For example, a lot of the concepts and terminology in programming such as variables, integers, floats, arrays, etc are taken right out of your high school Algebra textbook. Sheesh, I learned about variables, arrays, floating point numbers, etc all by the ninth grade. Wehn i talk to the common person out there they are like "what's that?" It is one of those moments you want to grab the person and ask them "where on earth were you in math class when the teacher was teaching this stuff too you?" Of course, the answer is pretty simple. They probably never understood it back then, or was too busy getting stoned, smoking pot, or day dreaming than to care about getting an education in higher mathematics. Whatever the case I've discovered in order to explain programming we litterally have to take them back to ninth grade and recover some math concepts like what is a variable, and how to use them such as c = a+b which is practically the first thing you learn in high school Algebra, and is essentual for learning programming. Programming is based on the asumption you have had some Algebra, and for games like TDV some trig and calculous would go a long way to making the game operate correctly. If you don't have those fundimental concepts in place before programming it is no wonder it doesn't make sense. HTH On 11/27/10, Hayden Presley <hdpres...@hotmail.com> wrote: > Hi, > What I'm not seeing is, at least with arrays, when they're that useful? > Consider if I make an array. Then, I have to assign each index a value > anyway, no? > > Best Regards, > Hayden > --- Gamers mailing list __ Gamers@audyssey.org If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org. You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/gam...@audyssey.org. If you have any questions or concerns regarding the management of the list, please send E-mail to gamers-ow...@audyssey.org. --- Gamers mailing list __ Gamers@audyssey.org If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org. You can make changes or update your subscription via the web, at http://audyssey.org/mailman/listinfo/gamers_audyssey.org. All messages are archived and can be searched and read at http://www.mail-archive.com/gam...@audyssey.org. If you have any questions or concerns regarding the management of the list, please send E-mail to gamers-ow...@audyssey.org.