|
Post by tsh73 on May 8, 2018 12:18:34 GMT
like, under "anything" - I don't see board that fits more? ZX Spectrum BASIC Challenges
One could try some it likes. Or build upon it. Or go and make it shortest-possible, as initial post implies. (and Spectrum BASIC codes are well, really specific )
|
|
|
Post by B+ on May 8, 2018 15:48:54 GMT
Here is a tile of weaving: Attachments:
|
|
|
Post by tsh73 on May 8, 2018 17:12:03 GMT
|
|
|
Post by tsh73 on May 8, 2018 17:32:06 GMT
Here we are with lowly text I would say it is nicely small
'weave-text a$(1)="#||#||" a$(2)="-||---" a$(3)="-||---" a$(4)="#||#||" a$(5)="----||" a$(6)="----||"
for y = 1 to 3 for i = 1 to 6 aLine$="" for x = 1 to 5 aLine$=aLine$+a$(i) next print aLine$ next next
#||#||#||#||#||#||#||#||#||#|| -||----||----||----||----||--- -||----||----||----||----||--- #||#||#||#||#||#||#||#||#||#|| ----||----||----||----||----|| ----||----||----||----||----|| #||#||#||#||#||#||#||#||#||#|| -||----||----||----||----||--- -||----||----||----||----||--- #||#||#||#||#||#||#||#||#||#|| ----||----||----||----||----|| ----||----||----||----||----|| #||#||#||#||#||#||#||#||#||#|| -||----||----||----||----||--- -||----||----||----||----||--- #||#||#||#||#||#||#||#||#||#|| ----||----||----||----||----|| ----||----||----||----||----||
|
|
|
Post by tsh73 on May 8, 2018 17:35:11 GMT
but converting it to graphics somehow lost that simplicity (four nested loops really feels too much) 'weave-graph nomainwin a$(1)="#||#||" a$(2)="-||---" a$(3)="-||---" a$(4)="#||#||" a$(5)="----||" a$(6)="----||"
open "Weaving" for graphics_nsb_nf as #gr #gr "trapclose [quit]" #gr "down; fill blue"
for y = 1 to 5 for i = 1 to 6 for x = 1 to 5 for j = 1 to len(a$(i)) c$=mid$(a$(i),j,1) select case c$ case "|": color$="yellow" case "-": color$="red" case "#": color$="black" end select call box (x-1)*len(a$(i))+j-1, (y-1)*6+i-1, color$ next next next next
#gr "flush" wait
[quit] close #gr end
sub box x, y, color$ cellSize = 8 'by trial and error #gr "color ";color$ #gr "backcolor ";color$ offset = 10 xx=offset+x*cellSize yy=offset+y*cellSize #gr "place ";xx ;" "; yy #gr "boxfilled ";xx+cellSize ;" "; yy+cellSize end sub
|
|
|
Post by tsh73 on May 8, 2018 18:02:52 GMT
ok take#2 I would say, simpler (except for
color$ = word$("yellow red black", instr("|-#", c$)) instead of
select case c$ case "|": color$="yellow" case "-": color$="red" case "#": color$="black" end select )
'weave-graph, take#2 'take text part then just *print that line* nomainwin a$(1)="#||#||" a$(2)="-||---" a$(3)="-||---" a$(4)="#||#||" a$(5)="----||" a$(6)="----||"
global xPos, yPos, cellSize, offset cellSize = 8 'by trial and error offset = 10 yPos = offset
open "Weaving" for graphics_nsb_nf as #gr #gr "trapclose [quit]" #gr "down; fill blue"
for y = 1 to 5 for i = 1 to 6 aLine$="" for x = 1 to 5 aLine$=aLine$+a$(i) next call printALine aLine$ next next
#gr "flush" wait
[quit] close #gr end
sub printALine aLine$ xPos=offset for j = 1 to len(aLine$) c$=mid$(aLine$,j,1) color$ = word$("yellow red black", instr("|-#", c$)) #gr "color ";color$ #gr "backcolor ";color$ #gr "place ";xPos ;" "; yPos #gr "boxfilled ";xPos+cellSize ;" "; yPos+cellSize xPos=xPos+cellSize next yPos=yPos+cellSize 'newline end sub
|
|
|
Post by B+ on May 8, 2018 22:13:37 GMT
Hi tsh73, Nice development! I could use something like for drawing tiles using a pattern string$. I have the Japanese Pattern worked out but I did it the hard way, without solid squares (see attachment). And next to translate to JB.
|
|
|
Post by B+ on May 9, 2018 12:58:40 GMT
Hi tsh73,
Can you make a weave at a given angle?
|
|
|
Post by tsh73 on May 17, 2018 12:44:39 GMT
another attempt at weave Not based on string pattern - neater
'weave, attempt #3 nomainwin open "weave #3" for graphics_nsb_nf as #gr #gr "trapclose [quit]" #gr "down" #gr "fill black; flush" #gr "home; posxy cx cy"
side= 8
'yellow long lines clr$="yellow" #gr "color ";clr$; ";backcolor ";clr$ for x = 0 to 2*cx step 3*side #gr "place ";x+side;" ";0 #gr "boxfilled ";x+3*side;" ";2*cy next
'red brick-like overlays clr$="red" #gr "color ";clr$; ";backcolor ";clr$ k=0 'for brick-like offset for y = 0 to 2*cy step 3*side for x = -6*side to 2*cx step 6*side 'would be from 0 but it leaves first black stripe #gr "place ";x+k*side;" ";y+side #gr "boxfilled ";x+(k+4)*side;" ";y+3*side next k=3-k 'toggles 3 or 0 next
#gr "flush" wait
[quit] timer 0 close #gr end
|
|
|
Post by bluatigro on Jun 10, 2018 20:02:49 GMT
|
|