tag:blogger.com,1999:blog-889604442512373664.post8446494271849985666..comments2023-10-31T08:28:52.391-07:00Comments on Computer Programming and Magic: The Gathering: Supertype, Type, and SubtypeForgehttp://www.blogger.com/profile/15838286606081721333noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-889604442512373664.post-2569736068542407112009-11-06T20:48:51.051-08:002009-11-06T20:48:51.051-08:00guaranteed cheapest viagra fda on viagra buy viagr...<a href="http://www.simplyfired.com/story/7797/" rel="nofollow">guaranteed cheapest viagra</a> <a href="http://www.simplyfired.com/story/7800/" rel="nofollow">fda on viagra</a> <a href="http://www.simplyfired.com/story/7800/" rel="nofollow">buy viagra in canada</a> <a href="http://www.simplyfired.com/story/7850/" rel="nofollow">over the counter viagra</a> <a href="http://www.simplyfired.com/story/7850/" rel="nofollow">cheap viagra tablets</a> <a href="http://www.simplyfired.com/story/7847/" rel="nofollow">viagra on line</a> <a href="http://www.simplyfired.com/story/7848/" rel="nofollow">cheap viagra nz</a> <a href="http://www.simplyfired.com/story/7793/" rel="nofollow">cialis super viagra</a> <a href="http://www.simplyfired.com/story/7860/" rel="nofollow">cialis super viagra</a> <a href="http://www.simplyfired.com/story/7791/" rel="nofollow">viagra 6 free samples</a> <a href="http://www.simplyfired.com/story/7844/" rel="nofollow">viagra commercial canyon filmed</a> <a href="http://www.simplyfired.com/story/7847/" rel="nofollow">splitting viagra</a> <a href="http://www.simplyfired.com/story/7843/" rel="nofollow">what does viagra do</a> <a href="http://www.simplyfired.com/story/7856/" rel="nofollow">viagra rrp australia cost</a>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-81014207623219574282009-01-23T11:11:00.000-08:002009-01-23T11:11:00.000-08:00"Truthfully I don't understand when type/subtype/s..."Truthfully I don't understand when type/subtype/supertype"<BR/><BR/>If not properly implemented, this is going to go horribly wrong. Imagine enchantments, instants and sorceries that only target specific types of cards or grant bonuses based on the number of them in play. It'll become really inefficient to take string apart, look at the contents and then return the string, then using something like switch(){} to go through the motions and eventually ending up where you want to be.<BR/><BR/>Off the top of my head I would just create SuperType and SubType classes that extend Type which extends from something like ArrayList. Or maybe you could make your own datastructure based on the interface that exists for List. It'll come in handy in the future when card interactions become even more complicated then they are now. Knuth may have said that "premature optimization is the root of all evil", but it's the handling of these kind of problems as an afterthought that will ultimately make you give up on a project like this.<BR/><BR/>Keep up the good work :D<BR/><BR/>./ktn<BR/><BR/>P.S. the implementation of types as strings is easy, but in the end it'll kill you. I suggest you revise your data model to consider implementing it in the Card object. Mostly because the Card object is responsible for storing all the info present on a card.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-16497873069480770372009-01-20T13:04:00.000-08:002009-01-20T13:04:00.000-08:00Truthfully I don't understand when type/subtype/su...Truthfully I don't understand when type/subtype/supertype can be a problem because most of the time I just view it has flavor text. "This card is an elf, cool."<BR/><BR/>I know that Forests are a subtype and they grant the card a mana ability. I don't like the idea of a subtype magically adding an ability to a card but it works for lands I guess, thankfully I can't think of any other instances where a subtype "grants" an ability.Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-82110956463980031732009-01-15T14:35:00.000-08:002009-01-15T14:35:00.000-08:00I'm afraid your troubles don't end at supertype/ty...I'm afraid your troubles don't end at supertype/type/subtypes seperation. :P<BR/><BR/>Within subtypes, there are groupings. You have creature types, spell types, artifact types, planeswalker types, land types... it wouldn't really matter about all these types except that <B>a permanent with a subtype for which it does not have the corrosponding type is considered to not have that subtype</B>. In other words, if you have a Creature - Elf, and an effect turns it into an Enchantment, it ceases to be an Elf. Why? Because Enchantments can only be Auras or Shrines, not Elves.<BR/><BR/>Trust me, not even Incantus handles this 100% properly... however, we have made things slightly easier for ourselves. In one of our source code files, we have lists of all of these various subtype groupings (well, sets, technically), and can therefore determine (on a card-by-card basis, if need be) whether or not something's types allow it to have a given subtype. These lists (sets) were taken straight from the comprehensive rules, and we update them as needed (for example, after Shards of Alara came out, we added Elspeth, Sarkhan, and Tezzeret to all_planeswalkers).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-41896187230767060882009-01-15T13:06:00.000-08:002009-01-15T13:06:00.000-08:00Well for version 1 I don't mind what people do wit...Well for version 1 I don't mind what people do with it. If you feel that counters should be objects, go for it. I'm just for what works.Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-37918538259837819482009-01-15T12:26:00.000-08:002009-01-15T12:26:00.000-08:00Forge said "I understand strings and they are very...Forge said "I understand strings and they are very simple and unsophisticated (like myself)."<BR/><BR/>I take that as canon proof that counters should be implemented as arrays of strings, not some crazy counter object.Unknownhttps://www.blogger.com/profile/15178010996656985441noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-80377704497862774842009-01-15T11:26:00.000-08:002009-01-15T11:26:00.000-08:00Since a Magic's card type, supertype, and subtype ...Since a Magic's card type, supertype, and subtype are all strings, my opinion is that I just use string, "creature" versus a creature subclass. I understand strings and they are very simple and unsophisticated (like myself).Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-25526499352543690652009-01-15T05:12:00.000-08:002009-01-15T05:12:00.000-08:00keep in mind that i you have 2 "human soldier...keep in mind that i you have 2 "human soldier"s, each one should get +1/+1, not +2/+2 (one for each type)!<BR/>if your card's don't have equals overridden, you have instance-equality in a HashSet. so, every card would would only be contained once.<BR/><BR/>it would look something like this<BR/>Card creature = ...;<BR/>HashSet<Card> hs = new HashSet<Card>();<BR/><BR/>for(every card of list) {<BR/> for(every type of card) {<BR/> if(a shared subtype) {<BR/> //each card can only be added once, because the HashSet just won't add equal cards more than once.<BR/> hs.add(card);<BR/> }<BR/> }<BR/>}<BR/>creature.addAttack(hs.size()-1);<BR/>creature.addDefense(hs.size()-1);Silly Freakhttps://www.blogger.com/profile/09963238585847993157noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-83309976228774688362009-01-13T23:58:00.000-08:002009-01-13T23:58:00.000-08:00Gando the Wandering Fool> agree, object model i...Gando the Wandering Fool> agree, object model is good enough<BR/><BR/>but you also can leave current MTGForge model and still implement <BR/>Coat of Arms easily<BR/><BR/>as Forge asked for hints, I can suggest one:<BR/><BR/>first we'll create utility class for types with such methods:<BR/><BR/>boolean TypeUtil.isSuperType(String type)<BR/>boolean TypeUtil.isSubType(String type)<BR/><BR/>(no need to say that it's just comparing to such words as "Creature", "Legendary", etc. that is rather easy to implement)<BR/><BR/>so the code for Coat of Arms can look like that:<BR/><BR/>CardList list = new CardList();<BR/>list.addAll(AllZone.Human_Play.getCards());<BR/>list.addAll(AllZone.Computer_Play.getCards());<BR/>list = list.getType("Creature"); <BR/><BR/>for (Card card: list.getArrayList()) {<BR/> for (String type: card.getType()) <BR/> if (TypeUtil.isSubtype(type)) {<BR/> CardList sameType = list.getType(type);<BR/> if (sameType.size() - 1 > 0) {<BR/> card.addAttack(sameType.size() - 1);<BR/> card.addDefence(sameType.size() - 1);<BR/> }<BR/> }<BR/> }<BR/>}nantuko84https://www.blogger.com/profile/15891352523600843744noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-69438649227230097482009-01-13T15:27:00.000-08:002009-01-13T15:27:00.000-08:00It seems to me again an object model works best he...It seems to me again an object model works best here.<BR/>Then you can have a member for Supertypes, Types and Subtypes and not find them confusing in the least.Gando the Wandering Foolhttps://www.blogger.com/profile/11853286404078430074noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-11081048853872431242009-01-13T11:13:00.000-08:002009-01-13T11:13:00.000-08:00Arg, I did forget Planeswalker. I'll update my po...Arg, I did forget Planeswalker. I'll update my post. (I guess I need to download the latest Comprehensive Rules.)Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-1512257859732777752009-01-13T11:10:00.000-08:002009-01-13T11:10:00.000-08:00You forgot "Planeswalker".You forgot "Planeswalker".Anonymousnoreply@blogger.com