Interesting patterns for HP-42S - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Interesting patterns for HP-42S (/thread-213505.html) Interesting patterns for HP-42S - Tom Grydeland - 03-06-2012 There are doubly-periodic pixellated patterns in which the frequencies of lit to unlit pixels are equal across all rows, columns and diagonals (left and right) of the pattern. When the basic pattern is of size 8, the frequencies can be equal. Looking for particular symmetries can lead the way to some strikingly beautiful patterns. I was curious to find out how compactly I could represent these in the HP-42S, and came up with the program listed below. (Rv is roll down, * is multiply). Enter a number from 0 to 10 in ST X and XEQ "DPP". (only 0, 1, and 5 shown below, to save a bit of typing) The underlying mathematics for the pattern search was published by prof. Ben Johnsen in the norwegian mathematical journal Normat in 2001. The paper (in Norwegian) is not available on-line, but I can provide copies upon request. A small selection of patterns with other sizes and symmetries is shown in this album ```00 { 46-Byte Prgm } 01 LBL "PSHOW" 02 CLLCD 03 ALENG 04 1e-5 05 * 06 1.131 07 + 08 STO 00 09 LBL 01 10 1 11 RCL 00 12 AGRAPH 13 X<>Y 14 8 15 + 16 X<>Y 17 AGRAPH 18 + 19 CLX 20 ISG 00 21 GTO 01 22 END ``` ```00 { 344-Byte Prgm } 01 LBL "DPP" 02 GTO IND ST X 03 LBL 00 04 3903507479 05 3895678231 06 GTO 96 07 LBL 01 08 4036562913 09 1013367582 10 GTO 96 ... 23 LBL 05 24 4039905177 25 4029878118 26 GTO 96 .... (add more patterns here, if so desired) 46 LBL 96 47 CLA 48 XEQ 97 49 Rv 50 XEQ 97 51 XEQ "PSHOW" 52 RTN 53 LBL 97 54 4 55 STO 00 56 Rv 57 LBL 98 58 XEQ 99 59 DSE 00 60 GTO 98 61 RTN 62 LBL 99 63 ENTER 64 ENTER (if anyone know a 1-instruction DUP which does not disable stack lift, tell me) 65 255 66 AND 67 XTOA 68 Rv 69 8 70 ROTXY 71 END ``` Re: Interesting patterns for HP-42S - C.Ret - 03-06-2012 Quote:```[...] 62 LBL 99 63 ENTER 64 ENTER (if anyone know a 1-instruction DUP which does not disable stack lift, tell me) [...]``` May I suggest RCL ST X ? Re: Interesting patterns for HP-42S - Tom Grydeland - 03-06-2012 yes, that did occur to me after posting. It works, but uses the same # of bytes. Re: Interesting patterns for HP-42S - C.Ret - 03-06-2012 Exact. No byte are spared here! Your code triggers me enough to let me try to observe your curious and highly symmetrical pixel patterns. I have adapt your code to my HP-28S to take advantage of the larger LCD screen (double size in row compare to HP-42S). ```« 64 STWD @ Use full size binary words { #E8AACC17E8335515h #F0990FE13C66C31Eh ... @ Only pattern 0, 1 and 5 in list #F0CC0F99F0330F66h ... @ to save keystrokes } SWAP 1 + GET @ get pattern from code list "" @ initiate graphic string 1 8 START SWAP RRB @ build 8x8 pixels pattern DUP #FFh AND @ RRB is rotate right one byte B->R CHR ROT + @ from code last byte into graphic string NEXT DUP OVER + @ grow gr. String up to 16 pixels DUP + DUP + DUP + @ 32 p. -> 64p.-> 128p. + 0 CHR + @ adjust length to exactly 137 pixels /1 row on HP28C/) DUP + DUP + @ repeat for each of the 4 rows ->LCD @ display graphic string » ‘DPP’ STO ``` Usage, enter 0, 1 or 5 and press [ DPP ] menu key to see corresponding doubly-periodic pixellated patterns full screen (press [ ON ]+[ L ] to online-print screen). I am now one the way to code other high symmetrical 8x8 pixel patterns. Edited: 6 Mar 2012, 5:36 p.m. Re: Interesting patterns for HP-42S - Tom Grydeland - 03-07-2012 Very nice! I don't have a 28S, so I cannot try your programs, but the output looks exactly correct. The x48 emulator works for building the string, but it doesn't like the string argument to "->LCD" -- I haven't tried particularly hard, so I might have missed some subtlety. The larger screen of the 28 could also be used to tile up the pattern, ie use 2x2 screen pixels as the basis for the pattern. Not exactly sure what kind of bit twiddling would turn the nybble "abcd" into "aabbccdd", perhaps a look-up table would be best? I have some 2537 patterns of this weight and size (i.e. 4 of every 8 pixels are black, starting anywhere and counting horizontally, vertically or diagonally) of which 919 have more than one symmetry. They are not coded up as hexadecimal strings, however (searches started out with patterns of other sizes), but I should be able to recode to hex-strings without too much trouble. Re: Interesting patterns for HP-42S - Marcus von Cube, Germany - 03-07-2012 Tom, the 48 series has a more evolved graphic object concept. Hunt for GROB in the documentation! Re: Interesting patterns for HP-42S - Tom Grydeland - 03-07-2012 Here are some more interesting patterns for you to try, in hex form: ```#17A33AD8C68D6C71h #271BD8B18D4E72E4h #17A3725CC68DE839h #17C56CD88EA33972h #27A96A5695E41BD8h #27B16A568DE4599Ah #1B63D436CA4DB1ACh #2B53ACB24DCA35D4h #2739CAB28D6C53D4h #2739C6B2AC4D53D8h #271B72B18D4ED8E4h #2739D493AC4D72CAh #0F69690FF09696F0h #1763E84E9CC5B13Ah #1763E45C8EC9B13Ah #1771A33A4EC9E49Ch #17A33AE88EC55C71h ```