| | |
Help designing the game either in java or C++
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Apr 2007
Posts: 22
Reputation:
Solved Threads: 0
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:
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.
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.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Help will be provided when you give as problem to solve, but not whole homework
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Mar 2004
Posts: 802
Reputation:
Solved Threads: 40
•
•
•
•
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
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.
![]() |
Similar Threads
- i need help downloading java (Java)
- Java freelancer needed urgently! (Software Development Job Offers)
- Java trouble (Java)
- Quick question about "getLocation()" (Java)
- Game devolpment books (Game Development)
- need help with game making (Java)
- Need java tutor? (Java)
- Java project (Java)
- Applet or Application? (Java)
Other Threads in the Java Forum
- Previous Thread: Help with menu-driven java applications please
- Next Thread: Basic GUI
Views: 1906 | Replies: 8
| Thread Tools | Search this Thread |
Tag cloud for Java
android api apple applet application applications arguments array arrays automation bank binary bluetooth chat class classes clear client code codesnippet component database db development dice draw ebook eclipse error event exception file formatingtextintooltipjava fractal game givemetehcodez graphics gui helpwithhomework html ide image infinite input integer invokingapacheantprogrammatically j2me jarfile java javaprojects jmf jni jpanel julia linux list loop map method methods mobile mysql netbeans newbie number object openjavafx oracle parameter print problem program programming project recursion repositories scanner screen scrollbar server set size sms socket sort sorting sql sqlserver state storm string superclass swing test text-file threads time transfer tree windows







