Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Conway’s game of life
Page 3 of 3 | |||||
Author | Message | ||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1619 |
TassyJim said elsewhere: But text can be different colours too. I guess that would that slow things down by defining the colour for each charactor if it were done that way? On that subject: The Introduction to Programming with the Colour Maximite 2 doc says: Can the colour of a pixel really be defined that way or was that just to make a point? Could it also be a constant? Can other commands use this method of specifying colour instead of RGB()? Can I use: CONST PUCE = 13404313 and then: PIXEL 400, 300, 13404313 Bill Keep safe. Live long and prosper. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9172 |
The CMM2 is exactly the same as all the Micromites. Colours are a 24bit number with the bit layout rrrrrrrrggggggggbbbbbbbb. This is then translated by the firmware to match the display RGB888, RGB565, RGB332. The RGB function is just a simple way of creating that number. It becomes a bit more obvious if you express the number in hex &HFF0000 is red, &H00FF00 is green, &H0000FF is blue. Therefore, of course, you can use constants or any other way of storing the number |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9172 |
Note to Jim: make your cells a multiple of 4 pixels wide and start them all at x coordinates exactly divisible by 4 then try the BLIT timings again. |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6108 |
The text version uses text x * DIAM, y * DIAM,"O","LT",1,1,col with 'col' changing depending on the desired state. I have decided that BLIT with a 'thing' that looks remarkably like the corona virus looks best, as well as fastest. Jim VK7JH MMedit  MMBasic Help |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9172 |
Jim If you are playing "what is the fastest?" then use the BOX command with arrays as the parameters. Construct arrays holding the coordinates of the cells and an array holding the colours. Then each generation will just update the colour array. A single call to BOX will write the entire screen. Arrays as parameters to graphics commands have been in all my MMX and Armmite versions but haven't really been picked up on. They make a huge difference in performance as the parsing overhead is nearly completely eliminated. You can do this with the circle command as well but circles take more processing than rectangular boxes. Edited 2020-05-11 19:55 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
LOL my daughter could manage a pretty good rendition of that song at age 3 after I used to sing it to her whilst changing nappies. Nope, just an 8 pixel column at a time. Though if it is possible I'd like to do it how you suggest. At the moment I'm having to send a bunch of no-ops to the Max7219 to select the correct matrix and I'm not sure that should be necessary, I had thought I could send in all the data in order and it would just shift down the chain. TBH I've had a bit of a 'mare with these cheap Chinese modules, they were presoldered and the header pins are all over the place, and I don't have the skills or tools to desolder through plated holes with any reliability, I ended up having to make the female "mounting" headers on my board just as wonky and leaving some of their headers just hanging. They also seen to pick up interference from the fluorescent lights in my workspace, when I turn the lights on and off the matrices respond. That plus I haven't found a reliable way to reset the Max7219 (other than powercycling the CMM) has made life "fun" and behaviour unpredictable; I spent a week chasing what I thought was a hardware failure only to find a bug in my code Only in passing. My code is based on an article in EPE by the WhiteWizard where he was bit banging a single module. I converted that to SPI and then worked out how to drive multiple modules, but as alluded to above I don't think I am doing this in the most efficient manner. I'll dig into that article a bit closer when I have the time, though that code has far too many global variables for me to from easily grok and the SPI function seems significantly different between MMBasic 4.5 and 5. Best regards, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
Hi Jim, This suggests you might have a CMM2 compatible version of Life that isn't posted to the forum. If that is the case is it something you'd be willing to have included in the "Welcome Tape" (distributed under The Unlicense)? Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6108 |
https://www.thebackshed.com/forum/ViewTopic.php?TID=12159&P=3#149472 Jim VK7JH MMedit  MMBasic Help |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
Thanks Jim. Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
Wow that's looking really neat Jim, thanks to you (and Bill) for letting me include it on the "Welcome Tape". Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1619 |
Sorry but I couldn't resist one small change. Jim has done a great job (as always) but I don't like the different colours for the different stages of 'life' so I added a choice to change to a single colour if you want to. life2_2.zip Bill Keep safe. Live long and prosper. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
life2_2.zip Bill Did you change the colour for the "dying" cells as well ? I haven't looked at Jim's code in depth, but if it still shares some ancestry with my multi-coloured original then strictly speaking by the rules of Conway's Game of Life those cells should actually not be depicted. Regards, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6108 |
The option to colour the dying cells was always there for the preset cases. ' seeds are pairs of x,y cells ending in -1 then 0 or 1 for coloured dying cells I agree that it is not part of the original game which is why I made the colour dark. Jim VK7JH MMedit  MMBasic Help |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
To be clear, I added multi-coloured cells to Bill's original. Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Turbo46 Guru Joined: 24/12/2017 Location: AustraliaPosts: 1619 |
Yes. I just extended the menu to: do nothing and leave as is or make all displayed cells either yellow green or blue. Also explains what the different colours mean. Bill Keep safe. Live long and prosper. |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4048 |
The implementation included in v0.2 of the Welcome Tape can be found here: https://github.com/thwill1000/cmm2-welcome/blob/d04f287dbd7387dda69669ffdb408215fb9b4f78/life/life.bas I made some changes of my own, respecting Bill's wish to include the option of the original visualisation as well as the enhanced 3 colour version, but doing it in a different way. You can see a diff here: https://github.com/thwill1000/cmm2-welcome/commit/2ba8b552ac7341844b147eb20bb3f1d35e05e2a7#diff-1b45274fc998432c32f93c02f365c7a2 Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Page 3 of 3 |
Print this page |