New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scenario launch options selection #1010
Conversation
9ef9e2b
to
82baf9b
Compare
82baf9b
to
f7bec52
Compare
d8c65b7
to
d39da18
Compare
d39da18
to
f9acda0
Compare
dde6002
to
68fe08f
Compare
c96caa6
to
213ebcd
Compare
towards #866 NOTE: #1116 should be merged first so that the schema change of save files is less disruptive. ## Examples Different criteria can have their own best score: ![image](https://user-images.githubusercontent.com/261693/219904496-fcd23ca0-b208-43e1-afc6-188acfe327cf.png) All criteria share the same single best score: ![image](https://user-images.githubusercontent.com/261693/219904553-abe3011c-41b0-469c-b34d-95d84b91697a.png) ## Behavior notes * As currently designed, the code size will only be scored if the the player has specified their code **before** the scenario begins. Furthermore, any input into the REPL will invalidate code size scoring for the current game. * Because of this, the only way to score code so far is with a command-line argument of `--run` or `--autoplay`. However, #1010 shall implement code size scoring when a scenario is launched from the UI. * In the "best scores" display, if multiple "best score" criteria were all from the same game, they will be consolidated. If all criteria are for the same game, the criteria labels will be omitted. * The code size metrics will not be displayed if a "best score" was not obtained via `--run`. ## Caveats ### `run` command Currently, the code entailed in a `run "somescript.sw"` command is not transitively included, so using `run` make the code size score meaningless. ## Testing ### Unit tests Run the subset of unit tests: scripts/run-tests.sh --test-arguments '--pattern "Tests.Precedence"' ### Manual integration tests First, reset the score: rm -f ~/.local/share/swarm/saves/Tutorials_grab.yaml Saving the following to `grab-soln.sw`: ``` move; move; grab; turn back; move; turn back; move; move; grab; turn back; move; turn back; move; move; grab; turn back; move; turn back; move; move; grab; turn back; move; turn back; move; move; grab; turn back; move; turn back; move; move; grab; ``` Run as follows: scripts/play.sh --scenario Tutorials/grab.yaml --run grab-soln.sw This should establish a record for code size. Then, play the Grab tutorial and immediately paste and run this in the REPL: move; move; grab; move; grab; move; grab; move; grab; move; grab; move; grab; This solution is faster in terms of time, but should not displace the code-length record, since no code length should be recorded from a REPL solution.
213ebcd
to
29c9dc7
Compare
cb72a1a
to
db30f27
Compare
a2cb3e9
to
fae2c52
Compare
ce8cbd8
to
b3b8719
Compare
69f3d2c
to
80f8882
Compare
Cool! Taking a look now! 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, amazing work!
Typing in the initial seed field takes a long time (i.e. it takes a second or two to update after every keypress), I wonder why?
f513ba6
to
700ebfd
Compare
Co-authored-by: Brent Yorgey <byorgey@gmail.com>
Co-authored-by: Brent Yorgey <byorgey@gmail.com>
Co-authored-by: Restyled.io <commits@restyled.io>
700ebfd
to
fe333be
Compare
@kostmo I finally got around to play with this and its great! 👍 Running custom scripts from UI feels like this was always supposed to be the way to do it. 🙂 |
Closes #358 and closes #866.
Allows specification of a seed value and/or the path of a script to run. Specifying a script to run in advance allows eligibility for code size scoring.
Some effort was invested into integrating the Brick
FileBrowser
widget and discovering its idiosyncrasies. This paves the way for more applications ofFileBrowser
within Swarm.Usage
From the scenario selection menu, press the
o
key to pop up a dialog for launch options.Any manually-selected initial-script or seed are persisted to disk and will pre-populate the launch configuration dialog upon the next play. If a certain scenario is subsequently launched the normal way (i.e. by pressing
Enter
instead ofo
), then this clears the saved script path/seed, and the next pop-up of the launch configuration dialog will not see its fields pre-populated.Warning: Save format changed
This PR changes the
ScenarioStatus
datatype, and therefore game status/progress saved previously to this PR will not be recognized. See #974 (comment) for discussion about this situation.