[libre-riscv-dev] Fw: [long, probably pointless] Take me out to the ballgame...

Scheming Pony scheming-pony at protonmail.com
Mon Feb 17 22:36:10 GMT 2020


Cross posted to MIT/Scheme dev list:

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Monday, February 17, 2020 10:24 PM, Scheming Pony <scheming-pony at protonmail.com> wrote:

> This whole thing started when some punk said MIT/Scheme had no applications. I <3 Edwin, man. I'm still working on that baseball program (Fenway park model). I'm channeling Torvalds or Ty Cobb or someone today.
>
> ;;; Code to animate a projectile, simulating a baseball in flight, for MIT Scheme 9.4
> ;;;
> ;;; Uses the Vizajo interface (via FFI) to Pikturo (Open Inventor compatible library).
> ;;;
> ;;; Loads a scene from the file "project-1-scene.iv", a Pikturo scene graph.
> ;;;
> ;;; Utilizes code from Project 1 for the ball physics (in "final-project-physics.scm")
>
> (declare (usual-integrations))
> (load-option 'FFI)
>
> (load "final-project-physics.scm")
>
> ;; TODO: there must be a simpler way to find a
> ;; TODO: file to load in the system library directory
> (with-working-directory-pathname
> (->namestring (system-library-directory-pathname))
> (lambda ()
> (load "vizajo-mit.scm")))
>
> (C-include "vizajo-mit")
>
> ;; format does not have the ability to put in leading zeros
> ;; for a fixed length integer, so we have this function to do it
> (define (build-image-path prefix frame ext)
> (string-append prefix
> "-"
> (cond ((<= frame 9) "00")
> ((<= frame 99) "0")
> (else ""))
> (write-to-string frame)
> ext))
>
> ;; the update procedure for the physics "trajectory" procedure
> (define (output-frames path fmt w h)
> (let ((ext (cond ((= fmt vizajo:file-PostScript) ".ps")
> ((= fmt vizajo:file-RGB) ".rgb")))
> (node-name "ball_translation")
> (field-name "translation")
> (frame 0))
> (define (position-ball x y u v t)
> (let* ((image-path
> (build-image-path path frame ext))
> (translation
> (string-append "0 "
> (write-to-string y) " "
> "-" (write-to-string x)))
> (ret-val (C-call "vizajo_set_field_value" node-name
> field-name
> translation))
> (field-val-alien (make-alien '(* char))))
> (C-call "vizajo_get_field_value" field-val-alien
> node-name field-name) ; TODO: leaks, should free returned string
> (display "set-translation ") (display translation) (newline)
> (display "translation=") (display (c-peek-cstring field-val-alien)) (newline)
> (if (= 1 ret-val)
> (C-call "vizajo_snapshot" image-path fmt w h 0)
> (error "could not set field value"))
> (set! frame (+ frame 1))))
> (trajectory 0 1 45 45 position-ball)))
>
> ;; main procedure of the program
> (define (main args)
> (let* ((file-format-arg (cadr args))
> (file-format (cond ((string=? file-format-arg "PS")
> vizajo:file-PostScript)
> ((string=? file-format-arg "RGB")
> vizajo:file-RGB)
> (else (error "invalid file format")))))
> ;; glX can cause floating point underflow exceptions, defer them
> (flo:defer-exception-traps!)
>
> (C-call "vizajo_startup")
>
> (let* ((input-iv-path (caddr args))
> (image-prefix (cadddr args))
> (scene-read-return (C-call "vizajo_read_scene" input-iv-path)))
> (if (= 1 scene-read-return)
> (output-frames image-prefix
> file-format
> 1280
> 720)
> (error "could not read scene file")))
> (C-call "vizajo_shutdown")))
>
> ;; bootstrap the program
> (main (list "" "PS" "./final-project-fenway-park.iv" "play-ball"))
>
> ---- from the other mailing list ----
>
> Sigh...I worked on a telemetry project at Cessna Aircraft, hardware telemetry for monitoring flight tests--a safety critical development area. Our system gave ground engineers visualization of the critical flight parameters so test pilots wouldn't lose control going into flutter. That's what I thought you were talking about, and probably what I should be working on. We almost lost a few. I ain't got no problem with Microsoft, my brother-in-law is feeding 6 other people and living a great life, which he damn well deserves.
>
> When I booted one of the first IBM PCs in my basement in '82, and wrote one of the first fantasy baseball apps (I'll elide the provenance--I still haven't heard back from the MOMA on that one) I had an instant on system
>
> > 10 print "Take me out to the ballgame! Buy me some peanuts..."
> > 20 goto 10
> > run
>
> Nobody watching me, no compromises, just a pure creation engine. I want to get back to that. I couldn't believe the ensuing platform wars. I'm tired of fighting other people's crap wars, and even thinking about it. I'll sit here at #106 Scheming Pony Way and write the damn thing myself if I have to. Nobody even seems to be listening to me anyway.
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Stewart Milberger
>
>  ^|||^
>  \. ./ Scheming
>   | |  Pony
>   { }
>
> Sent with ProtonMail Secure Email.




More information about the libre-riscv-dev mailing list