News:

Welcome to RetroCoders Community

Main Menu

mishka's clock

Started by ron77_db, Apr 01, 2022, 12:03 PM

Previous topic - Next topic

ron77_db

#lang "qb"
'_TITLE "THE MATHEMATICAL ANALOG CLOCK VERSION 3 - WITHOUT CALIBRATION"
SCREEN 12
'DEVELOPED 2/17/2019 IN QBASIC BY RON77 AND MISHKA AND ITAY :)
'screen half with & height
const SHW = 640 \ 2
const SHH = 480 \ 2
const pi = 3.14159265
const RAD_PER_DEG = 2 * pi / 360

Sub clock()
   DO
      '
      hour = VAL(LEFT$(TIME$, 2))
      minute = VAL(MID$(TIME$, 4, 2))
      sec = VAL(RIGHT$(TIME$, 2))

      hour = hour + minute / 60 + sec / 3600
      minute = minute + sec / 60

      ts = 90 - sec * 6
      tm = 90 - minute * 6
      th = 90 - hour * 30

      CLS
      PRINT TIME$
      PRINT "press ESC to exit  "

      CIRCLE (SHW, SHH), 200
      CIRCLE (SHW, SHH), 215
      'draw minute marks
      FOR j = 0 TO 59
         cosangle = COS((90 - j * 6) * RAD_PER_DEG)
         sinangle = SIN((90 - j * 6) * RAD_PER_DEG)
         LINE (SHW + 190 * cosangle, SHH - 190 * sinangle)-(SHW + 200 * cosangle, SHH - 200 * sinangle), 10
      NEXT
      'draw hour marks
      FOR i = 0 TO 11
         cosangle = COS((90 - i * 30) * RAD_PER_DEG)
         sinangle = SIN((90 - i * 30) * RAD_PER_DEG)
         LINE (SHW + 205 * cosangle, SHH - 205 * sinangle)-(SHW + 210 * cosangle, SHH - 210 * sinangle), 12
      NEXT
      'draw pointers
      LINE (SHW, SHH)-(SHW + 200 * COS(ts * RAD_PER_DEG), (SHH - 200 * SIN(ts * RAD_PER_DEG)))
      LINE (SHW, SHH)-(SHW + 180 * COS(tm * RAD_PER_DEG), (SHH - 180 * SIN(tm * RAD_PER_DEG))), 10
      LINE (SHW, SHH)-(SHW + 120 * COS(th * RAD_PER_DEG), (SHH - 120 * SIN(th * RAD_PER_DEG))), 12
      SLEEP (1)

      k$ = INKEY$
   LOOP UNTIL k$ = CHR$(27)
END SUB

clock()

CharlieJV

Thanks for sharing that program.  This kind of stuff tickles me something silly.

I figured I'd show a slightly tweaked BASIC Anywhere Machine version, just because I think BAM can be a great little sidekick for "big/robust" (and rocking) BASIC implementations like FreeBASIC.

BAM as single-html-file source code manager/repository and export tool for run-pretty-much-anywhere testing of small code segments and/or deployment (web/local/wherever) small programs created in FreeBASIC:  I can write more about that if and when anybody is interested.


The clock:


ron77

hello CharlieJV

nice HTML/js interpreter for basic you have there... however it cannot read/write files nor does it has simple types of freeBASIC - this is why you cannot compare an interpreter to a compiled language... and btw this is a "RETRO PROGRAMMING" forum, and your HTML/js interpreter looks like and feels like a toy compared to the real thing...

I'm sorry maybe it's just me but why would I use your TiddlyWiki toy when I got the real thing?

anyway... welcome to retrocoders community

CharlieJV

#3
Quote from: ron77 on Sep 19, 2022, 12:20 PMhello CharlieJV

nice HTML/js interpreter for basic you have there... however it cannot read/write files nor does it has simple types of freeBASIC - this is why you cannot compare an interpreter to a compiled language... and btw this is a "RETRO PROGRAMMING" forum, and your HTML/js interpreter looks like and feels like a toy compared to the real thing...

I'm sorry maybe it's just me but why would I use your TiddlyWiki toy when I got the real thing?

anyway... welcome to retrocoders community

Whoever would think that BAM is a replacement for any other BASIC implementation, she/he would be out to lunch.

  • The nature of the browser beast.  For example: The "security constraints" of web browsers hampering access to the local file system.  (There may be API improvements in the future, but it will never be the same as an installed BASIC that has full access to the machine via the OS.)


On the flipside, whoever would think that some other BASIC implementation is a replacement for BAM, she/he would be out to lunch.

BAM is a BASIC implementation for folk who want an ultra-portable ultra-crossplatform BASIC that works in any web browser (offline as well as online).

AND/OR

BAM is a TiddlyWiki that can be used to manage source code, as one would manage any info/knowledge/documentation/etc. in any Wiki.  But it is a wiki that has a built-in interpreter that can run BASIC programs.  So you have a portable repository of source code that you can access on any device with a web browser, and can create/edit programs on any machine that has a web browser.  So portability when you are away from your main programming device.

AND/OR

It is a packager to take a BASIC program and bundle it along with the interpreter into a small single HTML file (i.e. without TiddlyWiki, just the BASIC program, the interpreter, and the necessaries for an HTML page), so that you can distribute that program to anybody to run in a web browser on any device.  So no need to have a device with an install of whatever BASIC implementation.

AND/OR

Portable prototyping "bottle garden"?

AND/OR

You are setting up a school research project about trigonometric functions, and you are using TiddlyWiki as the engine for a related slideshow, with embedded BASIC programs to show how those trig functions behave via graphs.  All in one file on a USB thumbdrive, which you can then plug into whatever device to do your presentation.

So doesn't matter what kind of device, doesn't matter what kind of operating system.  Just need a web browser.

Yadda yadda.  I don't know how to say all of that in a short one-liner.

But yeah: BAM is not meant to be a replacement for any BASIC implementation.  It is a very unique BASIC meant to exist in a web browser (OFFLINE as well as ONLINE).

So very good for that purpose, but also very good as an ultra-portable sidekick for any other BASIC implementation.  (at the moment, constrained to the boundaries of a web browser.)  For those interested in having access to BASIC anywhere to develop/test/share.

Something like that.  My thinking is a work in progress ...

(Aside: I plan to only ever talk about BASIC Anywhere Machine in this forum if and when anybody asks about it.  I only bring it up here as a one-time mention in case it is of interest as a sidekick for FreeBASIC programmer's.  Otherwise, I only post about BAM over on Reddit's BASIC Programming forum.)

Total aside: I think that anything that is good for anything BASIC is good for all BASIC, including this forum, so kudos to all involved.

CharlieJV

RE BASIC Anywhere Machine aside.

I know of no other programming language that has a programming reference (i.e. documentation) that dynamically embeds programs from the IDE/whatever directly in the documentation, allowing to run the program.

For example, looking up the CIRCLE statement, able to see sample code "right there" and run it to see what it does.

That's my kind of documentation.  I have no idea how to pull that off with traditional BASIC implementations.


Screenshot of https://basicanywheremachine.neocities.org/BAM_ProgReference.html: