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

Username:   Password: 
 RegisterRegister   
 Need Help with Turing Game
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raknarg




PostPosted: Wed Mar 06, 2013 8:05 pm   Post subject: RE:Need Help with Turing Game

In the same way that you call a a procedure, you can also refer to a variable.

For instance if you have a class with a procedure called show_description, you can do this:

object -> show_description

Lets say you have a variable called description. You can call it the same way:

put object -> description
Sponsor
Sponsor
Sponsor
sponsor
Kyle Biro




PostPosted: Wed Mar 06, 2013 10:30 pm   Post subject: RE:Need Help with Turing Game

Well, I have an idea of how to add things to the inventory. My problem is displaying the array of type ^Item. As Tony said, I'd have to use something like "to_string" which I've never seen before. As far as I can think of, your way would require checking to see if the item is present, and the whole thing I'm stuck on is not wanting 100 if statements to check all of this.
Tony




PostPosted: Wed Mar 06, 2013 10:48 pm   Post subject: Re: RE:Need Help with Turing Game

I don't understand your question. You already have an instance of of ^Item, that's what you are trying to print.

It would be up to the ^Item to contain the code to describe itself, which should be straight-forward.

Kyle Biro @ Wed Mar 06, 2013 10:30 pm wrote:
the whole thing I'm stuck on is not wanting 100 if statements to check all of this.

This is a very good design objective to have Smile
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Kyle Biro




PostPosted: Sun Mar 10, 2013 5:26 pm   Post subject: RE:Need Help with Turing Game

YES! I finally got it to work! It displays the inventory and I got dropping items to work.
Thank you everyone for your help!
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 2 of 2  [ 19 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: