Coder Social home page Coder Social logo

Comments (13)

jpolitz avatar jpolitz commented on July 29, 2024 1

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.

schanzer avatar schanzer commented on July 29, 2024

Poking since this will likely become a higher priority as spyret progresses...

from code.pyret.org.

jpolitz avatar jpolitz commented on July 29, 2024

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.

schanzer avatar schanzer commented on July 29, 2024

See http://docs.racket-lang.org/teachpack/2htdpuniverse.html#%28form._world._%28%28lib._2htdp%2Funiverse..rkt%29._stop-when%29%29

from code.pyret.org.

sorawee avatar sorawee commented on July 29, 2024

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.

jpolitz avatar jpolitz commented on July 29, 2024

@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.

shriram avatar shriram commented on July 29, 2024

@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.

blerner avatar blerner commented on July 29, 2024

Dupe of brownplt/pyret-lang#808?

from code.pyret.org.

shriram avatar shriram commented on July 29, 2024

@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.

schanzer avatar schanzer commented on July 29, 2024

There's a PR for this at #218

from code.pyret.org.

schanzer avatar schanzer commented on July 29, 2024

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.

shriram avatar shriram commented on July 29, 2024

Before you close, confirm that it's not a problem with reactor.

from code.pyret.org.

schanzer avatar schanzer commented on July 29, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.