Hey
I need some help with a task. I am going to create a single treasure map-game. The game consists of a 2D route tray, where one of the routs contains a hidden treasure. The player has to guess where the treasure is.
The program I am going to make, are going to declare a 2-dimension character-array that is representing the treasure map. The arrays will be filled med letter O, and the contents should be written out to the person that’s playing
The program chooses a random place for the hidden treasure. The program also has to ask the player the number of rows and columns, white the start of a new game, and make the array of that.
The program should have a dialog with the player to guess where the treasure is, and the player answer with a row number and a column number. After each guess, the map is written out, and the place that the player guesses on should contain the latter X.
If the player find the treasure, that guess will be marked with a $, and a greeting messenger is shown
The rows and columns start at 1 and the player answer according to this.
The player have the choice to continue the hunt if the treasure is not found, and the choice to start over with a new define treasure map.
Demands for the program:
A boolean-variable in the loops
The method fillArea should have a 2D character-array and character-variable as a parameter, and that fills the array with character variables contains.
The method printArea should have a 2D character-array as a parameter and that writs out the contents in the array out in a dissent way. The out print should have the row-and column number and it should be formatted properly.
The method printMessanger should have a String- and a Boolean-variable as a parameter and that writes out the String with or without a line break, (depending on whether the Boolean is true or false).
Use the method printMessanger with all the dialogs with the player.
Can somebody help me set this up in java code?
treasure map in java code
Page 1 of 17 Replies - 6727 Views - Last Post: 26 November 2010 - 06:32 AM
Replies To: treasure map in java code
#2
Re: treasure map in java code
Posted 26 November 2010 - 04:40 AM
Okay? And your question is?
#3
Re: treasure map in java code
Posted 26 November 2010 - 04:52 AM
#4
Re: treasure map in java code
Posted 26 November 2010 - 04:57 AM
Go through the instructions and separate the text into a list of "steps" or "atomic processes". Then create a method that accomplishes each of those.
#5
Re: treasure map in java code
Posted 26 November 2010 - 05:09 AM
#6
Re: treasure map in java code
Posted 26 November 2010 - 05:17 AM
Scanner? InputStreamReader wrapped around System.in? JOptionPanes? I am quite sure that your class has already covered receiving input from users. So get two ints and then use those for the sizes of the arrays, of course.
#7
Re: treasure map in java code
Posted 26 November 2010 - 06:30 AM
masijade, on 26 November 2010 - 04:17 AM, said:
Scanner? InputStreamReader wrapped around System.in? JOptionPanes? I am quite sure that your class has already covered receiving input from users. So get two ints and then use those for the sizes of the arrays, of course.
I have imported the scanner, but are not shore where to put it
#8
Re: treasure map in java code
Posted 26 November 2010 - 06:32 AM
Shortly before you create the arrays.
Page 1 of 1

New Topic/Question
Reply



MultiQuote


|