It is currently 21 Oct 2017, 23:24
   
Text Size

Dominion Source Code (updated Jan 3rd, 2012)

A version of Asmadi Games' game by jatill

Moderators: jatill, CCGHQ Admins

Re: Dominion Source Code (updated 4/23)

Postby cteague3 » 16 May 2010, 02:38

I published the codeplex project without having an actual "release" available for download. I had to enter something on the home page, which I basically just put a link back to this forum, and then I had to choose a license, which I ended up selecting CDDL. Not exactly sure if that might be an issue for anyone, and if so, probably can be changed.

I will be more than happy to add you guys as coordinators. Also, I chose Mercurial as the repository type, and then downloaded the TortoiseH2 client to connect and pull/push the code. It was fairly straight forward.
cteague3
 
Posts: 10
Joined: 23 Apr 2010, 06:04
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 4/23)

Postby Tador » 27 May 2010, 14:44

Hi,

i would like to help you.
For progress.

i have vb.net knoledges to help.

Greetings

Tador.
Tador
 
Posts: 1
Joined: 27 May 2010, 14:41
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 4/23)

Postby cteague3 » 27 May 2010, 16:16

Tador: If you would like for me to add you to the codeplex project, send me your codeplex userid. Or I bet you can request access to it thru codeplex and they send me the request to accept or deny, not sure. Try signing into codeplex and see if you can request developer access to the project. You can get to it here:

http://dominiondotnet.codeplex.com/

On the right-hand side, you can see a link that explains how to get to the source using the Mercurial client TortoiseHg. It is fairly intuitive to use, and codeplex has a little help page to step you thru using it.

I do not plan to mess with the VB.NET code that NullGeek uploaded, but it is there if you want to expand upon it. It is in VS2008.

NullGeek: I'll add you to the codeplex project, too, if you'll send me your codeplex userid, or make a request to it thru the system.
cteague3
 
Posts: 10
Joined: 23 Apr 2010, 06:04
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 8/13)

Postby bluefr » 10 Sep 2010, 12:21

I finally got into looking at the code.
Since i don't have VB6, i got VS 2010 express, and could open (and compile) the source code that's been converted.
When i launch the game it crashes (haven't got into that yet) but seems normal since the code dates back a bit, and i copied over the ressources files i had from the latest version.
I've read over half of "Visual basic 2010 in 24 hours" so i'm starting to get the hang of it, and should be able soon to start lookin at 'externalizing the campaigns' (should be easy for basic scenarios where just counting a type of card at the end of the game is necessary)
One thing I don't know yet is how to convert the code from VB6 (since VS 2010 doesn't open VB6 code, that's why I started looking at the converted code).
Is anybody else still active about the .net conversion ?
bluefr
 
Posts: 6
Joined: 29 Aug 2010, 14:15
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 8/13)

Postby cheenius » 14 Feb 2011, 06:40

Any chance of a update to the latest source?
cheenius
 
Posts: 3
Joined: 14 Feb 2011, 06:39
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 8/13)

Postby jatill » 14 Feb 2011, 13:11

The source posted here is about 99.9% the same as the latest version. When the new expansion comes out, I'll update the version.
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: Dominion Source Code (updated 8/13)

Postby cheenius » 14 Feb 2011, 16:36

thnx
cheenius
 
Posts: 3
Joined: 14 Feb 2011, 06:39
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 8/13)

Postby Shivan0910 » 16 Feb 2011, 09:38

Hello,

I'm french and I would like to developp a french version of your VB project.

May I have the permission to do this and maybe have the last version of your project so I can translate the whole thing ?

Thanks,

Shivan
Shivan0910
 
Posts: 2
Joined: 14 Feb 2011, 11:04
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated 8/13)

Postby jatill » 16 Feb 2011, 13:10

The code is open-source, so do what you like, as long as your post your finished version here. I'd prefer if you kept the link to my other apps in there, of course.
If you wanted to really take the next step here, you could extract all the game text into a file, so it would be easy to translate for other languages, as well as work for future expansions.
The source is up to date now.
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: Dominion Source Code (updated Feb 16th, 2011)

Postby Shivan0910 » 16 Feb 2011, 13:51

thanks, I will do what you suggest, one external file with languages (en/fr so far) with a language selection on the main screen...

It's already some work to do ^^ !
Shivan0910
 
Posts: 2
Joined: 14 Feb 2011, 11:04
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated Feb 16th, 2011)

Postby pinkymadigan » 19 Jun 2011, 20:19

I would really like to see the kingdom selection portion of this expanded- I have some code for a standalone app in vb.net that let's you pick parameters based on the types of cards you want guaranteed in / out of the setup, and would love to see something like this implemented.

I'll post the code in two parts to deal with the post size character limit...
Code: Select all
Imports System.Text

Public Class Main

#Region " Private members "

    Public Shared ReadOnly _cardName As String = "name"
    Public Shared ReadOnly _card As String = "card"
    Public Shared ReadOnly _expansion As String = "expansion"

    Public Class expansionName
        Public Shared ReadOnly Base As String = "Base"
        Public Shared ReadOnly Intrigue As String = "Intrigue"
        Public Shared ReadOnly Seaside As String = "Seaside"
        Public Shared ReadOnly Alchemy As String = "Alchemy"
        Public Shared ReadOnly Prosperity As String = "Prosperity"
        Public Shared ReadOnly Cornucopia As String = "Cornucopia"
        Public Shared ReadOnly Custom As String = "Custom"
    End Class

    Private _sortAlpha As Boolean
    Private _dtCards As DataTable
    Private _childForm As FavoritesList
    Private _attemptsToMakeDeck As Integer

#End Region

#Region "Construction/private methods"

    Public Sub New()

        InitializeComponent()
        CreateDataSource()
        VerifyDataSource()
        _attemptsToMakeDeck = 0

    End Sub

    Private Sub CreateDataSource()

        _dtCards = New DataTable
        _dtCards.Columns.Add(_cardName, GetType(String))
        _dtCards.Columns.Add(_card, GetType(Card))
        _dtCards.Columns.Add(_expansion, GetType(String))

        _dtCards.Rows.Add(New Object() {"Tactician", New Card("Tactician", 5, False, False, True, False, True, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Native Village", New Card("Native Village", 2, False, False, False, True, False, False, False, False, False, True, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Saboteur", New Card("Saboteur", 5, True, False, False, False, False, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Upgrade", New Card("Upgrade", 5, False, False, False, False, False, True, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Explorer", New Card("Explorer", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Great Hall", New Card("Great Hall", 3, False, False, False, False, False, False, True, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Moat", New Card("Moat", 2, False, True, False, False, True, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Conspirator", New Card("Conspirator", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Market", New Card("Market", 5, False, False, True, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Pirate Ship", New Card("Pirate Ship", 4, True, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Lookout", New Card("Lookout", 3, False, False, False, False, False, True, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Warehouse", New Card("Warehouse", 3, False, False, False, False, True, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Village", New Card("Village", 3, False, False, False, True, False, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Wishing Well", New Card("Wishing Well", 3, False, False, False, False, True, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Duke", New Card("Duke", 5, False, False, False, False, False, False, True, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Festival", New Card("Festival", 5, False, False, True, True, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Spy", New Card("Spy", 4, True, False, False, False, False, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Merchant Ship", New Card("Merchant Ship", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Chancellor", New Card("Chancellor", 3, False, False, False, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Witch", New Card("Witch", 5, True, False, False, False, True, False, False, True, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Sea Hag", New Card("Sea Hag", 4, True, False, False, False, False, False, False, True, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Trading Post", New Card("Trading Post", 5, False, False, False, False, False, True, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Black Market", New Card("Black Market", 3, False, False, True, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Baron", New Card("Baron", 4, False, False, True, False, False, False, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Secret Chamber", New Card("Secret Chamber", 2, False, True, False, False, False, False, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Wharf", New Card("Wharf", 5, False, False, True, False, True, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Treasure Map", New Card("Treasure Map", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Bazaar", New Card("Bazaar", 5, False, False, False, True, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Chapel", New Card("Chapel", 2, False, False, False, False, False, True, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Gardens", New Card("Gardens", 4, False, False, False, False, False, False, True, False, False, False, True), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Council Room", New Card("Council Room", 5, False, False, True, False, True, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Swindler", New Card("Swindler", 3, True, False, False, False, False, False, False, False, True, False, True), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Laboratoy", New Card("Laboratoy", 5, False, False, False, False, True, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Salvager", New Card("Salvager", 4, False, False, True, False, False, True, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Library", New Card("Library", 5, False, False, False, False, True, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Envoy", New Card("Envoy", 4, False, False, False, False, True, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Island", New Card("Island", 4, False, False, False, False, False, False, True, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Tribute", New Card("Tribute", 5, False, False, False, False, False, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Scout", New Card("Scout", 4, False, False, False, False, False, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Courtyard", New Card("Courtyard", 2, False, False, False, False, True, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Woodcutter", New Card("Woodcutter", 3, False, False, True, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Haven", New Card("Haven", 2, False, False, False, False, False, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Bureaucrat", New Card("Bureaucrat", 4, True, False, False, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Lighthouse", New Card("Lighthouse", 2, False, True, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Cellar", New Card("Cellar", 2, False, False, False, False, True, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Navigator", New Card("Navigator", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Coppersmith", New Card("Coppersmith", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Mining Village", New Card("Mining Village", 4, False, False, False, True, False, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Outpost", New Card("Outpost", 5, False, False, False, False, False, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Harem", New Card("Harem", 6, False, False, False, False, False, False, True, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Ambassador", New Card("Ambassador", 3, True, False, False, False, False, True, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Adventurer", New Card("Adventurer", 6, False, False, False, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Treasury", New Card("Treasury", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Cutpurse", New Card("Cutpurse", 4, True, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Caravan", New Card("Caravan", 4, False, False, False, False, True, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Torturer", New Card("Torturer", 5, True, False, False, False, True, False, False, True, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Throne Room", New Card("Throne Room", 4, False, False, False, False, False, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Steward", New Card("Steward", 3, False, False, False, False, True, True, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Embargo", New Card("Embargo", 2, False, False, False, False, False, False, False, True, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Remodel", New Card("Remodel", 4, False, False, False, False, False, True, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Moneylender", New Card("Moneylender", 4, False, False, False, False, False, True, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Feast", New Card("Feast", 4, False, False, False, False, False, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Ironworks", New Card("Ironworks", 4, False, False, False, False, False, False, False, False, False, False, True), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Bridge", New Card("Bridge", 4, False, False, True, False, False, False, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Smugglers", New Card("Smugglers", 3, False, False, False, False, False, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Fishing Village", New Card("Fishing Village", 3, False, False, False, True, False, False, False, False, True, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Smithy", New Card("Smithy", 4, False, False, False, False, True, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Mine", New Card("Mine", 5, False, False, False, False, False, True, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Nobles", New Card("Nobles", 6, False, False, False, True, True, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Workshop", New Card("Workshop", 3, False, False, False, False, False, False, False, False, False, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Pearl Diver", New Card("Pearl Diver", 2, False, False, False, False, False, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Militia", New Card("Militia", 4, True, False, False, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Ghost Ship", New Card("Ghost Ship", 5, True, False, False, False, True, False, False, False, False, False, False), expansionName.Seaside})
        _dtCards.Rows.Add(New Object() {"Thief", New Card("Thief", 4, True, False, False, False, False, False, False, False, True, False, False), expansionName.Base})
        _dtCards.Rows.Add(New Object() {"Minion", New Card("Minion", 5, True, False, False, False, False, False, False, False, True, False, True), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Pawn", New Card("Pawn", 2, False, False, True, False, False, False, False, False, True, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Shanty Town", New Card("Shanty Town", 3, False, False, False, False, True, False, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Masquerade", New Card("Masquerade", 3, False, False, False, False, True, True, False, False, False, False, False), expansionName.Intrigue})
        _dtCards.Rows.Add(New Object() {"Vineyard", New Card("Vineyard", 100, False, False, False, False, False, False, True, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"University", New Card("University", 102, False, False, False, True, False, False, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Transmute", New Card("Transmute", 100, False, False, False, False, False, True, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Scrying Pool", New Card("Scrying Pool", 102, True, False, False, False, True, False, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Possession", New Card("Possession", 106, True, False, False, False, False, False, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Philosopher's Stone", New Card("Philosopher's Stone", 103, False, False, False, False, False, False, False, False, True, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Herbalist", New Card("Herbalist", 2, False, False, True, False, False, False, False, False, True, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Golem", New Card("Golem", 104, False, False, False, False, False, False, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Familiar", New Card("Familiar", 103, True, False, False, False, False, False, False, True, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Apprentice", New Card("Apprentice", 5, False, False, False, False, True, True, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Apothecary", New Card("Apothecary", 102, False, False, False, False, False, False, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Alchemist", New Card("Alchemist", 103, False, False, False, False, True, False, False, False, False, False, False), expansionName.Alchemy})
        _dtCards.Rows.Add(New Object() {"Stash", New Card("Stash", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Seaside})

        _dtCards.Rows.Add(New Object() {"Bank", New Card("Bank", 7, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Bishop", New Card("Bishop", 4, False, False, False, False, False, True, True, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"City", New Card("City", 5, False, False, False, True, False, False, False, False, False, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Contraband", New Card("Contraband", 5, False, False, True, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Counting House", New Card("Counting House", 5, False, False, False, False, False, False, False, False, False, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Expand", New Card("Expand", 7, False, False, False, False, False, True, False, False, False, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Forge", New Card("Forge", 7, False, False, False, False, False, True, False, False, False, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Goons", New Card("Goons", 6, True, False, True, False, False, False, True, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Grand Market", New Card("Grand Market", 6, False, False, True, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Hoard", New Card("Hoard", 6, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"King's Court", New Card("King's Court", 7, False, False, False, False, False, False, False, False, False, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Loan", New Card("Loan", 3, False, False, False, False, False, True, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Mint", New Card("Mint", 5, False, False, False, False, False, True, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Monument", New Card("Monument", 4, False, False, False, False, False, False, True, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Mountebank", New Card("Mountebank", 5, True, False, False, False, False, False, False, True, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Peddler", New Card("Peddler", 8, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Quarry", New Card("Quarry", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Rabble", New Card("Rabble", 5, True, False, False, False, True, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Royal Seal", New Card("Royal Seal", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Talisman", New Card("Talisman", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Trade Route", New Card("Trade Route", 3, False, False, True, False, False, True, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Vault", New Card("Vault", 5, False, False, False, False, True, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Venture", New Card("Venture", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Watchtower", New Card("Watchtower", 3, False, True, False, False, True, True, False, False, True, False, False), expansionName.Prosperity})
        _dtCards.Rows.Add(New Object() {"Worker's Village", New Card("Worker's Village", 4, False, False, True, True, False, False, False, False, False, False, False), expansionName.Prosperity})

        _dtCards.Rows.Add(New Object() {"Farming Village", New Card("Farming Village", 4, False, False, False, True, True, False, False, False, False, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Fortune Teller", New Card("Fortune Teller", 3, True, False, False, False, False, False, False, False, True, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Hamlet", New Card("Hamlet", 2, False, False, True, True, False, False, False, False, False, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Harvest", New Card("Harvest", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Horn of Plenty", New Card("Horn of Plenty", 5, False, False, False, False, False, False, False, False, True, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Horse Traders", New Card("Horse Traders", 4, False, True, True, False, False, False, False, False, True, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Hunting Party", New Card("Hunting Party", 5, False, False, False, False, True, False, False, False, False, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Jester", New Card("Jester", 5, True, False, False, False, False, False, False, True, True, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Menagerie", New Card("Menagerie", 3, False, False, False, False, True, False, False, False, False, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Remake", New Card("Remake", 4, False, False, False, False, False, True, False, False, False, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Tournament", New Card("Tournament", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Young Witch", New Card("Young Witch", 4, True, False, False, False, True, False, False, True, False, False, False), expansionName.Cornucopia})
        _dtCards.Rows.Add(New Object() {"Fairgrounds", New Card("Fairgrounds", 6, False, False, False, False, False, False, True, False, False, False, False), expansionName.Cornucopia})

        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})
        '_dtCards.Rows.Add(New Object() {"*Trade Route*", New Card("*Trade Route*", 4, False, False, False, False, False, False, False, False, True, False, False), expansionName.Custom})

    End Sub

    Private Sub VerifyDataSource()

        Try

            For Each cardRow As DataRow In _dtCards.Rows()

                Dim cardObj As Card = DirectCast(cardRow.Item(_card), Card)

                If cardRow.Item(_cardName).ToString <> cardObj.Name Then

                    Throw New Exception(String.Format("Card {0}'s name does not match the name of the datarow; {1}", cardObj.Name, cardRow.Item(_cardName).ToString))

                End If

                If cardObj.Cost = 0 Then

                    Throw New Exception(String.Format("Card {0}'s cost has been entered incorrectly and equals 0", cardObj.Name))

                End If

            Next

        Catch ex As Exception
            MessageBox.Show(ex.Message, "Data Error")
        End Try

    End Sub

    Private Sub FulfillInclusions()

        Try

            Dim selectedCard As Card = Nothing

            'extra buy
            If chkIncludeExtraBuy.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("ExtraBuy") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsExtraBuy)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card with extra buy")
                End If

            End If

            selectedCard = Nothing

            If chkMustHaveVictoryCards.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Victory") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsVictory)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is a victory card")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeActionSplitter.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Splitter") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsActionSplitter)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is an action splitter")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeAdditionalActionSplitter.CheckState = CheckState.Checked Then

                'bump by one anyway
                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsActionSplitter)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is an additional action splitter")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeAttack.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Attack") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsAttack)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is an attack")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeCurseCard.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Curse") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsCurse)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is a curse giving card")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeDepthCard.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Depth") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsDepth)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is a depth card")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeMoneyCard.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Money") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsMoney)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is a money card")
                End If

            End If

            selectedCard = Nothing

            If chkMustIncludeTrashCards.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Trash") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsTrash)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is a trash card")
                End If

            End If

            If chkBumpAlchemy.CheckState = CheckState.Checked Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not _dtCards.Rows(selectedCard.m_Index).Item(_expansion) = expansionName.Alchemy)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is an Alchemy card")
                End If

                'reset for a second
                selectedCard = Nothing

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not _dtCards.Rows(selectedCard.m_Index).Item(_expansion) = expansionName.Alchemy)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is a second Alchemy card")
                End If

                'randomly pull a third
                Dim rBump As New Random(Now.Millisecond)
                Dim bumpChance As Integer = rBump.Next() Mod 2

                If bumpChance = 1 Then

                    selectedCard = Nothing

                    While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not _dtCards.Rows(selectedCard.m_Index).Item(_expansion) = expansionName.Alchemy)

                        selectedCard = GenerateCard()

                    End While

                    If selectedCard IsNot Nothing Then
                        DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                    Else
                        Throw New Exception("Error fulfilling conclusions - unable to include card that is a second Alchemy card")
                    End If

                End If

                If chkBumpAlc2.Enabled AndAlso chkBumpAlc2.CheckState = CheckState.Checked Then

                    selectedCard = Nothing

                    While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not _dtCards.Rows(selectedCard.m_Index).Item(_expansion) = expansionName.Alchemy)

                        selectedCard = GenerateCard()

                    End While

                    If selectedCard IsNot Nothing Then
                        DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                    Else
                        Throw New Exception("Error fulfilling conclusions - unable to include card that is a second Alchemy card")
                    End If

                    ''randomly pull again
                    'bumpChance = rBump.Next() Mod 2

                    'If bumpChance = 1 Then

                    '    selectedCard = Nothing

                    '    While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not _dtCards.Rows(selectedCard.m_Index).Item(_expansion) = expansionName.Alchemy)

                    '        selectedCard = GenerateCard()

                    '    End While

                    '    If selectedCard IsNot Nothing Then
                    '        DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                    '    Else
                    '        Throw New Exception("Error fulfilling conclusions - unable to include card that is a second Alchemy card")
                    '    End If

                    'End If

                End If

            End If

            Dim cost As Integer = 2

            While cost <= 5

                If chkEquitableDistribution.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter(String.Format("Cost{0}", cost)) Then

                    While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso selectedCard.Cost <> cost)

                        selectedCard = GenerateCard()

                    End While

                    If selectedCard IsNot Nothing Then
                        DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                    Else
                        Throw New Exception("Error fulfilling conclusions - unable to assure equitable cost distribution")
                    End If

                End If

                cost += 1

            End While

        Catch ex As Exception
            MessageBox.Show(ex.Message, "Fulfill Inclusions Error")
        End Try

    End Sub

    Private Function GenerateCard() As Card

        Dim selectedCard As Card = Nothing
        Dim selectionIndex As Integer
        Dim r As New Random(Now.Millisecond)

        While selectedCard Is Nothing OrElse selectedCard.IsExcluded OrElse selectedCard.IsIncluded OrElse Not VerifyCardDoesNotViolateExclusions(selectedCard)

            selectionIndex = r.Next() Mod _dtCards.Rows.Count

            selectedCard = DirectCast(_dtCards.Rows(selectionIndex).Item(_card), Card)

        End While

        selectedCard.m_Index = selectionIndex

        Return selectedCard

    End Function

    Private Sub FillRemaining()

        Try
            Dim selectedCard As Card = Nothing
            Dim r As New Random

            While CountDeck() < nudNumberOfCards.Value - 1

                Dim chance As Integer = r.Next Mod 100

                If chkMustIncludeFavoriteCard.CheckState = CheckState.Checked Then

                    If CardTypeIsStillAvailable("Favorite") AndAlso chance > 25 Then

                        While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsFavorite)

                            selectedCard = GenerateCard()

                        End While

                        If selectedCard IsNot Nothing Then
                            DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                        Else
                            Throw New Exception("Error fulfilling conclusions - unable to include card that is a favorite card")
                        End If

                    Else

                        While selectedCard Is Nothing OrElse selectedCard.IsExcluded OrElse selectedCard.IsIncluded OrElse Not VerifyCardDoesNotViolateExclusions(selectedCard)
                            ReviewDeckForParameter("None")
                            selectedCard = GenerateCard()
                        End While

                        If selectedCard IsNot Nothing Then
                            DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                            selectedCard = Nothing
                        Else
                            Throw New Exception("Error filling the deck")
                        End If

                    End If

                Else

                    While selectedCard Is Nothing OrElse selectedCard.IsExcluded OrElse selectedCard.IsIncluded OrElse Not VerifyCardDoesNotViolateExclusions(selectedCard)
                        ReviewDeckForParameter("None")
                        selectedCard = GenerateCard()
                    End While

                    If selectedCard IsNot Nothing Then
                        DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                        selectedCard = Nothing
                    Else
                        Throw New Exception("Error filling the deck")
                    End If

                End If

                selectedCard = Nothing

            End While

            'last, when selecting last card, see if we need a defense card or not
            If chkMustIncludeDefenseIfAttackIsPresent.CheckState = CheckState.Checked AndAlso ReviewDeckForParameter("Defense") Then

                While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsDefense)

                    selectedCard = GenerateCard()

                End While

                If selectedCard IsNot Nothing Then
                    DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                Else
                    Throw New Exception("Error fulfilling conclusions - unable to include card that is defensive")
                End If

            Else

                If chkMustIncludeFavoriteCard.CheckState = CheckState.Checked Then

                    If CardTypeIsStillAvailable("Favorite") Then

                        While selectedCard Is Nothing OrElse (selectedCard IsNot Nothing AndAlso Not selectedCard.IsFavorite)

                            selectedCard = GenerateCard()

                        End While

                        If selectedCard IsNot Nothing Then
                            DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                        Else
                            Throw New Exception("Error fulfilling conclusions - unable to include card that is a favorite card")
                        End If

                    Else

                        While selectedCard Is Nothing OrElse selectedCard.IsExcluded OrElse selectedCard.IsIncluded OrElse Not VerifyCardDoesNotViolateExclusions(selectedCard)
                            ReviewDeckForParameter("None")
                            selectedCard = GenerateCard()
                        End While

                        If selectedCard IsNot Nothing Then
                            DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                            selectedCard = Nothing
                        Else
                            Throw New Exception("Error filling the deck")
                        End If

                    End If

                Else

                    While selectedCard Is Nothing OrElse selectedCard.IsExcluded OrElse selectedCard.IsIncluded OrElse Not VerifyCardDoesNotViolateExclusions(selectedCard)
                        ReviewDeckForParameter("None")
                        selectedCard = GenerateCard()
                    End While

                    If selectedCard IsNot Nothing Then
                        DirectCast(_dtCards.Rows(selectedCard.m_Index).Item(_card), Card).IsIncluded = True
                        selectedCard = Nothing
                    Else
                        Throw New Exception("Error filling the deck")
                    End If

                End If

                selectedCard = Nothing

            End If

        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error filling deck")
        End Try

    End Sub

    Private Function CardTypeIsStillAvailable(ByVal parameterToFulfill As String) As Boolean

        Dim result As Boolean = False

        Dim i As Integer = 0

        While i < _dtCards.Rows.Count AndAlso Not result

            Dim cardObj As Card = DirectCast(_dtCards.Rows(i).Item(_card), Card)

            Select Case parameterToFulfill

                Case "Favorite"
                    If cardObj.IsFavorite AndAlso Not cardObj.IsIncluded AndAlso VerifyCardDoesNotViolateExclusions(cardObj) Then result = True

            End Select

            i += 1

        End While

        Return result

    End Function

    Private Function CountDeck() As Integer

        Dim includedCards As Integer = 0

        For i As Integer = 0 To _dtCards.Rows.Count - 1

            If DirectCast(_dtCards.Rows(i).Item(_card), Card).IsIncluded Then includedCards += 1

        Next

        Return includedCards

    End Function

    Private Function VerifyCardDoesNotViolateExclusions(ByRef cardObj As Card) As Boolean

        Dim result As Boolean = True

        If cardObj.IsExcluded Then
            result = False
        Else

            If chkIncludeExtraBuy.CheckState = CheckState.Unchecked AndAlso cardObj.IsExtraBuy Then

                result = False

            End If

            If chkMustHaveVictoryCards.CheckState = CheckState.Unchecked AndAlso cardObj.IsVictory Then

                result = False

            End If

            If chkMustIncludeActionSplitter.CheckState = CheckState.Unchecked AndAlso cardObj.IsActionSplitter Then

                result = False

            End If

            If chkMustIncludeAttack.CheckState = CheckState.Unchecked AndAlso cardObj.IsAttack Then

                result = False

            End If

            If chkMustIncludeCurseCard.CheckState = CheckState.Unchecked AndAlso cardObj.IsCurse Then

                result = False

            End If

            If chkMustIncludeDefenseIfAttackIsPresent.CheckState = CheckState.Unchecked AndAlso cardObj.IsDefense Then

                result = False

            End If

            If chkMustIncludeDepthCard.CheckState = CheckState.Unchecked AndAlso cardObj.IsDepth Then

                result = False

            End If

            If chkMustIncludeLeastFavoriteCard.CheckState = CheckState.Checked AndAlso cardObj.IsLeastFavorite Then

                result = False

            End If

            If chkMustIncludeMoneyCard.CheckState = CheckState.Unchecked AndAlso cardObj.IsMoney Then

                result = False

            End If

            If chkMustIncludeTrashCards.CheckState = CheckState.Unchecked AndAlso cardObj.IsTrash Then

                result = False

            End If

            If Not chkAllowCustomCards.CheckState = CheckState.Checked AndAlso _dtCards.Rows(cardObj.m_Index).Item(_expansion) = expansionName.Custom Then

                result = False

            End If

            If Not result Then DirectCast(_dtCards.Rows(cardObj.m_Index).Item(_card), Card).IsExcluded = True

        End If

        Return result

    End Function

    Private Function ReviewDeckForParameter(ByVal parameterName As String) As Boolean

        Dim result As Boolean = False
        Dim alreadyFulfilled As Boolean = False

        Dim i As Integer = 0
        Dim firstSplitter As Boolean = False
        Dim attackFound As Boolean = False
        Dim firstAlchemy As Boolean = False

        While Not alreadyFulfilled AndAlso i < _dtCards.Rows.Count

            Dim cardObj As Card = DirectCast(_dtCards.Rows(i).Item(_card), Card)

            Select Case parameterName

                Case "ExtraBuy"

                    If cardObj.IsExtraBuy Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Victory"

                    If cardObj.IsVictory Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Splitter"

                    If cardObj.IsActionSplitter Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "AdditionalSplitter"

                    If cardObj.IsActionSplitter Then
                        DetermineInclusion(cardObj, result, alreadyFulfilled)

                        If Not firstSplitter AndAlso alreadyFulfilled Then

                            firstSplitter = True
                            result = False
                            alreadyFulfilled = False

                        End If

                    End If


                Case "Attack"

                    If cardObj.IsAttack Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Curse"

                    If cardObj.IsCurse Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Defense"

                    If attackFound Then

                        If cardObj.IsDefense Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                    Else

                        If cardObj.IsAttack AndAlso cardObj.IsIncluded Then
                            attackFound = True
                            i = 0
                        End If

                    End If

                Case "Depth"

                    If cardObj.IsDepth Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Favorite"

                    If cardObj.IsFavorite Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Money"

                    If cardObj.IsMoney Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Trash"

                    If cardObj.IsTrash Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "LeastFavorite"

                    If cardObj.IsLeastFavorite Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Cost2"

                    If cardObj.Cost = 2 Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Cost3"

                    If cardObj.Cost = 3 Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Cost4"

                    If cardObj.Cost = 4 Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "Cost5"

                    If cardObj.Cost = 5 Then DetermineInclusion(cardObj, result, alreadyFulfilled)

                Case "BumpAlchemy"

                    If _dtCards.Rows(cardObj.m_Index).Item(_expansion) = expansionName.Alchemy Then

                        DetermineInclusion(cardObj, result, alreadyFulfilled)

                        If Not firstAlchemy AndAlso alreadyFulfilled Then

                            firstAlchemy = True
                            result = False
                            alreadyFulfilled = False

                        End If

                    End If

                Case "None"

                    DetermineInclusion(cardObj, result, alreadyFulfilled)
                    alreadyFulfilled = result

                Case Else
                    Throw New Exception("Parameter was not recognized")

            End Select

            i += 1

        End While

        If parameterName = "Defense" AndAlso Not attackFound Then alreadyFulfilled = True

        If i = _dtCards.Rows.Count AndAlso Not alreadyFulfilled AndAlso Not result Then
            btnPickEm_Click(Nothing, Nothing)

            If _attemptsToMakeDeck > 99 Then
                Throw New Exception(String.Format("100 Decks attempts exhausted without meeting parameter {0}", parameterName))

            End If

        End If

        Return Not alreadyFulfilled

    End Function

    Private Sub DetermineInclusion(ByRef cardObj As Card, ByRef result As Boolean, ByRef alreadyFulfilled As Boolean)

        If Not cardObj.IsExcluded Then

            If cardObj.IsIncluded Then

                alreadyFulfilled = True

            ElseIf VerifyCardDoesNotViolateExclusions(cardObj) Then

                result = True

            End If

        End If

    End Sub
Some of the code is pretty old as I started work on it when Intrigue came out, so forgive any odd coding quirks I had back then. Also, I think all the check boxes are tri-state, so a null value meant not to worry about this type of parameter.
Anyone who finds the code useful is free to modify and/or use any or all parts of it for this or whatever. Hopefully the control names are self explanatory enough.
pinkymadigan
 
Posts: 36
Joined: 08 Apr 2010, 22:07
Has thanked: 1 time
Been thanked: 0 time

Re: Dominion Source Code (updated Feb 16th, 2011)

Postby pinkymadigan » 19 Jun 2011, 20:20

part 2:

Code: Select all

    Private Sub ClearDeck()

        For Each dr As DataRow In _dtCards.Rows

            DirectCast(dr.Item(_card), Card).IsIncluded = False
            DirectCast(dr.Item(_card), Card).IsExcluded = False

        Next

    End Sub

    Private Sub DetermineSpecialCards()

        Dim prosperityCount As Integer
        Dim alchemyCount As Integer

        For Each cardRow As DataRow In _dtCards.Rows

            Dim cardObj As Card = DirectCast(cardRow.Item(_card), Card)

            If cardObj.IsIncluded Then

                Dim expansion As String = DirectCast(cardRow.Item(_expansion), String)

                Select Case expansion

                    Case expansionName.Prosperity
                        prosperityCount += 1

                    Case expansionName.Alchemy
                        alchemyCount += 1

                End Select

            End If

        Next

        'determine potion inclusion
        If alchemyCount > 0 Then
            txtPotionIn.BackColor = Color.Blue
            txtPotionIn.ForeColor = Color.White
            txtPotionIn.Text = "Potions"
        Else
            txtPotionIn.BackColor = Color.White
            txtPotionIn.ForeColor = Color.Black
            txtPotionIn.Text = "No Potions"
        End If

        'determine plat/colony inclusion
        If chkLink.Checked Then

            Dim r As New Random(Now.Millisecond)
            Dim dieRoll As Integer = (r.Next() Mod 10) + 1

            SetColonyStatus(dieRoll < prosperityCount)
            SetPlatinumStatus(dieRoll < prosperityCount)

        Else

            Dim r As New Random(Now.Millisecond)
            Dim dieRoll As Integer = r.Next() Mod 10 + 1

            SetColonyStatus(dieRoll < prosperityCount)

            dieRoll = (r.Next() Mod 10) + 1

            SetPlatinumStatus(dieRoll < prosperityCount)

        End If

    End Sub

    Private Sub SetColonyStatus(ByVal include As Boolean)

        txtColonyIn.BackColor = If(include, Color.Green, Color.White)
        txtColonyIn.ForeColor = If(include, Color.White, Color.Black)
        txtColonyIn.Text = If(include, "Colonies", "No Colonies")

    End Sub

    Private Sub SetPlatinumStatus(ByVal include As Boolean)

        txtPlatinumIn.BackColor = If(include, Color.Gold, Color.White)
        txtPlatinumIn.Text = If(include, "Platinum", "No Platinum")

    End Sub

#End Region

#Region "event handlers"

    Private Sub btnPickEm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPickEm.Click

        lvCards.Items.Clear()
        _attemptsToMakeDeck += 1
        FulfillInclusions()
        FillRemaining()

        For Each cardRow As DataRow In _dtCards.Rows

            Dim cardObj As Card = DirectCast(cardRow.Item(_card), Card)

            If cardObj.IsIncluded Then
                Dim lvItem As New ListViewItem(cardObj.Name & " - " & DetermineCardCost(cardObj))
                lvItem.SubItems.Add(DirectCast(cardRow.Item(_expansion), String))
                lvCards.Items.Add(lvItem)
            End If
        Next

        DetermineSpecialCards()

        lvCards.ListViewItemSorter = New ListViewAllColumnComparer(SortOrder.Ascending, _sortAlpha)
        lvCards.Sort()
        ClearDeck()
        _attemptsToMakeDeck = 0

    End Sub

    Private Function DetermineCardCost(ByVal cardObj As Card) As String

        Dim result As String = String.Empty

        If cardObj.Cost >= 100 Then

            Dim cost As Integer = cardObj.Cost - 100
            result = cost.ToString + " + Potion"

        Else

            result = cardObj.Cost.ToString()

        End If

        Return result

    End Function

    Private Sub btnSeeFavorites_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeeFavorites.Click

        _childForm = FavoritesList.GetInstance(_dtCards, Me)
        _childForm.Show()
        _childForm.BringToFront()
        _childForm.Location = New Point(Me.Location.X + btnSeeFavorites.Location.X, Me.Location.Y)
        _childForm.Focus()

    End Sub

    Private Sub chkMustIncludeAttack_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkMustIncludeAttack.CheckStateChanged
        chkMustIncludeDefenseIfAttackIsPresent.Enabled = (chkMustIncludeAttack.CheckState = CheckState.Checked OrElse chkMustIncludeAttack.CheckState = CheckState.Indeterminate)
        chkMustIncludeDefenseIfAttackIsPresent.CheckState = chkMustIncludeAttack.CheckState
        chkMustIncludeCurseCard.Enabled = (chkMustIncludeAttack.CheckState <> CheckState.Unchecked)
        If Not chkMustIncludeCurseCard.Enabled Then chkMustIncludeCurseCard.CheckState = CheckState.Indeterminate
    End Sub

    Private Sub chkMustIncludeActionSplitter_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkMustIncludeActionSplitter.CheckedChanged, chkMustIncludeActionSplitter.CheckStateChanged

        If chkMustIncludeActionSplitter.CheckState = CheckState.Checked Then
            chkMustIncludeAdditionalActionSplitter.Enabled = True
        Else
            chkMustIncludeAdditionalActionSplitter.CheckState = CheckState.Unchecked
            chkMustIncludeAdditionalActionSplitter.Enabled = False
        End If

    End Sub

    Private Sub chk_CheckStateChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkIncludeExtraBuy.CheckStateChanged, chkMustHaveVictoryCards.CheckStateChanged, chkMustIncludeActionSplitter.CheckStateChanged, chkMustIncludeAdditionalActionSplitter.CheckStateChanged, chkMustIncludeAttack.CheckStateChanged, chkMustIncludeCurseCard.CheckStateChanged, chkMustIncludeDefenseIfAttackIsPresent.CheckStateChanged, chkMustIncludeDepthCard.CheckStateChanged, chkMustIncludeFavoriteCard.CheckStateChanged, chkMustIncludeLeastFavoriteCard.CheckStateChanged, chkMustIncludeMoneyCard.CheckStateChanged, chkMustIncludeTrashCards.CheckStateChanged

        Dim checkedItemCount As Integer = 0

        For Each c As Control In Me.Controls

            Dim chkControl As CheckBox = TryCast(c, CheckBox)
            If chkControl IsNot Nothing AndAlso chkControl.CheckState = CheckState.Checked Then checkedItemCount += 1

        Next

        nudNumberOfCards.Minimum = checkedItemCount

    End Sub

    Private Sub chkBumpAlchemy_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkBumpAlchemy.CheckedChanged

        If chkBumpAlchemy.CheckState = CheckState.Checked Then
            chkBumpAlc2.Enabled = True
        Else
            chkBumpAlc2.CheckState = CheckState.Unchecked
            chkBumpAlc2.Enabled = False
        End If

    End Sub

#End Region

#Region "Child Classses"

    Public Class Card

        Public Name As String
        Public Cost As Integer
        Public IsAttack As Boolean
        Public IsDefense As Boolean
        Public IsExtraBuy As Boolean
        Public IsActionSplitter As Boolean
        Public IsDepth As Boolean
        Public IsTrash As Boolean
        Public IsVictory As Boolean
        Public IsCurse As Boolean
        Public IsMoney As Boolean
        Public IsFavorite As Boolean
        Public IsLeastFavorite As Boolean
        Public IsIncluded As Boolean
        Public IsExcluded As Boolean
        Public m_Index As Integer

        Public Sub New(ByVal szName As String, ByVal nCost As Integer, ByVal bIsAttack As Boolean, ByVal bIsDefense As Boolean, ByVal bIsExtraBuy As Boolean, ByVal bIsActionSplitter As Boolean, ByVal bIsDepth As Boolean, ByVal bIsTrash As Boolean, ByVal bIsVictory As Boolean, ByVal bIsCurse As Boolean, ByVal bIsMoney As Boolean, ByVal bIsFavorite As Boolean, ByVal bIsLeastFavorite As Boolean)
            Name = szName
            Cost = nCost
            IsAttack = bIsAttack
            IsDefense = bIsDefense
            IsActionSplitter = bIsActionSplitter
            IsCurse = bIsCurse
            IsDepth = bIsDepth
            IsExtraBuy = bIsExtraBuy
            IsFavorite = bIsFavorite
            IsLeastFavorite = bIsLeastFavorite
            IsMoney = bIsMoney
            IsTrash = bIsTrash
            IsVictory = bIsVictory
            IsIncluded = False
            IsExcluded = False
        End Sub

    End Class

    Class ListViewAllColumnComparer
        Implements IComparer

        Private m_SortOrder As SortOrder
        Private _sortCol1First As Boolean

        Public Sub New(ByVal sort_order As SortOrder, ByVal byNameFirst As Boolean)
            m_SortOrder = sort_order
            _sortCol1First = byNameFirst
        End Sub

        ' Compare the sub-items.
        Public Function Compare(ByVal x As Object, ByVal y As _
            Object) As Integer Implements _
            System.Collections.IComparer.Compare

            Dim item_x As ListViewItem = DirectCast(x,  _
                ListViewItem)
            Dim item_y As ListViewItem = DirectCast(y,  _
                ListViewItem)
            Dim string_x As String
            Dim string_y As String

            ' Compare the sub-items.
            For i As Integer = If(_sortCol1First, 0, 1) To item_x.SubItems.Count - 1
                ' See if item y has this sub-item.
                If item_y.SubItems.Count <= i Then
                    ' Item y does not have this sub-item.
                    ' Place it before item x.
                    Return 1
                End If

                ' Compare the sub-items.
                string_x = item_x.SubItems(i).Text
                string_y = item_y.SubItems(i).Text

                If string_x <> string_y Then
                    If m_SortOrder = SortOrder.Ascending Then
                        Return String.Compare(string_x, _
                            string_y)
                    Else
                        Return String.Compare(string_y, _
                            string_x)
                    End If
                End If
            Next i

            ' Item x has run out of sub-items.
            ' See if item y has, too.
            If item_y.SubItems.Count > item_x.SubItems.Count _
                Then
                ' Item y still has sub-items.
                ' Place x before y.
                Return -1
            Else
                ' Items x and y have the exact same
                ' items. They're equal.
                Return 0
            End If
        End Function
    End Class

#End Region

#Region " Properties "
    Public Property CardTable() As DataTable
        Get
            Return _dtCards
        End Get
        Set(ByVal value As DataTable)
            _dtCards = value
        End Set
    End Property
#End Region

    Private Sub btnSort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSort.Click
        If _sortAlpha Then
            btnSort.Text = "Sort Name"
        Else
            btnSort.Text = "Sort Exp."
        End If

        _sortAlpha = Not _sortAlpha
        lvCards.ListViewItemSorter = New ListViewAllColumnComparer(SortOrder.Ascending, _sortAlpha)
        lvCards.Sort()

    End Sub

    Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click

        Dim fd As New OpenFileDialog()
        fd.Title = "Pick file to append list to"
        If fd.ShowDialog() = Windows.Forms.DialogResult.OK Then
            If fd.FileName Like "*txt" Then

                Dim fileWriter As New IO.FileStream(fd.FileName, IO.FileMode.Append)
                Dim newSet As String = vbNewLine + Now.ToString("MM_dd_yyyy hh:mm:ss")
                newSet += ":" + vbNewLine
                For Each item As ListViewItem In lvCards.Items
                    Dim cardName As String = item.Text.Substring(0, item.Text.ToString.IndexOf(" -"))
                    newSet += cardName + vbNewLine
                Next

                Dim bytes As Byte() = New UTF8Encoding().GetBytes(newSet)

                fileWriter.Write(bytes, 0, bytes.Length)
                fileWriter.Close()

                MessageBox.Show("Complete", "Task Complete", MessageBoxButtons.OK)
            Else
                MessageBox.Show("Expected a .txt file...", "Append Error", MessageBoxButtons.OK)
            End If
        End If

    End Sub

End Class
pinkymadigan
 
Posts: 36
Joined: 08 Apr 2010, 22:07
Has thanked: 1 time
Been thanked: 0 time

Re: Dominion Source Code (updated Feb 16th, 2011)

Postby Cogline » 05 Jul 2011, 17:09

When will the new source code containing Cornucopia be available?
Cogline
 
Posts: 5
Joined: 26 Apr 2011, 08:35
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated Feb 16th, 2011)

Postby DickCheney » 29 Dec 2011, 18:22

Jatill,

Could you post the source code for the latest build, that includes Hinterlands?
DickCheney
 
Posts: 2
Joined: 29 Dec 2011, 15:35
Has thanked: 0 time
Been thanked: 0 time

Re: Dominion Source Code (updated Jan 3rd, 2012)

Postby jatill » 03 Jan 2012, 13:59

All set. Sorry for the long delay!
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Previous

Return to Dominion

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 279 on 11 Jul 2013, 22:03

Users browsing this forum: No registered users and 2 guests

Login Form