Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 5th, 2005, 11:10 PM   #1
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Hunt the Wumpus

Hey can someone help me...im doing a project trying to build the source code for this game...need help with the bulk of it....

i have 3 classes Monster, Room and the Wumpus Applet...

The applet is ok just the monster and room are a problem...lets start with the Monster class...

public class Monster

{
//
String strDescription;
int intLocation;
String strEvent;

public int getLocation()
{
return intLocation;
}

public void setLocation(int setNewLocation)//
{
intLocation = setNewLocation;
}

public String getDescription()//
{
return strDescription;
}

public void setDescription(String setNewDescription)//)
{
strDescription = setNewDescription;
}

public String getEvent()
{
return strEvent;
}

public void setEvent(String setNewEvent)
{
strEvent = setNewEvent;
}

private int checkRoom (int roomThreat);

int threat = 0;

boolean roomThreat = false;


roomThreat = true;
}
}
dangel55 is offline   Reply With Quote
Old Nov 6th, 2005, 12:12 AM   #2
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 294
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
So uh... what's your question?
andro is offline   Reply With Quote
Old Nov 6th, 2005, 4:40 AM   #3
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
lol.. yeah, what's your question? And use code tags next time Read the post for new users
Polyphemus_ is offline   Reply With Quote
Old Nov 6th, 2005, 12:57 PM   #4
massive-war
Hobbyist Programmer
 
massive-war's Avatar
 
Join Date: Mar 2005
Location: Illinois--> My room
Posts: 117
Rep Power: 0 massive-war is an unknown quantity at this point
Did you import the string class to your monster class?

import java.lang.String;
__________________
Support Our Troops
massive-war is offline   Reply With Quote
Old Nov 6th, 2005, 1:33 PM   #5
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
String is imported by default, i believe.
Polyphemus_ is offline   Reply With Quote
Old Nov 6th, 2005, 4:11 PM   #6
massive-war
Hobbyist Programmer
 
massive-war's Avatar
 
Join Date: Mar 2005
Location: Illinois--> My room
Posts: 117
Rep Power: 0 massive-war is an unknown quantity at this point
is it?
__________________
Support Our Troops
massive-war is offline   Reply With Quote
Old Nov 6th, 2005, 4:40 PM   #7
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 294
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
Yeah you don't need to import String..
andro is offline   Reply With Quote
Old Nov 7th, 2005, 2:23 AM   #8
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Basically checkRoom(int): boolean. This is the Method which will be used to determine if the room contains a threat. When called, the caller will need to specify a room number – such as “12”. If that is the same as the number stored in “intLocation”, the Method will return true – if not, it will return false.

     
    private int checkRoom (int roomThreat);

    int threat = 0;
    
    boolean roomThreat = false; 
    

        roomThreat = true;

Im just asking how to do this....my code is obviously wrong but i dont know how to fix it.
dangel55 is offline   Reply With Quote
Old Nov 7th, 2005, 2:24 AM   #9
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Thanks so much for replying guys....appriciate the help..
dangel55 is offline   Reply With Quote
Old Nov 7th, 2005, 4:51 AM   #10
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 381
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
private boolean checkRoom (int roomThreat){

       return(intLocation == roomThreat);
}
__________________
Don't take life too seriously, it's not permanent !
xavier is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:58 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC