yay last min uni work part 2.... I need help

Soldato
Joined
11 Apr 2003
Posts
4,208
Location
Notts
Yes yes, I know your all going to have a go at me, and even when I give my reason you will tell me there is no excuse but all the same.....

I have to do a piece of programing that is done in bluej and uses simple java language (Not object orientated) to create a treasure hunt game. Now I have only untill thursday to get this done, tested and handed in, the reason I have not done it over Christmas (While I do admit I was kinda putting it off as well) Is that I actualy have no idea how to do it, I Know how to write a helloworld program but beyond that everything they told me about programing seems to make little sense (I realy wish I had chosen the other course my uni offers as programing + me = :( :( :( ) Anyway I have to follow the guidelines on the following:

http://s29.quicksharing.com/v/346349/Programing.pdf.html

and have it meet the criteria here:

http://s29.quicksharing.com/v/2691364/Programing_Refference_Grid.pdf.html

I was wondering if anyone could give me any tips on getting going with this, give me something good to read etc, I was planning on creating the 8x7 grids first however apart from going

System.out.println(" ------- -------");
System.out.println("| || |");
etc, I have no idea how to do this, it does say that a visible grid is not expected, however that still leaves the need for a base grid to actualy work with..... urgh thanks if anyone can/will help me however!
 
I can't tell you how to do this, that would be cheating, but for the grid you will want to look at 2-Dimensional Arrays. A clue to this is given in one of the PDFs, mentions the user entering coordinates [row, column] <-- screams 2D array.

If you are using BlueJ then I assume you have the book it came with, everything you need should be in that book. I should know, I used it for two years :p

EDIT: Why are you using an Object-Oriented language to write a program that isn't supposed to be Object-Oriented? My old lecturer would have chopped our legs off if we tried writing a project procedurally!

SiriusB
 
Last edited:
SiriusB said:
I can't tell you how to do this, that would be cheating, but for the grid you will want to look at 2-Dimensional Arrays. A clue to this is given in one of the PDFs, mentions the user entering coordinates [row, column] <-- screams 2D array.

If you are using BlueJ then I assume you have the book it came with, everything you need should be in that book. I should know, I used it for two years :p

SiriusB
Nope no book, its a free download the uni linked us to... But thanks Im sure there must be something I can find now I know what to actualy search for!
 
Psyk said:
If you're using Java, how come you can't do object oriented programming :confused:
Ah god knows my uni, They are doing programing that uses no O_o this semester than teaching o_O next unit..... then onto C++ In year 2 :confused:
 
Ugh that's shocking. Using an OO language for non-OO programming.

Why aren't you using a procedural language?? Strange uni people.

SiriusB
 
Pho said:
Don't worry, I learned all about Java + Sockets (to write a client/server application with GUI) for a Uni project in a week, it's do able (just) :D.

I'd recommend writing it with Net beans, it's the best IDE I found for Java:
http://www.netbeans.org/

Part of the coursework criteria is that it is written in BlueJ. But I agree, NetBeans is lovely :D

SiriusB
 
SiriusB said:
Part of the coursework criteria is that it is written in BlueJ. But I agree, NetBeans is lovely :D

SiriusB

I absolutely love creating GUIs with Netbeans, The automatic snapping of everything makes it really quick :).

I missed the bluej part, you could always write in net beans and copy the source into bluej when you've done ;).
 
1) Create an array made up of 8 arrays of length 7.

2) For each item of treasure, randomly get the row and column values. Put a value in the array at the relevant positions to represent the treasure. In the case of a treasure that is more than one square in size, assign the first square and then select random squares adjacent to it. I'd recommend doing the biggest bits of treasure first, and remember you'll have to check that a square isn't full before putting a bit of treasure in it, so you will need code to check and then bail out and start over if the square is already full.

3) 5 random turns is just a case of generating random pairs and looking in the arrays.

4) 5 player turns is simply the player inputting values and then checking those values and uncovering the treasure as necessary.

5) In terms of displaying this, I suck at GUIs so I'd just do it in the console. Create a secondary array full of # signs or something and echo that to the console. When a turn is made, change the relevant value to something to represent the uncovered treasure or a failed turn.

I once wrote a wordsearch program very similar to this. It filled a grid with words and then a player could find where the words were. The code would be adaptable to this purpose.

However, given that you've said you can barely get past Hello World, I'm afraid to say that I think you're shafted.
 
Pho said:
I absolutely love creating GUIs with Netbeans, The automatic snapping of everything makes it really quick :).

I missed the bluej part, you could always write in net beans and copy the source into bluej when you've done ;).

Nah it isn't worth the effort. I used to do that when at uni but something isn't quite right with BlueJ and it could render perfectly good code useless lol.
 
Don't worry about GUIs, it looks to me like this could perfectly well be a command line app. Assuming that you haven't got a lot else to do then doing this by Thursday is also completely feasible.

As has been said, 2 dimensional arrays will be your friend here, I would think about using 2, one for what is actually there and another for what is currently visible. Thats all the help I'll give.

http://java.sun.com/docs/books/tutorial/index.html
 
Thanks to the above help, I have managed to create a grid (Although its not a visible one as such) im now trying to work out a few things however

1) How do I transfer data from the grid with the treasure, to the grid the user can see, e.g when they uncover a ring, in 1,1 then the blank data on the second grid becomes "Ring"

2) How I make the computer place the treasure randomly

3) How I make the computer select 5 random coordinates

4) How I assign a score to each item/part of item of treasure

5) How I make an ending, where if the player says 1 to continue the program loops back to the beginging otherwise the program exits....

I got a lot done today so far but still so far from finished and have no clue how to be finished :(
 
1) You can reference particular 'squares' on your grid with gridName[x][y]

2) Java has a random number generator, search the API documentation

3) See above

4) could use if statements

5) could use a while loop
 
jcb33 said:
Thanks to the above help, I have managed to create a grid (Although its not a visible one as such) im now trying to work out a few things however

1) How do I transfer data from the grid with the treasure, to the grid the user can see, e.g when they uncover a ring, in 1,1 then the blank data on the second grid becomes "Ring"

Just alter the values in the second grid. Overwrite the values in the existing arrays.

jcb33 said:
2) How I make the computer place the treasure randomly

Search the Java documents for the random functions. It might be Math.Random(), but it's years since I've done Java, so I've no idea.

jcb33 said:
3) How I make the computer select 5 random coordinates

As above.

jcb33 said:
4) How I assign a score to each item/part of item of treasure

Probably best to just do a subroutine which checks the value you've uncovered and then tells you the score. Like if(uncovered=ring) { score = 1; } else if(uncovered = chest) { score = 2; } etc etc

jcb33 said:
5) How I make an ending, where if the player says 1 to continue the program loops back to the beginging otherwise the program exits....

The answer is in the question.

jcb33 said:
I got a lot done today so far but still so far from finished and have no clue how to be finished :(

I kinda get that idea.

I predict you will soon be back asking how to get input from the user.
 
vonhelmet said:
I predict you will soon be back asking how to get input from the user.

Nah, I actualy have that one covered by using TextIO! Hoorah, I just need to make the computer generate random things, get the second grid to display what is uncovered and add the score up at the end + offer chance to replay... Will try the above so thanks for the help, just hope i can get there!
 
Ive got a uni project for Friday with BlueJ, weve had to do a squirrel adventure game... :cool: ... its so dull and i hate programming. Luckily the actual code isnt worth too much, its the requirement elicitation, spec, design, testing etc that get marks too.
 
Oh my god, you did no work over christmas, and now your expecting to be able to do it in three days? Your having a laugh. I worked my arse off all through my christmas holiday on my assignment to get a good mark, so to be honest I'd be annoyed if you got a good mark :p

Sorry, but i cant say you deserve a good mark, or this help
 
Welshy said:
Oh my god, you did no work over christmas, and now your expecting to be able to do it in three days? Your having a laugh. I worked my arse off all through my christmas holiday on my assignment to get a good mark, so to be honest I'd be annoyed if you got a good mark :p
:mad:
 
Back
Top Bottom