

I did this for a few reasons, one, is that I wanted to see how all the pieces would look, then it was easy for me to just change the current images. I wrote one method which places the four starting pieces, and on the remaining pieces I have of the board, (since the color of the squares are dark green) it places green pieces on all the empty spaces. I figured out all the locations for where each piece would look good, I created a new board in Photoshop, so from this I stored all the x & y cords in a method as a temporary holding location. One issue I came to right out of the gate, is wondering how I'm going to deal with the piece's x & y cords in the calculations of the game's AI. So for my final I've chosen to redo it all, starting with the graphics of it, the look, the board, (which now has a boarder, and a larger area where there is a menu on the side, places for the score, and indicators for who's turn it is currently at any given time) and then the AI. I picked a reversi game that's already designed here, but I don't like it's AI, and the look/feel of it. Here's where I'm at, while my profile reads about wanting to design a game that plays with my own play-style in mind, this current project is for my Final in a course with game programming in Greenfoot.
#Greenfoot piano array how to
I'm mainly needing to understand how to implement a few things for this game, but I do love code samples which help illustrate ways to implement these ideas. Remember, I'm not wanting people to give me the code so much that someone else is writing this for me. So to clear the fog a bit more, I'll explain what I have setup already, and from here maybe some ideas will pop out.

Thanks to everyone who's responding, it means a lot and these are very helpful ideas. Anyway Best of luck to you ill follow you. If you like i can help you with these things when im not in class and help develop the game to your liking i kinda like the idea of learning artificial intellegence myself :). Also read into artificial intellegence and research the bets AI for chess and reversi and checkers. I reccomend learning programming on greenfoot then create your game on a system engine (reversi that is). and good luck! i read your profile and what you want to do is going to need the use of databases. (depending on your program and how complicated it is of course). I dont know them myself it is an expertise and study in computer science to make things efficient so there are LOTS of methods and ways to do this. These things can be learned through ready programming books. Also there are times where the way you design your program itself has a role in how well it runs. If you are having performance issues, go back and reduce the things i just mentioned. Also remember the less loops you use and less dimensions you use and if statements and method calls and times you allocate space + do computations (math) the more efficient your program becomes. Im VERY NEW to greenfoot only reason why im using it is because i have a class assignment in it. Now back to what i said earlier, listen to danpost it seems he knows greenfoot much better then me. The benefit of using a 2D array is your program will run faster and work better then it would with the 1D array of a class. Problem with that is this, 2D array depending on your functions and the things you need to program will be more difficult and the datastructure will be more challenging then using a class of a one dimensional array. This way instead of dealing with a 2D array your only dealing with a 1D array. You can make accessor methods (this is less efficient though) and make a class that holds your x,y coordinates (if i read appropriately) then create a 1 dimensinoal array of that class. If you storing two values there is another way to do this. How to do this im not too sure yet i havnt had a program that needed it yet. The thing about 2 dimensinoal arrays is if you needed it each array can be a different length and size. If you wanted a 3 dimensional array and greater you just add one more for loop and use a different letter / name for the size of that particular array. These index's can be references by i and k. So for each index you have a reference to another array which has a set of index's.

Think of a 2 dimensional array as an array of arrays.

How do you access all elements in a 1D array.
