Closed shangwyoung closed 8 years ago
I sent a FB message, but I realized the question might belong here. The class that I have written is very similar to Sam Rossin's but I chose to have the constructor take an array of ints for the stats instead of individual args. I believe it will be easier to generate random cards this way. Let me know if you have an issue with this.
The constructor looks like this. Pardon the lack of indentation.
class Card: def init(self, name, stats): self.card = [name, stats[0], stats[1], stats[2], stats[3], stats[4]]
Stylistically I'd suggest two fields for card: name and stats -- name won't be used much. I'd also add a getValue(self, index) function just to clean up the rest of the code.
That is exactly what I did actually. I will make sure my branch is available on the remote repository today. I do like the getValue() idea as opposed to having individual getters for everything.
On Thu, Jan 7, 2016 at 9:10 AM, tbwexler notifications@github.com wrote:
Stylistically I'd suggest two fields for card: name and stats -- name won't be used much. I'd also add a getValue(self, index) function just to clean up the rest of the code.
— Reply to this email directly or view it on GitHub https://github.com/aarony422/Space_Station_Auction/issues/1#issuecomment-169674692 .
Would it be easier for us to test if the string representation of the class was
Puppy Clone Factory Science: 0 Ecology: 2 Culture: 0 Commerce: 3 Industry: 0
or simply the array?
[Puppy Clone Factory, 0, 2, 0, 3, 0]
The second way might be easier if we are printing a lot of cards at once, but the first way is very readable. Thoughts?
On Thu, Jan 7, 2016 at 9:18 AM, Nicholas Music nmusic@oberlin.edu wrote:
That is exactly what I did actually. I will make sure my branch is available on the remote repository today. I do like the getValue() idea as opposed to having individual getters for everything.
On Thu, Jan 7, 2016 at 9:10 AM, tbwexler notifications@github.com wrote:
Stylistically I'd suggest two fields for card: name and stats -- name won't be used much. I'd also add a getValue(self, index) function just to clean up the rest of the code.
— Reply to this email directly or view it on GitHub https://github.com/aarony422/Space_Station_Auction/issues/1#issuecomment-169674692 .
I'd suggest the second approach, although you can always keep the prettier one around as a verbose version (if (verbose) ... else ... ).
Cards (the elements you’re bidding on) are described by a 6-element list:
[<name>, <scienceValue>, <ecologyValue>, <cultureValue>, <commerceValue>, <industryValue>]
e.g. ["Puppy Cloning Center", 2, 0, 3, 0, 0]Sam Rossin has written the following class, which I think we can use as reference: