I just found my new favorite MtG ruling, on Lore Seeker
3
> If you use Agent of Acquisitions to draft a booster pack containing Lore Seeker, and you wish to add a booster pack to the draft, first draft each remaining card from the Lore Seeker booster pack. Then open the new booster pack. You may look at the cards in that pack, but you can’t draft any cards from it. You’ll pass the new booster pack as normal. That was very generous of you.
@codebreaker @murgatroid99 I sandboxed a challenge on Programming Puzzles and Code Golf that you might be interested in participating in. The sandbox is where challenges gather feedback before being posted. It gives them a sort of polish and hopefully closes any loopholes that might be abused.
I'll let you know when it hits the main site, where you can actually post an answer if you want to. In the meantime, feel free to provide feedback via comments. It could probably use feedback from someone who knows about MTG as much as someone who doesn't.
You'd be surprised by how much your mind opens up when you start to golf. A normal programmer looks at the problem and says "wow, that needs a complicated algorithm". A code golfer looks at it and says "Try all possible combinations and we're done."
That's the beauty of code golf. You can stop worrying about efficiency
sort such that colorless is last
method:
For each symbol:
If hybrid, choose one, then recurse
else if not hybrid, fulfill the requirement, then recurse
Well, they may print a negative symbol like "not red" and have reminder text like "not red" can be paid with anything that is not red. I can see them doing that.
@Rainbolt @murgatroid99 I've been thinking more about how to represent mana costs, and I've decided I don't like the idea of having a COLORLESS value in the symbol enum that I can put in the multiset.
For two reasons. The first is, I want to represent the multiplicity of each mana symbol, and colorless symbols are only either absent or present. I don't think the value of the colorless symbol should be represented as its multiplicity, it seems inconsistent.
And second, if I want to redesign hybrid symbols as a pair of other symbols, there would be no way to represent {2} as one symbol.
So I'm thinking I could make Symbol an interface, which would have two implementations: the enum of symbols like I have now, and a Colorless class that would basically be an int wrapper. What do you think?
@murgatroid99 But the way it's represented is substantially different. I think the way I'm conceptualizing symbol is "a circle with something in it," which means ManaCost would simply be a collection of those, rather than an unordered blob of mana amounts. I'm trying to balance the mechanical aspect of it with the representative aspect.
You can faithfully represent a circle with a 3 in it without storing it like that. Let your business logic layer turn what you have {1}{1}{1} into what you need for display {3}
@codebreaker Isn't someone eventually going to use your library code in an application?
@codebreaker but what I would suggest is a mana cost primitive that's not a symbol. Basically, something that can have a color (or colorless) and a count. Then a hybrid symbol is just a pair of such things
The point I'm making is that the representation I'm suggesting is relatively simple (2 classes and an enum), and does everything you need for mana cost
Okay, well I'll think about this. I'm not trying to be frustrating, but I'm still trying to figure out why using the Symbol idea, with ColorlessSymbols, is a bad idea
The biggest issue is that nobody is documenting the upsides and downsides of everyone's methods, which makes this a not so fruitful brainstorming exercise.
@codebreaker Try implementing whatever methods you need with the class structure I described. Compare the length to the current length of your mana cost code
He also says to avoid switch statements, which we will almost certainly fail if we use enumerated types. Every single place that relies on those types will require another switch statement. And when you make a change to the enum? That's a lot of switches you have to fix.
There are also more than that many occasions where an interface or base class would have been more appropriate. The most obvious offender is
switch(myObj.myEnumVar) {
case ONE:
doOne();
case TWO:
doTWO();
etc....
}
An abstract base class with a function do() and a bunch of children that implement it would turn that entire switch into do()