Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 *[URGENT]* Program Using Link List [Question]
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
methodman




PostPosted: Mon Jan 06, 2003 4:58 pm   Post subject: *[URGENT]* Program Using Link List [Question]

Hey,

I need to make a turing card game. How do I display 15 random cards (from a full deck of cards) in 3 columns (5 cards per column) and link them all together. So there would have to be two points, 1 that stores what column the card is in and another to store where the card is in the 3 columns (such as position 1,1 for the first card and 1,2 for the second card in the first column). How do I do this??

Thanks,

methodman
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Jan 06, 2003 5:24 pm   Post subject: (No subject)

you'd need to use multidimentional array, also known as MATRIX.

you can use our search feature to find posts about topics that are already created.

Here's a good result - http://danco.no-ip.com/turing/viewtopic.php?t=225&highlight=array

Post if you need aditional info.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
methodman




PostPosted: Mon Jan 06, 2003 5:34 pm   Post subject: (No subject)

The program must be using link list (with pointers, records, ect..), not arrays.
methodman




PostPosted: Mon Jan 06, 2003 5:45 pm   Post subject: (No subject)

can you modify what you wrote in the last post to use an array?? thnx
Tony




PostPosted: Mon Jan 06, 2003 5:47 pm   Post subject: (No subject)

I'm not exactly sure on how you're going to pull this off without arrays...

anyway, maybe you need something like this?

code:
var card :
            record
                row : int
                column : int
                ID : int
            end record


this way you can have
card.row to store row where card is located
card.column to store column where card is located
card.ID to store card value that you're dealing with.

I still think you'd need an array of var card to have 15 cards instead of 1...

Maybe I'm not understanding your question? Confused
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Tony




PostPosted: Mon Jan 06, 2003 5:53 pm   Post subject: (No subject)

sure thing

code:
var card : array 1..15 of
            record
                row : int
                column : int
                ID : int
            end record


this way you can access each card using following:

card(1) <-card #1
.row <-located in this row
.column <-this column
.ID <- and contains this face value

I hope this clears things up in a way.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
methodman




PostPosted: Tue Jan 07, 2003 2:52 am   Post subject: (No subject)

cool thanks buddy.. this site is way better than all former turing sites Smile

do you have any idea of how to use pointers?? like a pointer to store what cards are in a coulmn.. and another pointer that each card has telling where in the 3 columns it is?

i'll be getting the new project sheet tomorrow so i'll have a better of what to do ..do you have msn or icq??
Tony




PostPosted: Tue Jan 07, 2003 3:00 am   Post subject: (No subject)

MSN if you want... go look in my profile for address.

I'm not sure on the use of pointers. Hopefully someone else can answer that question.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: