Computer Science Canada

*[URGENT]* Program Using Link List [Question]

Author:  methodman [ 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

Author:  Tony [ Mon Jan 06, 2003 5:24 pm ]
Post 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.

Author:  methodman [ Mon Jan 06, 2003 5:34 pm ]
Post subject: 

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

Author:  methodman [ Mon Jan 06, 2003 5:45 pm ]
Post subject: 

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

Author:  Tony [ Mon Jan 06, 2003 5:47 pm ]
Post 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

Author:  Tony [ Mon Jan 06, 2003 5:53 pm ]
Post 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.

Author:  methodman [ Tue Jan 07, 2003 2:52 am ]
Post 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??

Author:  Tony [ Tue Jan 07, 2003 3:00 am ]
Post 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.


: