|
Post by tenochtitlanuk on Aug 11, 2022 10:54:43 GMT -5
I'm still playing with arcs and LB's colour graphics.... will add a web page soon.
|
|
|
Post by tenochtitlanuk on Aug 11, 2022 10:50:25 GMT -5
I found the lsn file to be really useful part unique to LB back when I was teaching. See Diga Me- lsn files
|
|
|
Post by tenochtitlanuk on Aug 6, 2022 17:04:41 GMT -5
|
|
|
Post by tenochtitlanuk on Aug 6, 2022 5:02:01 GMT -5
Just a codicil.
For this task it took me ages to do the coordinate geometry to draw arcs of specified radius throught two points. Then I realised it has been on Rosetta Code for years for LB!
One of the reasons I support Rosetta Code is that it is such a great resource- if there is no solution in LB I can follow solutions in any other language I know- eg BASIC variants, Python, Fortran, w.h.y. and translate.
So I learned a lot- including from my colleagues on the forum!
|
|
|
Post by tenochtitlanuk on Jul 31, 2022 16:58:04 GMT -5
Very much my thoughts too, Anatoly. High pixel screens that were digitally addressed didn't really exist then. Analogue x/y CRO screens did, but it doesn't look like it was photographed. And it looks unlikely it was hand drawn. Even plastic spirograph-type toys didn't yet exist. Meanwhile I've got as far as an arc routine.... I like the idea it is a record of a space ship's course- even if odd that it's 2D!!
|
|
|
Post by tenochtitlanuk on Jul 28, 2022 16:54:31 GMT -5
Serendipidy- happening on pleasing results by chance. Here's my first try.. at least the colours are similar to the original! I also dug out my home-brew Elf- but doubt I'll be brave enough to turn it on.Even the toggle switches are almost seized.All wired by hand point-to-point, and I can't remember what the additional circuitry does!
|
|
|
Post by tenochtitlanuk on Jul 26, 2022 15:44:15 GMT -5
Coincidentally.... Currently I'm sorting/throwing out memorabilia from that period. The article from which I built my Cosmac Elf 1802. BYTE mags featuring Forth, mapping, 3D projection etc. I also found a 1979 copy of the book shown below.
I wonder if anyone fancies recreating the cover graphic?
In those days I'd have typed the code up- now, for fun, I scanned the code for a Chi Squared example, cropped off the line numbers; did an OCR on it. Voila- after correcting the odd eror ( Y and V looked almost identical on the 9pin dot matrix printouts and confused the OCR) it ran perfectly. I added quite qa few spaces to make it more readable- we didn't have much RAM in those days. First commercial computer I got to play on was a PET 4K... 10 PRINT "CHI-SQUARE TEST" 20 PRINT 28 REM - LIMIT SIZE OF CONTINGENCY TABLES TO V1( R*C), V2( C), A( R) 29 REM - WHERE R =NO. OF ROWS, C =NO, OF COLUMNS 30 DIM V1( 25), V2( 5), A( 5) 40 PRINT "NUMBER OF ROWS"; 43 REM - LINES 50-150 INPUT CONTINGENCY TABLE 50 INPUT R 60 PRINT "NUMBER OF COLUMNS"; 70 INPUT C 80 PRINT "CONTINGENCY TABLE: " ' 90 FOR I =1 TO R 100 PRINT "ROW"; I 110 FOR J =1 TO C 120 PRINT " ELEMENT"; J; 130 INPUT V1( (I -1) *C +J) 140 NEXT J 150 NEXT I ' 160 PRINT 169 REM - ADD UP MARGINAL FREQUENCIES FOR EACH ROW 170 L =0 180 M =1 ' 190 FOR I =1 TO R 200 FOR J =1 TO C 210 A( I) =A( I) +V1( M) 220 M =M +1 230 NEXT J 240 L =L +A( I) 250 NEXT I ' 260 N =R *C 269 REM - ADD UP MARGINAL FREQUENCIES FOR EACH COLUMN ' 270 FOR I =1 TO C 280 FOR J =I TO N STEP C 290 V2( I) =V2( I) +V1( J) 300 NEXT J 310 NEXT I ' 320 Z =0 330 PRINT ,,"OBSERVED VALUE" ,"EXPECTED VALUE","CHI^2 CONTRIBUTION" ' 340 FOR I =1 TO C 350 PRINT " COLUMN"; I 360 FOR J =1 TO R 369 REM - P =EXPECTED CELL VALUE 370 P =A( J) *V2( I) /L 380 X =I +(J -1) *C 389 REM Y =CHI-SQUARE CONTRIBUTION FROM THIS CELL 390 Y =( V1( X) -P)^2 /P 399 REM - Z =TOTAL CHI-SQUARE VALUE 400 Z =Z +Y 410 PRINT " ",, V1( X),, P,, Y 420 NEXT J 430 NEXT I ' 440 PRINT 450 PRINT "CHI-SQUARE ="; Z 460 PRINT "DEGREES OF FREEDOM ="; (C -1) *(R -1) 470 END
|
|
|
Post by tenochtitlanuk on Jul 1, 2022 17:40:10 GMT -5
LB5 v3.53 on Linux I tried to convert my Piet programs to LB5 as an exercise to get to grips with the new syntax, and found a number of bugs. -No way to save an image?? getimage not implemented?
-The most serious one seems to be triggered in a recursive count of neighbours, and gives a crash of LB5.... may be my fault? It's many lines of code and the original LB4 version was fine. More minor ones-
-afterlast$ not implemented? 'set' now creates squares not circles for sizes >1 printing to text editor fails in following code. 'Unexpected code at end of line....' if you un-Rem the line shown.
insert code here nomainwin
WindowWidth =120 WindowHeight =180
texteditor #w.te, 10, 4, 100, 40 graphicbox #w.g, 10, 45, 80, 80
open "Demo" for window as #w
#w "trapclose quit"
#w.g "down"
for i =76 to 0 step -4 if ( i mod 8) =0 then #w.g color( "black") else #w.g color( "white") #w.g size( i) #w.g set( 40, 40) ' in LB4 set creates a circular blob not a rectangle next i
trm$ ="77" V =val( trm$) #w.te "J"; #w.te "F"; '#w.te chr$( V); ' this line gives 'unexpected code at end of line wait
sub quit h$ close #h$ 'end end sub
|
|
|
Post by tenochtitlanuk on May 29, 2022 14:59:51 GMT -5
So here is a Piet interpreter written in LB producing the output 'Hello World"! The ASCII values of the letters are inputted as blocks of colour.... Will update the webpage version soon.
|
|
|
Post by tenochtitlanuk on May 26, 2022 6:42:54 GMT -5
I'm spending too much time on this, but it is addictive! I'm not helped that there are VERY few published programs, and several are actually incorrect- or interpret Piet slightly differently. Anyway, this screen shot shows a brute force way to print 'Hello World' in Piet. - I think nearly everything is near working correctly- entering Piet code and interpreting it. All looks pretty but is even closer than Forth to 'write impenetrable. read almost impossible.'
|
|
|
Post by tenochtitlanuk on May 11, 2022 7:06:42 GMT -5
Pogress report- the detection and sizing of 'codels' is working happily. Just the direction/turning controls to implement now. Web page up soon...
|
|
|
Post by tenochtitlanuk on May 9, 2022 3:52:47 GMT -5
That's almost exactly my thinking. I'm nearly there- after 10 minutes this morning with my mind clearer! It's rather fun- I love the ability to send a Piet-user a picture that actually runs as a program. And the same program can be represented in Piet in so many different ways! Mind you, the language written entirely in tabs, spaces and line-feeds beats it- you don't even realise you've received a message!
|
|
|
Post by tenochtitlanuk on May 9, 2022 2:27:27 GMT -5
I happily use both native LB recursive flood filling and MS's internal FloodFill- see lots of my entries on this forum and on my website. It was just the 'counting-as-I-find-them' that was blind-siding me. I work in Linux/Wine and pointed out a long time ago that the Rosetta Code LB solution failed for me. Still does. Me (14 Feb 2020 at 19:46) and Rod (15 Nov 2019 at 10:15) The flood fill rosetta code had a number of quirks for me. It also did not run on my PC The main culprit was setting the brush using backcolor instead of color. But it was also passing globals to subs and whats with floating point numbers describing screen width?
Doesn't seem to have been corrected..
Ho hum. Today's a chance for a fresh look!
|
|
|
Post by tenochtitlanuk on May 8, 2022 14:20:57 GMT -5
For my Piet machine I'm held up at present on counting the size of codels, ie colour blocks with connection to left or right or up or down. ( diagonal neighbours are NOT within the codel block) In the fragment below I've added manually the neighbour-count for each cell to show what is needed. I can read the colour of each square with getPixel, or from an array. Basically I want a routine that you can point at x, y and it will tell you the codel count, In the fragment shown most would return 1; two would return 2 for either square; and on would return 3 from any of its members. The blocks all in one colour can extend irregularly to the edge of the graphic box but no further. Should be straightforward surely to write an iterative/recursive search out from the x,y cell selected, but I've tied myself in a knot. Any offers??
|
|
|
Post by tenochtitlanuk on May 7, 2022 16:12:30 GMT -5
Also...
Will HFS support the FTP file transfer protocol? FTP support is planned, but don't expect it soon. It may come in a major release after 2.0.
I'm used only to hosting on a ( paid) remote site or on my own SAMBA server, so can't help on HFS, tho' it seems an interesting system. I'm not keen on systems that require my own server to be on 24/7, plus the need to be more careful about firewalling etc, so I pay for someone else to ensure 99.9% availability
|
|