Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Nov 10th, 2005, 1:13 AM   #21
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 383
Rep Power: 4 xavier is on a distinguished road
Send a message via Yahoo to xavier
A matrix is an array of arrays it's not hard at all. http://java.sun.com/docs/books/tutor...ltiarrays.html - something to get you started , google for more , but you should get an ideea.
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Nov 10th, 2005, 10:49 PM   #22
dangel55
Newbie
 
Join Date: Nov 2005
Posts: 11
Rep Power: 0 dangel55 is on a distinguished road
Hey xavier, yeah i tried that matrix method but i dint really work well so i just did some ugly codes...so its working now...

but there is still the need to create a new Method called something like “describeRoom()”. This Method should :;

a) Change the Label to read “You are in room X”, where “X” is the room specified by the pointer (“intCurrentRoom”).

b) Ask the room currently specified by the pointer (“intCurrentRoom”) what rooms lead off of it (getRooms(): int[]), and store the results (temporarily) in an array.

c) Change the text (<button>.setLabel(<String>)) of each Button to be the value of one of those three exits.

Here is wat i have in the 'work in progress code':

public class Room

{

    int intRooms[] = new int [19];
    int intRoomCount = 0;


    
    
    public void totalRooms(int newtotalRooms)
    {
       int intRooms[] = new int [newtotalRooms];
    }
    
    public void addRoom(int NewRoom)
    {
        //When new room is added Room count is increased
        intRooms[intRoomCount] = NewRoom;
        intRoomCount++;
        
        //Array values
        intRooms[0] = 1;
        intRooms[0] = 4;
        intRooms[0] = 5;
        intRooms[1] = 0;
        intRooms[1] = 2;
        intRooms[1] = 7;
        intRooms[2] = 1;
        intRooms[2] = 3;
        intRooms[2] = 9;
        intRooms[3] = 2;
        intRooms[3] = 4;
        intRooms[3] = 11;
        intRooms[4] = 0;
        intRooms[4] = 3;
        intRooms[4] = 13;
        intRooms[5] = 0;
        intRooms[5] = 6;
        intRooms[5] = 14;
        intRooms[6] = 5;
        intRooms[6] = 7;
        intRooms[6] = 16;
        intRooms[7] = 1;
        intRooms[7] = 6;
        intRooms[7] = 8;
        intRooms[8] = 7;
        intRooms[8] = 9;
        intRooms[8] = 17;
        intRooms[9] = 2;
        intRooms[9] = 8;
        intRooms[9] = 10;
        intRooms[10] = 9;
        intRooms[10] = 11;
        intRooms[10] = 18;
        intRooms[11] = 3;
        intRooms[11] = 10;
        intRooms[11] = 12;
    }
    
    
    
    public int describeRoom()
    {
        return intCurrentRoom;
    }
    
    public int[] getRooms()
    {
        return intRooms;
    }

    public void intCurrentRoom()
    {
        int intCurrentRoom;
    }


    }
dangel55 is offline   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 11:23 PM.

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