Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Want to make a Chinese checkers game

 
Brian Mart
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
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!
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Draw it out, and post a picture.

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)

WP
 
Brian Mart
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)

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.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

WP
 
Brian Mart
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Stephan van Hulst
Bartender
Pie
Posts: 5796
61
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ral Kekaz Itong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day Sirs,

I tried understanding the code, but I encountered problems:

Since the Color object is not declared in the code, I assumed that it is the Color class found in java.awt.*

In line 48:

I googled the Color Class documentation and I haven't found a "values()" method and I don't understand the "[0]" beside it.

IDE: Eclipse IDE Juno
OS: Ubuntu Linux 12.04

 
Stephan van Hulst
Bartender
Pie
Posts: 5796
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Color should be an enum; you can define it yourself.
 
Ral Kekaz Itong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic