vargraph.bas


'Vargraf.bas for SmallBASIC v12.8 [B+=MGA] 2017-01-04
' from Vargraf.yab, in Galileo's Collection
' Author: Antonio Navarro Andreu, 2009
' Adaptacion del programa 'Variaciones graficas' del n� 3 de la revista ZX
' docu Programa original escrito en Sinclair BASIC para ZX Spectrum.

' 2017-01-04 completely overhauled removing line numbers and read / data for q
' adding two outer loops and coloring, random selections for infinite variety
' dPlaces function created for display of decimal numbers

const s=(min(xmax, ymax))\2 - 25 'to fit in middle of screen
color 15, 0 'for prints
while 1 'new outer loop picks two random numbers
r1 = rnd*100 + 1 : r2 = rnd*100 + 1
for q = 20 to 150 step .1
' added this loop, orig q read from 10 data points 20 to 83
' and showed 10 screens and was done!
cls
f=0 : counter = 0
? "r1 = ";dPlaces(r1,1);" r2 = ";dPlaces(r2,1);" q = ";dPlaces(q,1)
for n=0 to 2*pi+.01 step 2*pi/q
counter +=1 'added for coloring
x=(sin(r1*n))*s+xmax/2 'orig 60 let x=(sin(29*n)+1)*60+68
y=(cos(r2*n))*s+ymax/2 'orig 70 let y=(cos(11*n)+1)*60+28
if f=1 then line a, b, x, y, (counter\16) mod 6 + 9
f=1 : a=x : b=y
next
delay 70
next
wend

func
dPlaces(number, places)
local ns, dot
ns = str(number) : dot = instr(ns, ".")
if dot then
dPlaces = mid(ns, 1, dot) + mid(ns, dot+1, places)
else
dPlaces = ns
end if
end

We have a program for it, but what's a VarGraf? Y no hablo mucho Espanol.

#1 search-return, is this page! Within the first page of hits, returns degenerate to 'Margraf' and 'Margrave'.

BASIC256 used to have a forum-entry, but they appear to be gone now.

IBM has a page titled "Variable-length DBCS-graphic Fields". It does not display, but we now have new search-terms.

The full IBM-term gets more results, but they are acane, and mostly IBM.

'DBCS-graphic' uncovers more, including that it is a 'data type'. CourseHero (#1) have a significant page on the topic. Looks rigorous & thorough ... if you do file formats and technical representations, this is probably the one. They blur their content, unless you Register (though, with restricted browser-functionality, it becomes readable).

Both Oracle and Brookhaven National Laboratory want us to know, they do not support it. Both references are in connection with their DB2/DXT documentation. BNL mirrors the Oracle DB2 docs.

The Timex Sinclair ZX Spectrum tested ok a couple years ago, and I have some books. But with Raspberry Pi and Arduino and etc, I'm probably finally about ready to find all the old home-computers a good home.

I knew that name sounded familiar (after a search). Welcome back!

Here is the entire Vargraph.yab file that inspired my mods:

#!/usr/bin/yabasic

rem Program Name: Vargraf.yab
rem Author: Antonio Navarro Andreu, 2009
rem
docu Adaptacion del programa 'Variaciones graficas' del nº 3 de la revista ZX
docu Programa original escrito en Sinclair BASIC para ZX Spectrum.
rem

open window 255,175 : REM Dimensiones de la pantalla del Spectrum en pixels
window origin "lb" : REM Origen de las coordenadas en la esquina inferior izquierda
10 read q:if not q end
20 backcolor 0,255,255 : color 0,0,255 : REM En el original, PAPER 5: INK 1 (cyan y azul)
30 clear window : REM CLS en el original
40 let f=0
50 for n=0 to 2*pi+.01 step 2*pi/q
60 let x=(sin(29*n)+1)*60+68
70 let y=(cos(11*n)+1)*60+28
// 80 IF f=1 THEN DRAW x-a, y-b : REM Mientras que DRAW usa coordenadas relativas, LINE usa coordenadas absolutas
80 if f=1 line to x, y
90 let f=1: let a=x: let b=y
100 new curve:line x, y: next n : REM 'new curve: line x, y' es el equivalente de PLOT x, y
110 pause 2
120 data 20,22,23,40,47,51,69,72,80,83,0
130 goto 10

Variaciones > permutations or combination, it's variable
graficas > a graphic
= a variable graphic ?

I wouldn't read too much into this. ;-))

i was trying to show both smallbasic and fig to the qb64 forum. i decided to use your dplaces function as the example:

'# smallbasic -- function written by mga               '# # fig
func dPlaces(number, places)                           '# function dPlaces(number, places)
  local ns, dot                                        '#   ns = number : str
  ns = str(number) : dot = instr(ns, ".")              '#   dot = instr ns(ns, ".")
  if dot then                                          '#   iftrue dot
    dPlaces = mid(ns, 1, dot) + mid(ns, dot+1, places) '#     dot1 = dot plus 1
                                                       '#     c1 = ns : mid(1, dot) 
                                                       '#     c2 = ns : mid(dot1, places)
                                                       '#     dPlaces = c1 plus c2
  else                                                 '#   else
    dPlaces = ns                                       '#     dPlaces = ns
  end if                                               '#   fig
                                                       '#   now return dPlaces
end                                                    '# fig

Does fig depend on indentation? Is fig necessary to end a code block?

Is fig compiled yet or is it still completely dependent on running in Python and its extensions?

If compiled, is it usable in Windows? I ask, because figosdev has in past resolved never to work in Windows for fig development.

thank you for asking:

"Does fig depend on indentation?"

only when the inline python feature is used-- python code depends on indentation. the rest of the fig code does not.

"Is fig necessary to end a code block?"

it is necessary to end a code block with a command, like in basic. a for loop can end with next or fig. a forin loop can end with next or nextin or fig. if statements and functions end with fig. using the fig command is like unindenting in python. "fig" can end any block, but other commands are offered for semantic clarity. i still end for loops with next and use wend to end while loops.

"Is fig compiled yet or is it still completely dependent on running in Python and its extensions?"

1. fig is a source-to-source compiler (so is qb64. it compiles to c++ then compiles the c++ using gpp.)
2. fig compiles to python. as python is interpreted, this requires the python interpreter.
3. python programs can be glued to their intepreter to create an .exe. (quickbasic compiles with a runtime.)
4. this means you can compile a fig program to an exe, but you would probably need python installed to create the exe in the first place-- not to run it.

"If compiled, is it usable in Windows? I ask, because figosdev has in past resolved never to work in Windows for fig development."

i avoid windows development, and i do not work on it in windows 10.

in the past i have used fig in various versions of windows. the irritating part of using fig in windows isnt installing python, but installing colorama. colorama is small, but tedious for a number of people to install.

configuring ansi.sys in windows 7 / earlier should be a suitable alternative to installing colorama. i havent tried it. if they made a decent vt100-compatible term window for windows (ive tried finding one) that would also make colorama unnecessary.

vt100 compatibility in mac osx and gnu/linux is simply everywhere, so colorama is not needed except in windows.