Home » Personal collection » Acorn hard disk » files » BallBot » NNET
NNET
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Personal collection » Acorn hard disk » files » BallBot |
Filename: | NNET |
Read OK: | ✔ |
File size: | 0600 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10MODE12:MOUSE ON 20ONERRORREPORT:PRINT" @ ";ERL:END 30INPUT"How many layers";layers 40DIMnum(layers-1):max=0 50FORL=0TOlayers-1 60REPEAT 70 PRINT"Nodes on layer ";L+1;:INPUTnum(L) 80 IF num(L)<1 OR num(L)>9 THEN PRINT"Must be 1-9 nodes":UNTIL FALSE 90UNTIL TRUE 100IFnum(L)>max THEN max=num(L) 110NEXT:DIMlink%(layers-1,max-1,2) 120REPEAT CLS:PRINTTAB(10)"Artificial Neural Network - Dominic Ford 1998" 130 REPEAT changed=FALSE 140 PROCdrawnet 150 MOUSEx,y,c 160 IF c<>0 THEN 170 PROCgetnode 180 layst=L:nodest=N:C=c 190 IF L<>0 200 REPEAT MOUSEx,y,c:UNTILc=0 210 REPEAT 220 REPEAT MOUSEx,y,c:UNTILc<>0 230 PROCgetnode 240 UNTIL L=layst-1 OR (L=layst AND N=nodest) 250 IF (L=layst AND N=nodest) THEN link%=0 ELSE link%=256*L+N+256 260 link%(layst,nodest,C)=link% 270 changed=TRUE 280 ENDIF 290 ENDIF 300 UNTIL changed 310UNTIL FALSE 320: 330DEFPROCdrawnet 340FORL=0TOlayers-1 350 FORN=0TOnum(L)-1 360 MOVE(1280/layers)*L+50,(960/num(L))*N+50 370 DRAW(1280/layers)*(L+1)-50,(960/num(L))*N+50 380 DRAW(1280/layers)*(L+1)-50,(960/num(L))*(N+1)-50 390 DRAW(1280/layers)*L+50,(960/num(L))*(N+1)-50 400 DRAW(1280/layers)*L+50,(960/num(L))*N+50 410 FORlnk=0TO2 420 MOVE(1280/layers)*L+75,(960/num(L))*N+((240/num(L))-25)*(lnk+1)+50 430 IFlink%(L,N,lnk)=0 THEN 440 DRAW(1280/layers)*L+50,(960/num(L))*N+((240/num(L))-25)*(lnk+1)+50 450 ELSE 460 L2=link%(L,N,lnk)DIV256 470 N2=(link%(L,N,lnk)MOD256)+0.5 480 DRAW(1280/layers)*L2-50,(960/num(L2-1))*N2 490 ENDIF 500 NEXT 510 NEXT 520NEXT 530ENDPROC 540: 550DEFPROCgetnode 560L=INT(x/1280*layers) 570N=INT(y/960*num(L)) 580IF (c AND 1)<>0 THEN c=0:ENDPROC 590IF (c AND 2)<>0 THEN c=1:ENDPROC 600c=2 610ENDPROC
�12:ȗ � �:�" @ ";�:� �"How many layers";layers (�num(layers-1):max=0 2�L=0�layers-1 <� F$ �"Nodes on layer ";L+1;:�num(L) P5 � num(L)<1 � num(L)>9 � �"Must be 1-9 nodes":� � Z� � d�num(L)>max � max=num(L) n�:�link%(layers-1,max-1,2) x<� �:�10)"Artificial Neural Network - Dominic Ford 1998" � � changed=� � �drawnet � ȗx,y,c � � c<>0 � � �getnode � layst=L:nodest=N:C=c � � L<>0 � � ȗx,y,c:�c=0 � � � � ȗx,y,c:�c<>0 � �getnode �* � L=layst-1 � (L=layst � N=nodest) �< � (L=layst � N=nodest) � link%=0 � link%=256*L+N+256 # link%(layst,nodest,C)=link% changed=� � " � , � changed 6� � @: J ��drawnet T�L=0�layers-1 ^ �N=0�num(L)-1 h+ �(1280/layers)*L+50,(960/num(L))*N+50 r/ �(1280/layers)*(L+1)-50,(960/num(L))*N+50 |3 �(1280/layers)*(L+1)-50,(960/num(L))*(N+1)-50 �/ �(1280/layers)*L+50,(960/num(L))*(N+1)-50 �+ �(1280/layers)*L+50,(960/num(L))*N+50 � �lnk=0�2 �F �(1280/layers)*L+75,(960/num(L))*N+((240/num(L))-25)*(lnk+1)+50 � �link%(L,N,lnk)=0 � �G �(1280/layers)*L+50,(960/num(L))*N+((240/num(L))-25)*(lnk+1)+50 � � � L2=link%(L,N,lnk)�256 �# N2=(link%(L,N,lnk)�256)+0.5 �/ �(1280/layers)*L2-50,(960/num(L2-1))*N2 � � � � � � � � : & ��getnode 0L=�(x/1280*layers) :N=�(y/960*num(L)) D� (c � 1)<>0 � c=0:� N� (c � 2)<>0 � c=1:� Xc=2 b� �
00000000 0d 00 0a 0c eb 31 32 3a c8 97 20 ee 0d 00 14 12 |.....12:.. .....| 00000010 ee 85 f6 3a f1 22 20 40 20 22 3b 9e 3a e0 0d 00 |...:." @ ";.:...| 00000020 1e 1d e8 22 48 6f 77 20 6d 61 6e 79 20 6c 61 79 |..."How many lay| 00000030 65 72 73 22 3b 6c 61 79 65 72 73 0d 00 28 18 de |ers";layers..(..| 00000040 6e 75 6d 28 6c 61 79 65 72 73 2d 31 29 3a 6d 61 |num(layers-1):ma| 00000050 78 3d 30 0d 00 32 11 e3 4c 3d 30 b8 6c 61 79 65 |x=0..2..L=0.laye| 00000060 72 73 2d 31 0d 00 3c 05 f5 0d 00 46 24 20 f1 22 |rs-1..<....F$ ."| 00000070 4e 6f 64 65 73 20 6f 6e 20 6c 61 79 65 72 20 22 |Nodes on layer "| 00000080 3b 4c 2b 31 3b 3a e8 6e 75 6d 28 4c 29 0d 00 50 |;L+1;:.num(L)..P| 00000090 35 20 e7 20 6e 75 6d 28 4c 29 3c 31 20 84 20 6e |5 . num(L)<1 . n| 000000a0 75 6d 28 4c 29 3e 39 20 8c 20 f1 22 4d 75 73 74 |um(L)>9 . ."Must| 000000b0 20 62 65 20 31 2d 39 20 6e 6f 64 65 73 22 3a fd | be 1-9 nodes":.| 000000c0 20 a3 0d 00 5a 07 fd 20 b9 0d 00 64 1c e7 6e 75 | ...Z.. ...d..nu| 000000d0 6d 28 4c 29 3e 6d 61 78 20 8c 20 6d 61 78 3d 6e |m(L)>max . max=n| 000000e0 75 6d 28 4c 29 0d 00 6e 1e ed 3a de 6c 69 6e 6b |um(L)..n..:.link| 000000f0 25 28 6c 61 79 65 72 73 2d 31 2c 6d 61 78 2d 31 |%(layers-1,max-1| 00000100 2c 32 29 0d 00 78 3c f5 20 db 3a f1 8a 31 30 29 |,2)..x<. .:..10)| 00000110 22 41 72 74 69 66 69 63 69 61 6c 20 4e 65 75 72 |"Artificial Neur| 00000120 61 6c 20 4e 65 74 77 6f 72 6b 20 2d 20 44 6f 6d |al Network - Dom| 00000130 69 6e 69 63 20 46 6f 72 64 20 31 39 39 38 22 0d |inic Ford 1998".| 00000140 00 82 10 20 f5 20 63 68 61 6e 67 65 64 3d a3 0d |... . changed=..| 00000150 00 8c 0e 20 20 f2 64 72 61 77 6e 65 74 0d 00 96 |... .drawnet...| 00000160 0d 20 20 c8 97 78 2c 79 2c 63 0d 00 a0 0e 20 20 |. ..x,y,c.... | 00000170 e7 20 63 3c 3e 30 20 8c 0d 00 aa 0f 20 20 20 f2 |. c<>0 ..... .| 00000180 67 65 74 6e 6f 64 65 0d 00 b4 1b 20 20 20 6c 61 |getnode.... la| 00000190 79 73 74 3d 4c 3a 6e 6f 64 65 73 74 3d 4e 3a 43 |yst=L:nodest=N:C| 000001a0 3d 63 0d 00 be 0d 20 20 20 e7 20 4c 3c 3e 30 0d |=c.... . L<>0.| 000001b0 00 c8 16 20 20 20 20 f5 20 c8 97 78 2c 79 2c 63 |... . ..x,y,c| 000001c0 3a fd 63 3d 30 0d 00 d2 09 20 20 20 20 f5 0d 00 |:.c=0.... ...| 000001d0 dc 18 20 20 20 20 20 f5 20 c8 97 78 2c 79 2c 63 |.. . ..x,y,c| 000001e0 3a fd 63 3c 3e 30 0d 00 e6 11 20 20 20 20 20 f2 |:.c<>0.... .| 000001f0 67 65 74 6e 6f 64 65 0d 00 f0 2a 20 20 20 20 fd |getnode...* .| 00000200 20 4c 3d 6c 61 79 73 74 2d 31 20 84 20 28 4c 3d | L=layst-1 . (L=| 00000210 6c 61 79 73 74 20 80 20 4e 3d 6e 6f 64 65 73 74 |layst . N=nodest| 00000220 29 0d 00 fa 3c 20 20 20 20 e7 20 28 4c 3d 6c 61 |)...< . (L=la| 00000230 79 73 74 20 80 20 4e 3d 6e 6f 64 65 73 74 29 20 |yst . N=nodest) | 00000240 8c 20 6c 69 6e 6b 25 3d 30 20 8b 20 6c 69 6e 6b |. link%=0 . link| 00000250 25 3d 32 35 36 2a 4c 2b 4e 2b 32 35 36 0d 01 04 |%=256*L+N+256...| 00000260 23 20 20 20 20 6c 69 6e 6b 25 28 6c 61 79 73 74 |# link%(layst| 00000270 2c 6e 6f 64 65 73 74 2c 43 29 3d 6c 69 6e 6b 25 |,nodest,C)=link%| 00000280 0d 01 0e 11 20 20 20 20 63 68 61 6e 67 65 64 3d |.... changed=| 00000290 b9 0d 01 18 08 20 20 20 cd 0d 01 22 07 20 20 cd |..... ...". .| 000002a0 0d 01 2c 0e 20 fd 20 63 68 61 6e 67 65 64 0d 01 |..,. . changed..| 000002b0 36 07 fd 20 a3 0d 01 40 05 3a 0d 01 4a 0d dd f2 |6.. ...@.:..J...| 000002c0 64 72 61 77 6e 65 74 0d 01 54 11 e3 4c 3d 30 b8 |drawnet..T..L=0.| 000002d0 6c 61 79 65 72 73 2d 31 0d 01 5e 12 20 e3 4e 3d |layers-1..^. .N=| 000002e0 30 b8 6e 75 6d 28 4c 29 2d 31 0d 01 68 2b 20 20 |0.num(L)-1..h+ | 000002f0 ec 28 31 32 38 30 2f 6c 61 79 65 72 73 29 2a 4c |.(1280/layers)*L| 00000300 2b 35 30 2c 28 39 36 30 2f 6e 75 6d 28 4c 29 29 |+50,(960/num(L))| 00000310 2a 4e 2b 35 30 0d 01 72 2f 20 20 df 28 31 32 38 |*N+50..r/ .(128| 00000320 30 2f 6c 61 79 65 72 73 29 2a 28 4c 2b 31 29 2d |0/layers)*(L+1)-| 00000330 35 30 2c 28 39 36 30 2f 6e 75 6d 28 4c 29 29 2a |50,(960/num(L))*| 00000340 4e 2b 35 30 0d 01 7c 33 20 20 df 28 31 32 38 30 |N+50..|3 .(1280| 00000350 2f 6c 61 79 65 72 73 29 2a 28 4c 2b 31 29 2d 35 |/layers)*(L+1)-5| 00000360 30 2c 28 39 36 30 2f 6e 75 6d 28 4c 29 29 2a 28 |0,(960/num(L))*(| 00000370 4e 2b 31 29 2d 35 30 0d 01 86 2f 20 20 df 28 31 |N+1)-50.../ .(1| 00000380 32 38 30 2f 6c 61 79 65 72 73 29 2a 4c 2b 35 30 |280/layers)*L+50| 00000390 2c 28 39 36 30 2f 6e 75 6d 28 4c 29 29 2a 28 4e |,(960/num(L))*(N| 000003a0 2b 31 29 2d 35 30 0d 01 90 2b 20 20 df 28 31 32 |+1)-50...+ .(12| 000003b0 38 30 2f 6c 61 79 65 72 73 29 2a 4c 2b 35 30 2c |80/layers)*L+50,| 000003c0 28 39 36 30 2f 6e 75 6d 28 4c 29 29 2a 4e 2b 35 |(960/num(L))*N+5| 000003d0 30 0d 01 9a 0e 20 20 e3 6c 6e 6b 3d 30 b8 32 0d |0.... .lnk=0.2.| 000003e0 01 a4 46 20 20 20 ec 28 31 32 38 30 2f 6c 61 79 |..F .(1280/lay| 000003f0 65 72 73 29 2a 4c 2b 37 35 2c 28 39 36 30 2f 6e |ers)*L+75,(960/n| 00000400 75 6d 28 4c 29 29 2a 4e 2b 28 28 32 34 30 2f 6e |um(L))*N+((240/n| 00000410 75 6d 28 4c 29 29 2d 32 35 29 2a 28 6c 6e 6b 2b |um(L))-25)*(lnk+| 00000420 31 29 2b 35 30 0d 01 ae 1a 20 20 20 e7 6c 69 6e |1)+50.... .lin| 00000430 6b 25 28 4c 2c 4e 2c 6c 6e 6b 29 3d 30 20 8c 0d |k%(L,N,lnk)=0 ..| 00000440 01 b8 47 20 20 20 20 df 28 31 32 38 30 2f 6c 61 |..G .(1280/la| 00000450 79 65 72 73 29 2a 4c 2b 35 30 2c 28 39 36 30 2f |yers)*L+50,(960/| 00000460 6e 75 6d 28 4c 29 29 2a 4e 2b 28 28 32 34 30 2f |num(L))*N+((240/| 00000470 6e 75 6d 28 4c 29 29 2d 32 35 29 2a 28 6c 6e 6b |num(L))-25)*(lnk| 00000480 2b 31 29 2b 35 30 0d 01 c2 08 20 20 20 cc 0d 01 |+1)+50.... ...| 00000490 cc 1d 20 20 20 20 4c 32 3d 6c 69 6e 6b 25 28 4c |.. L2=link%(L| 000004a0 2c 4e 2c 6c 6e 6b 29 81 32 35 36 0d 01 d6 23 20 |,N,lnk).256...# | 000004b0 20 20 20 4e 32 3d 28 6c 69 6e 6b 25 28 4c 2c 4e | N2=(link%(L,N| 000004c0 2c 6c 6e 6b 29 83 32 35 36 29 2b 30 2e 35 0d 01 |,lnk).256)+0.5..| 000004d0 e0 2f 20 20 20 20 df 28 31 32 38 30 2f 6c 61 79 |./ .(1280/lay| 000004e0 65 72 73 29 2a 4c 32 2d 35 30 2c 28 39 36 30 2f |ers)*L2-50,(960/| 000004f0 6e 75 6d 28 4c 32 2d 31 29 29 2a 4e 32 0d 01 ea |num(L2-1))*N2...| 00000500 08 20 20 20 cd 0d 01 f4 07 20 20 ed 0d 01 fe 06 |. ..... .....| 00000510 20 ed 0d 02 08 05 ed 0d 02 12 05 e1 0d 02 1c 05 | ...............| 00000520 3a 0d 02 26 0d dd f2 67 65 74 6e 6f 64 65 0d 02 |:..&...getnode..| 00000530 30 16 4c 3d a8 28 78 2f 31 32 38 30 2a 6c 61 79 |0.L=.(x/1280*lay| 00000540 65 72 73 29 0d 02 3a 15 4e 3d a8 28 79 2f 39 36 |ers)..:.N=.(y/96| 00000550 30 2a 6e 75 6d 28 4c 29 29 0d 02 44 18 e7 20 28 |0*num(L))..D.. (| 00000560 63 20 80 20 31 29 3c 3e 30 20 8c 20 63 3d 30 3a |c . 1)<>0 . c=0:| 00000570 e1 0d 02 4e 18 e7 20 28 63 20 80 20 32 29 3c 3e |...N.. (c . 2)<>| 00000580 30 20 8c 20 63 3d 31 3a e1 0d 02 58 07 63 3d 32 |0 . c=1:...X.c=2| 00000590 0d 02 62 05 e1 0d ff 00 00 00 00 00 00 00 00 00 |..b.............| 000005a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 00000600