944,084 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 2260
  • Java RSS
Apr 16th, 2007
0

Help designing the game either in java or C++

Expand Post »
The Program.
You have been asked to solve a problem for an old gameplayer. She has purchased a new game. It is a sort of Solitaire. This suits the old gameplayer as she has no friends so a game played alone is ideal.
The game is played on a triangular grid. That is there are 7 rows of holes. The bottom row consists of just one hole and the top row of seven holes. Every hole has a red peg in it except the bottom hole.
A move in this game consists of a red peg jumping over one of its neighbours into an empty hole beyond, and then removing the peg jumped over (like taking in draughts). In this game a peg has up to six neighbours.
The diagram shows a stylised board with red squares indicating pegs. The black square indicates a missing peg. The six pegs which could jump into the vacant space (according to the rules) are marked with yellow circles.
The idea is to make move after move until there is just one peg left. Ideally it should be in one of the three corners and best yet it should be in the bottom corner.
However, as a good gameplayer she wants to generalise the game she's bought. She wants to know for which sizes of boards the game can be completed leaving just one peg standing. She also wants to know when the last remaining peg can be left in a corner, and when it can be left in the bottom corner.
You are to write the program which gives her these answers.

Your program should prompt for the size (number of rows, up to eight) of the board.
You should output one of the sentences:
  • This game cannot be completed.
  • This game can be completed but not with the last remaining peg in a corner.
  • This game can be completed leaving a peg in a corner, but not in the top corner
  • This game can be completed leaving the last peg in the bottom corner.
Similar Threads
Reputation Points: 7
Solved Threads: 3
Light Poster
princekool is offline Offline
31 posts
since Apr 2007
Apr 16th, 2007
0

Re: Help designing the game either in java or C++

Have you done any work yourself? If so please post it with specific questions for help. Otherwise we do not allow members to ask other members to do their homework for them. Please show some effort before asking for help.
Moderator
Reputation Points: 161
Solved Threads: 38
He's No Good To Me Dead
stymiee is offline Offline
1,422 posts
since May 2006
Apr 16th, 2007
0

Re: Help designing the game either in java or C++

Jus nid help wid sm few codings wich myt b of use to this game, aint askin ny1 to do it 4 me since it aint a homework bt jus a topic of interest i picked up frm smwea. Any help wil be appreciated. Thnx
Reputation Points: 7
Solved Threads: 3
Light Poster
princekool is offline Offline
31 posts
since Apr 2007
Apr 16th, 2007
0

Re: Help designing the game either in java or C++

Nup this is homework. Read the rules.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 16th, 2007
0

Re: Help designing the game either in java or C++

Help will be provided when you give as problem to solve, but not whole homework
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 874
Code tags enforcer
peter_budo is offline Offline
6,659 posts
since Dec 2004
Apr 16th, 2007
0

Re: Help designing the game either in java or C++

Quote ...
Jus nid help wid sm few codings wich myt b of use to this game, aint askin ny1 to do it 4 me since it aint a homework bt jus a topic of interest i picked up frm smwea. Any help wil be appreciated. Thnx
Having a little trouble spelling words?

Obviously he hasn't done any code yet, otherwise he would already know what language he needs help in.
Pick a language to use, start working on the problem, then ask the forum if something 'specific' is troubling you.
Reputation Points: 92
Solved Threads: 51
Practically a Posting Shark
Phaelax is offline Offline
856 posts
since Mar 2004
Apr 16th, 2007
0

Re: Help designing the game either in java or C++

Its Java. If i remember correctly, a tutorial for an app very similar to this is available (i think it may be from the netbeans site actually....)
Last edited by jbennet; Apr 16th, 2007 at 7:09 pm.
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,528 posts
since Apr 2005
May 8th, 2007
0

Re: Help designing the game either in java or C++

Thanks jbennet for the direction....u rock
Reputation Points: 7
Solved Threads: 3
Light Poster
princekool is offline Offline
31 posts
since Apr 2007
May 10th, 2007
0

Re: Help designing the game either in java or C++

Click to Expand / Collapse  Quote originally posted by princekool ...
Jus nid help wid sm few codings wich myt b of use to this game, aint askin ny1 to do it 4 me since it aint a homework bt jus a topic of interest i picked up frm smwea. Any help wil be appreciated. Thnx

come again?
Reputation Points: 273
Solved Threads: 8
Master Poster
hbk619 is offline Offline
733 posts
since Oct 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Help with menu-driven java applications please
Next Thread in Java Forum Timeline: Basic GUI





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC