Commit Graph

76 Commits

Author SHA1 Message Date
Jeremy Saklad afbad8b532
Clean up requirements
Declarations that require a specific range of torso style now use one
constraint to model that, rather than two.

Inconsistent whitespace has been cleaned up.

Skipping tails is only possible if there are tails to skip.
2021-07-07 15:12:03 -05:00
Jeremy Saklad 82363c8172
Update fluctuation bonuses for hybrid buyers
The multiplier is now 1/2 instead of 4/5.

This means that is no longer necessary to multiply before dividing.
2021-07-07 14:17:55 -05:00
Jeremy Saklad 76a7effb6e
Add the Enterprising Boot Salesman
This buyer scales with the number of legs on the skeleton.
2021-07-06 14:18:07 -05:00
Jeremy Saklad cf45cd81ce
Add Menace fluctuation
This fluctuation affects buyers similarly to the existing fluctuations,
and uses a similar implementation as a result.
2021-07-06 13:19:29 -05:00
Jeremy Saklad 283bf92243
Add bird fascination for Diplomat
This fascination effectively requires a Bird declaration, and scales
with all three skeleton attributes multiplied together.
2021-07-06 12:33:03 -05:00
Jeremy Saklad 673b6160c6
Define DiplomatFascination functionally
Rather than laboriously replicating every fascination the Trifling
Diplomat has, the script now exploits the consistent member names to
generate the list automatically.

This should not have any effect on usage, but will ease future
maintainance.
2021-07-06 12:18:49 -05:00
Jeremy Saklad 9b7162527d
Add DiplomatFascination to public interface
Its prior exclusion was a mistake: this is necessary to use Solve.
2021-07-06 12:05:10 -05:00
Jeremy Saklad dc75b4d157
Fix missing variable name 2021-07-06 11:42:20 -05:00
Jeremy Saklad 0c08586f24
Remove unnecessary use of setattr()
If an attribute is referenced using a string literal, there is no reason
to use setattr().
2021-07-06 11:27:13 -05:00
Jeremy Saklad 3a97dba0cb
Change names of DiplomatFascination members
The new names are more consistent with other enumerations, namely
Declaration and Fluctuation.
2021-07-06 11:25:15 -05:00
Jeremy Saklad a2e8fe8b62
Add fossilised fish fascination for Diplomat
This fascination effectively requires a Fish declaration, and scales
with all three skeleton attributes multiplied together.
2021-06-29 15:56:42 -05:00
Jeremy Saklad dd01457cc4
Fix description of Zoological Mania option
Not all declarations have a 10% bonus associated with them.
2021-06-25 18:40:39 -05:00
Jeremy Saklad 7a6a0697e3
Add the Trifling Diplomat
This buyer actually changes based on a world quality. As such, it has
been implemented in a similar fashion to Occasional Buyer.

The scaling for this buyer's difficulty level has not been established
at the time of this writing, so it is being treated as 0.
2021-06-25 18:37:41 -05:00
Jeremy Saklad b13c416d5e
Stop requiring desired buyers or occasional buyer
If no occasional or desired buyers are specified, the script will choose
from among the buyers that are definitely present.
2021-06-25 17:37:32 -05:00
Jeremy Saklad d09e43bedb
Simplify and normalize argument parsing
The script now uses dictionary unpacking to pass arguments, rather than
explicitly listing each one.

The parser now suppresses missing parameters by default. This means that
the default values of the Solve function can be taken advantage, rather
than having to repeat them for the parser's sake.
2021-06-25 17:11:43 -05:00
Jeremy Saklad 7565f30d32
Update formula for Zoological Mania bonus
Certain declarations now have their value boosted by 15% during
Zoological Mania, rather than just 10%.

The list of declarations is currently hardcoded, and may need to be
updated in the future.
2021-06-24 08:45:59 -05:00
Jeremy Saklad f7c8753c12
Update fluctuation effects on hybrid buyers
The formula for hybrid buyers has been changed to make the fluctuation
bonus scale with the corresponding attribute.
2021-06-22 09:04:41 -05:00
Jeremy Saklad a860c8acde
Add the Ingenuous Malacologist
This buyer scales with the number of tentacles on the skeleton.
2021-06-22 08:25:12 -05:00
Jeremy Saklad 4d6220a25a
Update exponent of quadratic buyers with boost
Quadratic buyers now use a power of 2.1 rather than 2.2 when affected by
Bone Market Fluctuations.
2021-06-22 05:45:33 -05:00
Jeremy Saklad de85deb48d
Fix crash due to terminal overflow
The program will now scroll the screen when outputting intermediate
solutions without sufficient space, rather than crashing.
2021-06-19 08:21:37 -05:00
Jeremy Saklad afeabe603a
Fix whitespace 2021-06-19 08:21:37 -05:00
Jeremy Saklad b7f47da9d0
Add command-line parameter for Shadowy level
This argument determines how difficult selling to a buyer is, which
influences how much Implausibility the solver produces.
2021-06-19 08:21:30 -05:00
TheTaques eb94bb3b44
Add command-line parameter for workers
This allows users to adjust the number of CPU threads that the solver uses, which may be useful if you want to leave it running while you use it.
2021-06-18 16:18:40 -05:00
Jeremy Saklad a8b835aba3
Add module-level information
A docstring has been added describing the module's purpose.

__all__ has been added. It is limited to the declarations needed to use
Solve().

The author's name has been added.
2021-06-18 15:28:56 -05:00
Jeremy Saklad aee575848b
Only run main() if program is run directly
Checking that __name__ is "__main__" prevents main() from being run if
this script is imported as a module.
2021-06-18 15:13:03 -05:00
Jeremy Saklad 4808f23a98
Clean up imports
Imports are now sorted lexicographically, and import specific
declarations when appropriate.
2021-06-18 15:08:28 -05:00
Jeremy Saklad 7e259e3d69
Use docstrings instead of comments if appropriate
Unlike comments, docstrings support runtime introspection and other
features.

The docstrings are arguably a bit sparse, but this is sufficient for the
time being.
2021-06-18 14:44:30 -05:00
Jeremy Saklad 65fa45eac7
Fix identifier for torso style variable
The previous identifier used an underscore instead of a space to
separate the words.
2021-06-18 13:49:44 -05:00
Jeremy Saklad ebdc1cd803
Standardize quotes across script
Single quotes are used for identifiers.

Double quotes are used for strings that are meant to be read by users.
2021-06-18 13:48:20 -05:00
Jeremy Saklad f60adb09a8
Fix line breaks in enumerations 2021-06-18 13:47:09 -05:00
Jeremy Saklad c6c04c1025
Count starting limbs in cost of adding joints
Some torsos, notably the Headless Skeleton, come with pre-filled limbs
that must be factored into the calculation.
2021-06-17 11:26:24 -05:00
Jeremy Saklad 244e87e4bf
Change Knotted Humerus value
It has been buffed.
2021-06-17 11:13:48 -05:00
Jeremy Saklad 4025cc2b3f
Adjust values to reflect recent changes
There have been a few nerfs to various overpowered sources and
components.
2021-06-17 08:30:48 -05:00
Jeremy Saklad 5a43e0c9e6
Add ability to specify multiple buyers at once
Users can now specify multiple buyers, allowing the solver to figure out
the best skeleton that could be sold to any of them. This could be
useful for buyers that share a payout.
2021-06-16 17:28:16 -05:00
Jeremy Saklad 9b47e777b4
Fix Exhaustion of Colourful Phantasist
The Colourful Phantasist includes the minimum secondary reward in the
exhaustion formula.
2021-06-16 15:53:10 -05:00
Jeremy Saklad 3032ec320a
Add command-line parameter for occasional buyers
Some buyers are only available based on a world quality. The solver now
skips buyers if they are not available. This is specified using a new
parameter, which is mutually-exclusive with specifying a specific
buyer.

If no buyer is specified, this world quality must be specified instead to tell
the solver who is around.
2021-06-16 15:30:48 -05:00
Jeremy Saklad 2dd7643909
Add command-line parameter for time limit
You can now pass an optional time limit to the script, which causes the
solver to return the best solution it has once the duration has elapsed.
2021-06-16 11:32:05 -05:00
Jeremy Saklad 29238cd245
Change minimum of Phantasist's derived exhaustion
If the minimum is 0, then that value will never be allowed to be
negative. Since it is calculated even when that is not the selected
buyer, that prevents overcorrections that should be permitted.
2021-06-15 17:48:41 -05:00
Jeremy Saklad 12fa917088
Add hints and assumptions
The solver now starts by trying to solve without adding joints or declaring
skeletons chimeras.

Desired buyers are now set as an assumption rather than a linear
expression.
2021-06-15 17:27:59 -05:00
Jeremy Saklad 3b13e9c25f
Show current best skeleton while calculating
So long as verbose mode is not active, the script will now display the
current skeleton as it tries to search for more solutions.

This feature uses the curses module to create an alternate screen, so
intermediate solutions are not sent to standard output.
2021-06-15 16:50:28 -05:00
Jeremy Saklad b75d412cb7
Move solution printing to special class
This class has the advantage of being usable as a solution printer,
which can print each solution as they are generated. This tends to be
extremely verbose, but may prove useful for debugging.
2021-06-15 15:06:54 -05:00
Jeremy Saklad e08b9b07cb
Fix cost of disguising amalgamy
"Disguise the amalgamy of this piece" consumes 25 Jade Fragments, not 1.
2021-06-15 08:30:21 -05:00
Jeremy Saklad 4184468f1d
Add Celestial option of Colourful Phantasist
This buyer scales with the product of implausibility and antiquity.
2021-06-15 07:10:20 -05:00
Jeremy Saklad 70b02586b7
Add Nocturnal option of Colourful Phantasist
This buyer scales with the product of implausibility and menace.
2021-06-15 07:02:49 -05:00
Jeremy Saklad c80b61ba6c
Add Bazaarine option of Colourful Phantasist
This buyer scales with the product of implausibility and amalgamy.
2021-06-15 06:56:05 -05:00
Jeremy Saklad 1c02d9892e
Add The Carpenter's Granddaughter
This buyer produces a Leviathan Frame, and is rather unlikely to ever be
profitable. However, the solver can reduce costs as much as possible.
2021-06-13 22:00:34 -05:00
Jeremy Saklad 36fa9c3e2e
Fix cost of Ribcage with Eight Spines
It was missing a Skeleton with Seven Necks.
2021-06-13 21:05:04 -05:00
Jeremy Saklad 3c210cbaba
Add CLI
Instead of using hardcoded parameters, this script now uses argparse to
offer a command-line interface.

This includes help text, short and long option specifiers, and control
over everything from verbosity to the current world qualities.

Occasional Buyer hasn't been implemented yet, but will eventually be a
required parameter.
2021-06-13 19:40:11 -05:00
Jeremy Saklad d571167742
Make buyers part of model
Buyers are now part of the model, rather than being fixed. This means
that the model can choose from among all buyers and determine the most
profitable option.

Accomplishing this meant replacing the if-else control flow with a large
quantity of half-reified constraints.
2021-06-13 17:37:39 -05:00
Jeremy Saklad 52a509bd19
Add Action values for buyers
This will allow buyers to be variable rather than fixed, and increase
the orthogonality of the code.
2021-06-13 14:58:51 -05:00