Class DominionSetGenerator
Defined in: dominionSetGenerator.js.
Constructor Attributes  Constructor Name and Description 

Creates a DominionSetGenerator.

Method Attributes  Method Name and Description 

attrAlways(attr)
Set the given attribute to 'Always'  try hard to pick these
cards (by a factor of 10, currently).


attrAvoid(attr)
Set the given attribute to 'Avoid'  don't pick these cards
if at all possible.


attrDense(attr, importance)
Set the given attribute to 'Dense'  try to pick so that the
attribute either doesn't show up or shows up en masse.


attrFewer(attr)
Set the given attribute to 'Fewer'  try to not pick these
cards (by a factor of 10, currently).


attrMore(attr)
Set the given attribute to 'More'  don't pick these cards
if at all possible.


attrRange(attr, min, max, importance)
Set the given attribute to 'Range'  try to pick so that the
attribute shows up in a certain range.


attrSparse(attr, importance)
Set the given attribute to 'Sparse'  try to pick so that the
attribute either doesn't show up or shows up en masse.


clearLog()
Clears the internal log.


clearSet()
Clear the current set.


completeSet(maxSetSize)
Fill out a set of cards, assuming that the internal set is partially done.


Dumps the internal log to the Javascript Console (as multiple lines).


generateSet(maxSetSize)
Generate a new set of cards, using the most current values.


getAttributeData(attr)
Get the current data for the given attribute.


Gets the effect strength of the "balanced" generator.


Gets the set that is currently being generated.


Gets the set that is currently being generated, in Goko camelCase form.


getLog()
Gets the internal log.


Gets the size of the set to be generated.


Should we have Platinum/Colony in this game?
Note that this only changes when the set is regenerated.


Should we have Platinum/Colony in this game?
Note that this only changes when the set is regenerated.


Should we use shelters in this game?
Note that this only changes when the set is regenerated.


Should we use shelters in this game?
Note that this only changes when the set is regenerated.


What is the Bane for Young Witch?
Note that this only changes when the set is regenerated.


What is the Bane for Young Witch? (Goko format)
Note that this only changes when the set is regenerated.


putIntoSet(cards)
Put in some cards into the set.


Reset the current data for all attributes.


resetAttribute(attr)
Reset the current data for the given attribute to
the original (internal) value.


setAttributeData(attr, data)
Set the current data for the given attribute.


setBalanceFactor(value)
Sets the effect strength of the "balanced" generator.


setOwned(data)
Tells the generator what cards are 'owned'.

Class Detail
DominionSetGenerator()
Creates a DominionSetGenerator. The same SetGenerator can be used to
generate multiple sets.
Method Detail
attrAlways(attr)
Set the given attribute to 'Always'  try to not pick these
cards (by a factor of 10, currently).
 Parameters:
 {String} attr
 Which attribute to set.
attrAvoid(attr)
Set the given attribute to 'Avoid'  don't pick these cards
if at all possible.
 Parameters:
 {String} attr
 Which attribute to set.
attrDense(attr, importance)
Set the given attribute to 'Dense'  try to pick so that the
attribute either doesn't show up or shows up en masse.
 Parameters:
 {String} attr
 Which attribute to set.
 {Number} importance
 The multiplier for this attribute.
attrFewer(attr)
Set the given attribute to 'Fewer'  try to not pick these
cards (by a factor of 10, currently).
 Parameters:
 {String} attr
 Which attribute to set.
attrMore(attr)
Set the given attribute to 'More'  don't pick these cards
if at all possible.
 Parameters:
 {String} attr
 Which attribute to set.
attrRange(attr, min, max, importance)
Set the given attribute to 'Range'  try to pick so that the
attribute shows up in a certain range.
 Parameters:
 {String} attr
 Which attribute to set.
 {Number} min
 Try to add cards to make the set exceed this value.
 {Number} max
 Try not to add cards that make the set exceed this value.
 {Number} importance
 The multiplier for this attribute.
attrSparse(attr, importance)
Set the given attribute to 'Sparse'  try to pick so that the
attribute either doesn't show up or shows up en masse.
 Parameters:
 {String} attr
 Which attribute to set.
 {Number} importance
 The multiplier for this attribute.
clearLog()
Clears the internal log.
clearSet()
Clear the current set.
{Object}
completeSet(maxSetSize)
Fill out a set of cards, assuming that the internal set is partially done.
 Parameters:
 {Number} maxSetSize
 Number of cards to put in the set.
 Returns:
 {Object} An Object where all the keys are the cards that are chosen. (The values will be 1, but we might change this to something more fancy in the future).
dumpLogToConsole()
Dumps the internal log to the Javascript Console (as multiple lines).
{Object}
generateSet(maxSetSize)
Generate a new set of cards, using the most current values.
 Parameters:
 {Number} maxSetSize
 Number of cards to put in the set.
 Returns:
 {Object} An Object where all the keys are the cards that are chosen. (The values will be 1, but we might change this to something more fancy in the future).
{DominionSetGeneratorAttributeData}
getAttributeData(attr)
Get the current data for the given attribute.
 Parameters:
 {String} attr
 Which attribute to get.
 Returns:
 {DominionSetGeneratorAttributeData} The data for the given attribute.
{Number}
getBalanceFactor()
Gets the effect strength of the "balanced" generator.
 Returns:
 {Number} The balance factor.
{Object}
getCardset()
Gets the set that is currently being generated.
Note that
generateSet() returns the set anyway, so you might never need
to call this unless you need to see the same set again.
 Returns:
 {Object} The set of cards, in the form of an Object where the keys are Strings with the names of cards.
{Object}
getGokoCardset()
Gets the set that is currently being generated, in Goko camelCase form.
Note that
generateSet() returns the set anyway, so you might never need
to call this unless you need to see the same set again.
 Returns:
 {Object} The set of cards, in the form of an Array where the contents are Strings with the names of cards.
{String}
getLog()
Gets the internal log.
 Returns:
 {String} The internal log as one long string, with internal linebreaks.
{Number}
getMaxSetSize()
Gets the size of the set to be generated.
 Returns:
 {Number} The size of the set to be generated.
{Boolean}
getPlatinumColony()
Should we have Platinum/Colony in this game?
Note that this only changes when the set is regenerated.
The official rules don't specify what to do when there are
more than 10 cards in the set (such as for veto mode), so
we calculate it based on all the cards in the set (but not
the Bane for the Young Witch). Note that this means it is
theoretically possible for there to be Platinum/Colony but no
Prosperity cards in a veto game.
 Returns:
 {Boolean} Whether to use Platinum/Colony.
{Boolean}
getPlatinumColonyDonline()
Should we have Platinum/Colony in this game?
Note that this only changes when the set is regenerated.
This uses "Donline rules", where the choice of whether to
use is based on the proportion of total cards owned.
 Returns:
 {Boolean} Whether to use Platinum/Colony.
{Boolean}
getUseShelters()
Should we use shelters in this game?
Note that this only changes when the set is regenerated.
The official rules don't specify what to do when there are
more than 10 cards in the set (such as for veto mode), so
we calculate it based on all the cards in the set (but not
the Bane for the Young Witch). Note that this means it is
theoretically possible for there to be shelters but no
Dark Ages cards in a veto game.
 Returns:
 {Boolean} Whether to use Shelters.
{Boolean}
getUseSheltersDonline()
Should we use shelters in this game?
Note that this only changes when the set is regenerated.
This uses "Donline rules", where the choice of whether to
use is based on the proportion of total cards owned.
 Returns:
 {Boolean} Whether to use Shelters.
{Boolean}
getYoungWitchBane()
What is the Bane for Young Witch?
Note that this only changes when the set is regenerated.
Also, sets that don't have a Young Witch still have a Bane
(in case it's needed for Black Market or some other weird card).
 Returns:
 {Boolean} Whether to use Shelters.
{Boolean}
getYoungWitchBaneGoko()
What is the Bane for Young Witch? (Goko format)
Note that this only changes when the set is regenerated.
Also, sets that don't have a Young Witch still have a Bane
(in case it's needed for Black Market or some other weird card).
 Returns:
 {Boolean} Whether to use Shelters.
{Object}
putIntoSet(cards)
Put in some cards into the set.
 Parameters:
 {Object} cards
 An Object where the keys are the cards that have to be put into the set. A card will be considered a "match" if after being changed to all lowercase with nonalphanumeric characters removed, it is the same string in sgd.cardNames. For example, "Worker's Village" matches "workersvillage".
 Returns:
 {Object} An Object where the keys are the cards that weren't understodd.
resetAllAttributes()
Reset the current data for all attributes.
resetAttribute(attr)
Reset the current data for the given attribute to
the original (internal) value.
 Parameters:
 {String} attr
 Which attribute to set.
setAttributeData(attr, data)
Set the current data for the given attribute.
 Parameters:
 {String} attr
 Which attribute to set.
 {DominionSetGeneratorAttributeData} data
 The data for the given attribute.
setBalanceFactor(value)
Sets the effect strength of the "balanced" generator.
The default value is 1.0; set this to 0.0 to get a
generator that weights everything uniformly. Set this
to a larger number to really exaggerate the selection
towards balanced sets, and set this to a negative number
to skew away from balanced sets.
 Parameters:
 {Number} value
 The balance factor.
{Object}
setOwned(data)
Tells the generator what cards are 'owned'.
Cards that are
not owned have zero chance of being picked (as opposed to
the 'Try to Exclude' setting, which sets the probability of being
picked to be very small but not zero).
Note that if you own fewer cards than the size of the set, the
generator may give unexpected results!
 Parameters:
 {Object} data
 An Object where the keys are the names of the cards 'owned'.
 Returns:
 {Object} An Object where the keys are the cards that weren't understodd.