Skip to main content

Posts

Classic Pattern Writer for ZX Spectrum (Terry Mason, 1986)

I'm not sure whether this fits here on a retro computing blog or over on my knitting blog! I notice that when I tried Knitwear Designer for BBC , I mostly put the computery parts here and the knitty parts over on my knitting blog .  At the Centre for Computing History last weekend I spotted a display of knitting software. Besides Knitwear Designer which I have, there were a number of other titles that I wasn't aware of.  Classic Pattern Writer for ZX Spectrum was easy to find, at least as an electronic copy archived online. The loading screen is at the top of the post. A nice colourful pattern fills the screen along with the bold claim "all classic styles". This claim is repeated on the intro screen: You're guided through a few choices but it really comes down to two main styles, raglan or inset sleeves, with some variations such as V or round neck; long or short sleeves.  This is pretty much in line with the BBC's Knitwear Designer. They both have a couple o
Recent posts

Driving NeoPixels with Z80

I 've long been thinking about a version two   RC2014 LED matrix module . I've had a matrix with a MAX 7219 on a module. It's a nice enhancement. But there's only so much you can do with a single-colour LED array right? Wouldn't it be cool to have RGB LEDs?  At Liverpool MakeFest I saw a wall-sized ping-pong ball NeoPixel display and picked up some NeoPixels with the intention of making one. Possibly driven by my RC2014.  I enjoy learning about protocols and have had some SPI devices working with the RC2014 - bit-banging SPI works really well because it doesn't care about timing. NeoPixels really do care about timing though. From Adafruit's web page about their 8x8  NeoPixel matrix: If there's one thing I want to get across in this blog post, it's don't just accept what you're told . Question everything. Learn about what's going on and find out why you're being told something isn't possible. Get creative with workarounds. I'

Friday Quiz maths problem and Heap's algorithm

 T oday's Friday Quiz maths problem is a corker: When the official answer came, a simple solution was given with the answer (I'll save that till later) which didn't make things clear to me. But without seeing an easier way, my approach, as usual, was to find all the permutations of the 9 digits, and count the ones that meet the criteria.  The *number* of ways you can arrange some objects is easy to calculate. But how to actually shuffle those around in memory so that you can test them? Long story short, I devised my own way to shuffle the numbers around, which I thought would work and it nearly did. But not quite. I turned to the web and found Heap's algorithm, which is very similar to what I was trying to do, except that it does actually work.  It's simple, and the Wikipedia page gives some example code which is recursive. Here's my version of that in C (I made my array global, rather than passing pointers around) In my program, printNumber() also performs the

Friday Quiz maths problem 14 Oct 22

I did spend a little time trying to reason it out and arrive at an answer through logic but soon gave up and resorted to my usual method of 'try all the numbers and count how many fit'. Using my trusty Minstrel Forth (Jupiter Ace clone) I have written a program to cycle through all 10-digit numbers that use 1,2 and 3  and test / count  the number that qualify (adjacent numbers differ by 1) It's taking a while. As I write this it seems to be running but it'll take a little while longer before I have an answer. Once it's finished and I know it's working properly I'll write my program below for Forth fans. [update] The answer is 64 and this week we do have some working.   My program did eventually come up with the right answer after a bit of debugging and you can see the pattern referred to. The listing is below, please feel free to type it in, or paste it if you have one of my USB keyboard / serial adaptors .   I love using recursion. Here I've re-used som

Friday quiz maths problem 16 Sep 2022

Sadly the Friday quiz that I subscribe to is having a break for three weeks. I have subscribed to other maths problems and this one that caught my eye this week: The Baseball Game Ivy has created a game for her school’s math fair. She put three baseballs, numbered 1, 2, and 3, into a bag. Without looking, a player will randomly draw a baseball from the bag, record its number, and then put the baseball back into the bag. They will do this two more times and then calculate the sum of the three numbers recorded. If the sum is less than 8, the player will win a prize. What is the probability that a player will win a prize when they play this game once? This isn't too difficult to work out. I did it with a spreadsheet but you can reason it out I think.  Look away now if you want to work it out for yourself first.  I haven't yet had the official answer, but the answer that I and my partner have both found is 85.185%, that being 23 winning combinations out of 27 possible combinations.

Friday Quiz maths question 8 Jul 22

  H o w  many three-digit numbers are ther e where the middle digit is lower than  both the first digit and the third digit ? My reaction to this is to loop through all of the numbers 100-999 and count the ones that pass the test. (yes, lines 40 and 45 look a little inelegant with that repetition, but I tried it with a goto (yuk) and gosub and this was the shortest and neatest of my variations.  I wanted to print the qualifying numbers as well as inc'ing the count). I remember a very similar question in the past, involving 3-digit numbers. I think it was Mr Beckett who used a single loop in Forth and wrote words to separate out the hundreds, tens and units.  (Seemed a little counter-intuitive to me but Forth doesn't allow you access to the indices of three nested loops). So I thought I'd give that a go to see whether it would be more elegant than the BASIC version.  Here are my 'hundreds', 'tens' and 'units' words (made easier as the default type in

Friday Quiz maths question, 24 Jun 2022, a day late.

  There is just one pair of numbers (x,y)   where  when you add them together, mult iply them t ogether or divide x by y , the answers are all equal .   What are those numbers ? If you'd like to have a go at finding the answer, please do, and I'd love to hear how you did it. Below are my thoughts, experiments and answer. I should have found the answer sooner than I did.  First of all I used BASIC, set up a couple of loops for x and y and tested for meeting the conditions. That didn't produce an answer and so I did try smaller steps and included negative numbers. I now know that I should have found the answer then but for some reason my program didn't produce the result.  Wanting to at least find the ballpark , I thought about ways to plot these three conditions on a graph. A 2d graph wouldn't really do it because we want to test all values of x and y. I tried using some 3d graphing systems to plot z=x+y, z=x*y and z=x/y,  to see where they all intersected.  But it w