Comments (13)
Got it. That's really nice, actually. It maintains the invariant that to-draw is only called with worlds for which stop-when returns true. This is straightforward to add.
from code.pyret.org.
Poking since this will likely become a higher priority as spyret progresses...
from code.pyret.org.
Can you say a sentence about spec for this, like where this last-picture gets rendered? Does it just stay up in the big-bang window, or does it get shown at the REPL or somewhere else?
@sorawee added close-when-stop
, which controls whether or not the big-bang window stays open on a stop-when, and it stays open on the first frame for which stop-when
returned false. Is that accomplishing the same thing?
For example, if I do:
big-bang(0, [list: on-tick(lam(w): w + 1 end), to-draw(lam(w): text(tostring(w), 24, "black") end), stop-when(lam(w): w > 15 end)])
The final frame shows 16
, not 15
. Is this the goal?
from code.pyret.org.
from code.pyret.org.
Just curious: can't normal big-bang do this already, using a combination of on-tick
, stop-when
, and to-draw
? This is basically what I did for Rocket (CS19 assignment) to get the same functionality as this last-picture
.
from code.pyret.org.
@sorawee yes, this doesn't add new expressiveness. However, it's useful that last-picture doesn't need to be the same as what to-draw would generate, so the to-draw function can be written to only consider the non-stopping range of values.
from code.pyret.org.
@sorawee I had this added to Racket because in its absence, you have to engage in a complex encoding that is inaccessible to most beginners. (For instance, sometimes you have to augment your notion of state — your world becomes a conditional of "game in progress" vs "game over". Not only does every single handler then has to have a cases
, worst of all, most handlers will never see the "game over" state: so the only thing they can say in that branch of the cases
is "should not get here and if I do, I have no idea what to do".)
Since it's very natural for students to want to put up a splash screen when their game finishes (you won! you lost! your score is …!), this is a key feature to make nicer-feeling games accessible.
from code.pyret.org.
Dupe of brownplt/pyret-lang#808?
from code.pyret.org.
@blerner Not quite. The main thrust of that report is the semantics of when the handlers are called; last-picture
is a bit of a side-track from that:
brownplt/pyret-lang#808 (comment)
The main thrust of this is to add a last-picture
feature at all.
from code.pyret.org.
There's a PR for this at #218
from code.pyret.org.
big-bang
has been deprecated, no? If so, let's close this. If not, what else needs to be done with the PR?
from code.pyret.org.
Before you close, confirm that it's not a problem with reactor
.
from code.pyret.org.
@shriram I can confirm that this is implemented (and then some!) in reactors. Closing, but feel free to reopen if you disagree
from code.pyret.org.
Related Issues (20)
- Add unicode ellipses (…, U+2026) to the auto-expand/replace list
- test block with no tests, and test counts HOT 1
- difference in presentation of incomparability error HOT 6
- Chart package: residuals HOT 18
- `color` does not enforce refinements HOT 3
- Should give more nudging to save a copy on shared files
- “Cancel”/“close” distinction
- Hide the import code in the publish menu
- overlay adding unecessary pixels? HOT 2
- add pi, E and e to constants context
- Pyret Blocks (tracking issue) HOT 8
- modal-prompt.js changes don't get into build HOT 3
- essentials2021 context now exports e HOT 1
- Some chart functions run out of colors (likely array index issue) HOT 6
- Can HTML entities also be replaced? HOT 2
- modes should work for categorical data HOT 7
- Choose context button blindly grabs the text after the first 11 chars HOT 1
- Don't break use-context shared-gdrive if a file is renamed HOT 5
- More Stats Functions HOT 1
- Need to make some blocks/ tests HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code.pyret.org.