7 Replies - 6727 Views - Last Post: 26 November 2010 - 06:32 AM Rate Topic: -----

#1 olsane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-November 10

treasure map in java code

Posted 26 November 2010 - 03:59 AM

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?

Is This A Good Question/Topic? 0
  • +

Replies To: treasure map in java code

#2 masijade   User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

Re: treasure map in java code

Posted 26 November 2010 - 04:40 AM

Okay? And your question is?
Was This Post Helpful? 0
  • +
  • -

#3 olsane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-November 10

Re: treasure map in java code

Posted 26 November 2010 - 04:52 AM

View Postmasijade, on 26 November 2010 - 03:40 AM, said:

Okay? And your question is?

how should I start to set this up?
Was This Post Helpful? 0
  • +
  • -

#4 masijade   User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

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.
Was This Post Helpful? 0
  • +
  • -

#5 olsane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-November 10

Re: treasure map in java code

Posted 26 November 2010 - 05:09 AM

View Postmasijade, on 26 November 2010 - 03:57 AM, said:

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.

I have written in the 2d arrays code, but how do I set it up so the player can choose the size?
Was This Post Helpful? 0
  • +
  • -

#6 masijade   User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

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.
Was This Post Helpful? 0
  • +
  • -

#7 olsane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 26-November 10

Re: treasure map in java code

Posted 26 November 2010 - 06:30 AM

View Postmasijade, 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
Was This Post Helpful? 0
  • +
  • -

#8 masijade   User is offline

  • D.I.C Addict
  • member icon

Reputation: 196
  • View blog
  • Posts: 580
  • Joined: 03-April 10

Re: treasure map in java code

Posted 26 November 2010 - 06:32 AM

Shortly before you create the arrays.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1