This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
I am looking for help to get started making a Chinese checkers game using Java (if possible). This isnt for a class, just trying to refine my Java skills. Could anyone help me out with what to start with? Specifically, I am unsure how to make the board for the game. Could anyone poiint me in the right direction? I think I know how to do everything after that. For reference, a Chinese checkers board is a 6-point star. Thanks for the help!
2. How do you think a 6 point star would fit in a 2-D space? (Your GUI)
3. What are the rules of the game? (Your business logic)
Joined: Apr 17, 2012
2) I plan to make each piece of the board game its own clickable object, where you can click to pick it up and release to put the piece down (as long as it is a legal move)
3) The goal of the game is to get all of your own pieces into the opposite side of the (blue to green, black to white, yellow to red). You can jump your own pieces as well as others (jumped pieces stay on the board, unlike "normal" checkers) and a player can make as many jumps as possible with one piece in one turn, so setting up a path to quickly jump across the board is critical, but so is playing defense so your opponent cannot also quickly jump across the board. The game must be played with 2, 4, or 6 people.
Since the wholes overlap, I would suggest a 17 x 17 array to hold the board state.
if you look diagonally, there are straight lines.
Rendering the correct appearance may be an issue since it is not linear (like a chess board).
As for the "rules", they seem simple enough to implement. Are you planning on have the computer play?
Joined: Apr 17, 2012
I have not learned enough to incorporate playing vs a computer, especially at different difficulty settings, but that is a good goal for the future. I do not have enough experience in this matter, but would it be possible to rotate the array on the GUI by a certain degree in order to fix this rendering issue?
Hi Brian, I got interested in this problem and decided to create the game for myself. I wrote a Board class that has a point-of-view the board can rotate to (so a certain Color's starting point is at the bottom of the screen, this makes it easy to write AIs for the game) and imposes a coordinate system relative to this point-of-view. When you want to access a position on the Board, it will transform the relative coordinates into the absolute array indices, and then access the array.
I wanted to provide you with a skeleton of the board class, but it may be more useful and educative if you see how it actually works. Please take the time to carefully read and understand the code, and let me know what you think.