New 2 Color Deck Generator
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: New 2 Color Deck Generator
by friarsol » 06 Oct 2010, 17:21
The code in here doesn't make sense:
The filter should probably be something like:
- Code: Select all
else if (colors == 5)
{
out = list.filter(new CardListFilter()
{
public boolean addCard(Card c)
{
return CardUtil.getColors(c).size() >= 2 && //only get multicolored cards
!c.isLand() && //no land
c.getSVar("RemAIDeck").equals("True") || //OR very important
goodLand.contains(c.getName());
}
});
}
The filter should probably be something like:
- Code: Select all
return !(getColors(c).size() > 2 || c.isLand() || c.getSVar("RemAIDeck").equals("True"));
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New 2 Color Deck Generator
by Rob Cashwalker » 06 Oct 2010, 18:00
I thought about that too, so I checked the other generator where I removed the remove list. I now have:
As I was working on my generator, I ran into a issue, where I was getting no cards returned by the CardList.getColor. I dug into it, and realized it had been updated for the card color object, so I attempted to figure out how/why it worked, so that I could use it. But I couldn't, so I figured that from a deck generation point of view, the mana costs were just as good to filter from.
I suspect that the original generators are having issue with the card colors, and not enough cards are available to build the deck.
- Code: Select all
return CardUtil.getColors(c).size() <= 3 &&
!c.isLand() && //no land
!c.getSVar("RemAIDeck").equals("True") || //OR very important
goodLand.contains(c.getName());
As I was working on my generator, I ran into a issue, where I was getting no cards returned by the CardList.getColor. I dug into it, and realized it had been updated for the card color object, so I attempted to figure out how/why it worked, so that I could use it. But I couldn't, so I figured that from a deck generation point of view, the mana costs were just as good to filter from.
I suspect that the original generators are having issue with the card colors, and not enough cards are available to build the deck.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: New 2 Color Deck Generator
by friarsol » 06 Oct 2010, 18:41
I can't tell exactly what the problem is, but I put a breakpoint in getColor(c) and the list of colors being returned looks right to me.
The last line of get5Colors(CardList in) seems suspect though.
For color related functions here is the best way to go. If you want to know if a Card is a color use this:
The last line of get5Colors(CardList in) seems suspect though.
- Code: Select all
out = filterBadCards(out, 3);
return out;
For color related functions here is the best way to go. If you want to know if a Card is a color use this:
- Code: Select all
CardUtil.isColor(card, colorString);
- Code: Select all
CardUtil.getColors(card);
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
18 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 59 guests