Retro Computing (on Steroids)

Advert

Retro Computing (on Steroids)

Home Forums Related Hobbies including Vehicle Restoration Retro Computing (on Steroids)

Viewing 25 posts - 1 through 25 (of 84 total)
  • Author
    Posts
  • #34459
    IanT
    Participant
      @iant

      Colour Maximite 2 – 3D BASIC Engine

      Advert
      #511974
      IanT
      Participant
        @iant

        I think many here may remember their first steps in "Home Computing" back in the late 70's and early 80's.

        An inexpensive SBC (single board computer) that booted immediately into interpreted BASIC could (with much laborious typing-in) deliver what at the time, seemed to be quite good games graphics. But if you needed real speed – then an assembler was always required.

        In 2011 Geoff Graham introduced his first monochrome 'Maximite' SBC, which was based on the PIC32 chip. This was quickly followed by the 'Colour' Maximite and then many versions of the MicroMite (for embedded control) – ranging from simple 28 pin DIL versions, scaling up to very fast Neucleo STM boards. All of these use a version of MicroMite BASIC (MMB) matched to the available hardware features but sharing a common language base .

        Earlier this year, the latest Colour MaxiMite (CMM2) was launched and attracted a great deal of interest. Some very gifted people have helped to develop and test the CMM2, which is ARM Cortex based. Since then, MMB for the CMM2 has been rapidly improved. Most recently a 3D 'engine' has been included into the MMB interpreter. To be clear, no external libraries are required – this is now a built-in feature of CMM2 BASIC.

        I know very little about graphics programming but I think the results are pretty remarkable. The following demos are both written in (interpreted) MM BASIC.

        CMM2 – 16-bit colour, 1335 vertices, 2452 faces

        (the full programme is listed by Peter Mather in his comments below the video.

        CMM2 – Rotating Ball with Ambient Lighting

        All of this is (of course) way beyond my programming abilities and I haven't purchased a CMM2 myself (although I've been tempted). I'm just using my 'Mites' for embedded control purposes. But I'm really impressed with how quickly this latest 'Maximite' SBC has been developed by just a few (very talented) enthusiasts.

        Regards,

        IanT

        #512074
        Kiwi Bloke
        Participant
          @kiwibloke62605

          A couple of weeks ago, I asked Santa for a CMM2. I'm hoping to get the original Silicon Chip Magazine kit version, rather than one of the ready-mades because fiddly soldering is part of the fun. I built an original Maximite shortly after publication in SC Mag. Very impressed, especially by the BASIC dialect. 'Real' programmers are apt to sneer at BASIC, but a lot are out of touch with modern dialects, and don't like it when reminded that it can take feet of code in 'proper languages' to do what a modern BASIC can do in a few lines.

          Edited By Kiwi Bloke on 07/12/2020 04:02:44

          #512083
          Frances IoM
          Participant
            @francesiom58905

            Practical Electronics published in the UK was until the recent change in ownership and name derived most of its copy from the Australian Silicon Chip Magazine which pushed the Micromite very strongly – PE now seems to be more favourable towards Arduino + RaspberryPi projects which introduce Linux via the backdoor which software seemed anathema to the previous owner who always pushed Windows software.

            #512090
            Michael Gilligan
            Participant
              @michaelgilligan61133

              Please forgive my digression away from hardware, but I must mention an iPad App

              **LINK**

              https://apps.apple.com/gb/app/basic-programming-language/id1540244170

              I have already protested [to no avail] about Mr. Kibernetic’s non-standard interpretation of INT, but aside from that … it is quite astonishing.

              MichaelG.

              #512117
              Martin Connelly
              Participant
                @martinconnelly55370

                I've still got my UK101, don't know if it still works and I'm not sure I have a TV that will work with its signal now that everything is going digital.

                Martin C

                #512145
                Bazyle
                Participant
                  @bazyle

                  Yep, UK101, cheaper than a Nascom 2. I had a wordprocessor on it that was just 2k bytes. What does Word need nowadays?

                  #512156
                  IanT
                  Participant
                    @iant
                    Posted by Bazyle on 07/12/2020 12:07:03:

                    Yep, UK101, cheaper than a Nascom 2. I had a wordprocessor on it that was just 2k bytes. What does Word need nowadays?

                    Happy days awaiting awaiting the latest edition of Practical Computing (and if I was feeling a bit flush 'Byte' )

                    The UK101 was very similar to the Ohio Scientific, both being 6502 based but I finally (after much agonising) decided a proper 'bus' was a good very idea and selected the Nascom 2 (Z80 based) . I think it was about £300 with the PSU and came as a large PCB and a bag of components. Several days (and many dry-joints) later, my wife couldn't understand why I was so happy with the red LED flashing on and off.

                    Wife " What's it doing?" – Me "It's flashing the light on and off every second "

                    Wife " Yes – but what's it doing?" – Me "I've programmed it to turn that light on and off every second "

                    Wife "Is that all it does? " [short pause] " And what did you say it cost? "

                    frown

                    Regards,

                    IanT

                    #512173
                    SillyOldDuffer
                    Moderator
                      @sillyoldduffer
                      Posted by Kiwi Bloke on 07/12/2020 04:01:46:

                      … 'Real' programmers are apt to sneer at BASIC, but a lot are out of touch with modern dialects, and don't like it when reminded that it can take feet of code in 'proper languages' to do what a modern BASIC can do in a few lines.

                      For real retro, there's Programming Like its 1975.

                      There are good reasons why 'real' programmers sneer at BASIC. Glass ceilings!

                      I've been paid to write code in at least 18 languages, including BASICs and reported on the pros and cons of others. For fun, I've dabbled with 11 more. Latest is Process, ideal for wow graphics.

                      In my view computer languages are as different as screws and nails, or tanks and racing cars. It pays to look for the best choice. Plenty on the shortcomings of BASIC about, mostly well founded! But they may not matter in amateur work because they only bite big projects. Apply the 'so what' test.

                      All computer languages have advantages and shortcomings, for example:

                      • Algol-60. Mathematical language, clean syntax and structure, poor IO, unsuitable for data processing. Poor team support. First language I liked, but useless for my job.
                      • Fortran. Efficient maths. Grubby syntax and weak structure, but fast. Support for teams and linkage to other languages. Yuk. Wrote it because I was ordered to.
                      • COBOL. Data Processing language. Verbose syntax & weak structure. Good support for team development and linkage. First successful business 3GL. Multiple variants, common. Low productivity, not used for new projects. Nasty, but it paid the bills.
                      • Filetab. Report Generating Language. Brilliant for tabulating data created by COBOL. Not recommended for problems requiring more than 4 pages of code. Liked it very much, but not its glass ceilings.
                      • 4GLs (Forte, Informix etc). Excellent for database work. A good way of earning a crust, but boring.
                      • Pascal. Academic language inspired by Algol. Good structure and syntax, weak team support. Good for teaching, less suited to commerce, and slower than Fortran at maths. Like but don't use it – glass ceilings again.
                      • C. Systems programming language inspired by Algol. Low-level, fast and space efficient, capable of anything – the language other languages are written in. Deceptively simple syntax with dangerous shoals relying on the programmer to get it right. First rate support for multi-million line projects. Portable unless platform specific features are used. Maths reasonably fast. Loads of libraries. Love it! Good mix of challenge and can do.
                      • C++. Object oriented super-set of C – C on steroids. Wonderful, except full throttle object oriented programming is hard. Fun to write if the advanced features are avoided. Almost anything is possible. Love it apart from the spikes!
                      • Visual Basic and Gambas. BASICs for Windowing applications. Excellent for but don't scale well. I like both of them for certain jobs. More glass ceilings.
                      • bash, George 3. Job Control Languages. All nasty in my experience, but essential when programs operate in sequences. Server rather than home user work. perl and Python are useful as JCLs because they're easier to write and maintain. Up to a point!
                      • perl. Reporting and system scripting language. Built in pattern recognition and other text processing features. Back in the day, superb. Clean structure but spiky syntax that doesn't support later object oriented features cleanly. Today, Python rules the roost.
                      • Python. Batteries Included. Exceptionally clean structure and syntax. Powerful & reasonably efficient. Programmer friendly and highly productive. Does beginner & grown-up computing equally well. Massive 3rd-party module support. Team friendly. Contender for 'best computer language', but not ideal for Windowing applications, too heavy for most microcontrollers, and too slow and distant from the hardware to be a high performance systems language.

                      These days I do almost everything in C++ and Python. Almost all computers support C++, which simplifies moving from one platform to another.

                      Although BASIC is a poor choice for me that doesn't mean it's rubbish! It could be exactly what's needed. Micromites are ideal for chaps who know BASIC from the BBC/Spectrum era and want to program a microcontroller.

                      Compared with C, BASIC takes up more memory, runs slowly and has weak system programming features. BASIC struggles with linked lists, deques, stacks, atomicity and micro-efficiency. BASIC remains capable until an advanced feature is needed, or tight fast code is of the essence, at which point crunch. The crisis might never happen, but pro's can't take the risk. 'Real programmers' don't like languages that run out of steam.

                      Dave

                       

                       

                      Edited By SillyOldDuffer on 07/12/2020 14:41:15

                      #512185
                      john halfpenny
                      Participant
                        @johnhalfpenny52803

                        Back in 1970/2, when I did an A level in computer science, Basic was the teaching language of choice, just overtaking Fortran, Cobol and Algol. I remember at college in 1974 that calculators were banned in exams (until 1976). A Datamath four function (+-÷&timescalculator cost about £50 – I didn't buy one; you could buy a very good car with 12 months MOT for that. By 1976 we could get a full scientific CBM calculator for £15, and mine still works.

                        #512209
                        Squint
                        Participant
                          @squint

                          The problem with Basic computer language is the name. I used TrueBasic by the originators of the original basic language, a structured and improved Basic. Speed seems to be the bug bear of opponents of Basic. But what does a fraction of a second matter to a bigger fraction of a second? TrueBasic was my go to computer programming language. Later in life while wanting to programme PICs I used assembler(assembly) programming language, mainly for decoding digital calipers. Python seems a peculiar programming language in that indents are part of the essential formatting. Model Engineers like to use old machines and methods but seem to disapproved of old programming languages.

                          #512231
                          SillyOldDuffer
                          Moderator
                            @sillyoldduffer
                            Posted by John Smith 18 on 07/12/2020 17:02:23:

                            Speed seems to be the bug bear of opponents of Basic. But what does a fraction of a second matter to a bigger fraction of a second? …

                            Python seems a peculiar programming language in that indents are part of the essential formatting. Model Engineers like to use old machines and methods but seem to disapproved of old programming languages.

                            Well this old programmer disapproves of old programming languages because they're primitive. Modern versions of old languages are better but still saddled with various restrictions. TrueBasic is only available for Windows. It doesn't run native on Apple, UNIX, Linux, Android or any microcontroller. That's a glass ceiling.

                            Python's strictly enforced indentation rules do seem strange at first but the idea works well. It's difficult to write badly structured code in Python because it doesn't allow bad habits.

                            Speed is a good question. Application programmers rarely need to worry about it, though I was once called in to advise on a weekend process that took 3 days to finish and stopped Monday from happening! However, that was unusual. Obsessing about the efficiency of an application program is bad.

                            System programmers are much more concerned with performance because most of the system is time-critical. Bad things happen when a network interface clogs up and causes time-outs. And whenever the computer can't keep up with users, including other computers spewing data far faster than a human can type. Tiny computers are a problem too – my current Arduino project requires me complete all the processing caused by an event within 4mS. Not something BASIC could do, starting with it being too big to fit on the machine. Same problem with Python – I love it dearly, but it's no good for that particular job.

                            Horses for courses!

                            Dave

                            #512235
                            Squint
                            Participant
                              @squint

                              I totally agree with all your comments Dave.

                              But we are hobby programmers, like we use hobby machines, for our own enjoyment and pleasure. We do not use industrial machines and methods (in general) for our pastime.

                              Our time is purely for our own pleasure. If our programme provides us with the result we want does it matter whether it is written in Basic, C++, assembler or machine code? We are in a hobby world of anything goes as long as it works.

                              Btw TrueBasic was originally for Dos, Windows, Mackintosh and Linux. I still have a linux installation disk, if only I could figure out how to install a tar ball. lol regards John.

                              Edited By John Smith 18 on 07/12/2020 19:15:08

                              #512254
                              IanT
                              Participant
                                @iant

                                For anyone who would like to 'sample' MicroMite Basic (MMB) there is a version for PCs (I run it on my Win 10 laptop). It doesn't have many of the features that other versions of MMB have, such as all the communication, display and external I/O options – but it does support Serial Comms and the PC's disk filing system. So I can read and save .cvs files for instance (usable by Excel) and also open COM ports.

                                " This interpreter runs in a DOS box under the Windows operating system and will work with Windows versions from Windows XT through to Windows 10. It does not need installation, you just copy the executable to a convenient location on your computer and run it from there. "

                                MMB for PCs

                                If you find MMB isn't for you, you can just delete the .exe file and it will be gone – it's that simple. It won't change anything on your PC.

                                Here's a Change Wheel programme (that I spotted in MEW 277) you can use to try MMB with. Just Cut & Paste it into a Notepad-type document (not Word! – I use Notepad++) and save it with a .bas file extension. You can then load it into MMB.

                                '
                                ' Change Wheel Calculation
                                ' by Mike Aireton – from MEW 277 Feb 2019
                                '
                                Cls
                                Input "Input required TPI ", W
                                Input "Input deviation ", Z
                                '
                                X = W + Z
                                Y = W – Z
                                '
                                For A = 20 To 75 Step 5
                                For B = 20 To 75 Step 5
                                For C = 20 To 75 Step 5
                                For D = 20 To 75 Step 5
                                '
                                If A = B Then GoTo SKIP
                                If A = C Then GoTo SKIP
                                If A = D Then GoTo SKIP
                                If B = C Then GoTo SKIP
                                If B = D Then GoTo SKIP
                                If C = D Then GoTo SKIP
                                '
                                ' Assumes 8 TPI Leadscrew
                                '
                                If A*B*8/C/D < X And A*B*8/C/D > Y Then Print C;" "; D; " "; B;" ";A*B*8/C/D
                                '
                                SKIP:
                                Next D
                                Next C
                                Next B
                                Next A
                                '
                                Print "DONE!"
                                End

                                Mike said it ran on his PC/Basic in about 15 seconds – but it runs on mine in 2-3 seconds. Fast enough.

                                Regards,

                                IanT

                                #512264
                                Bazyle
                                Participant
                                  @bazyle

                                  There are several computer languages. How many do you know? see this little list. Time was every student computer programmer wrote one as a final year project. Perhap they still do.

                                  Basic is interpreted which makes it easy for beginners to cycle round testing their program. That was part of teh concept. Wasn't so easy with Fortran punched cards submitted for batch processing. I think the main reason Python has taken off is that it is introduced with an interpreter that can be easily loaded on a 'pc'. Despite the origniator's claims that he invented it from scratch (sorry not meeaning the language) it is a kludged mix of Basic and Perl.

                                  increased speed and memory just encourages bad prgramming and bad languages. You shouldn't need the get spaces and brackets and formatting to some special format, the computer should work that out for you.

                                  #512331
                                  Kiwi Bloke
                                  Participant
                                    @kiwibloke62605

                                    Yes, as SOD said, 'Horses for courses'. I'd imagine that most of us who will only ever scrabble around in the dirt, as far as programming is concerned; glass ceilings are never going to be a limitation. The great thing about the Maximites is the versatility of the hardware, coupled to an easy-to learn, sophisticated language, that just seems ideal for the basis of, for instance, a 'digital leadscrew' project, or similar. It makes the physical and intellectual interfaces easier than anything else I've come across.

                                    Thanks, SOD, for the overview of some languages – illuminating. You didn't respond to my assertion that, for 'our kind of application' at least, a suitable BASIC might do the job in far fewer lines of code than something more 'proper'. We're talking quick and dirty, not a bank's financial system, after all.

                                    In the early 1970s, I spent some time, as a student, in a MOD research lab, and had the use of a DEC PDP12 computer, running FOCAL. This was, I think, DEC's version of a BASIC-like language. Armed only with the manual, it was teach-yourself time. I rapidly realised that GOTOs, DO loops, and jumping all over the place to line numbers was a good way to create a real mess, so I broke my programs into little modules which were, in effect, called, as needed, by a very simple main program. I gather that was a rather unusual approach at the time, but it made editing and bug-chasing easy. Now, modern BASICs seem to have this facility built-in, with user-defined functions, etc.. Spaghetti code is no more?

                                    #512352
                                    SillyOldDuffer
                                    Moderator
                                      @sillyoldduffer

                                      Here for comparison with BASIC is Mike Ayrton's change wheel program in Python3

                                      changepy.jpg

                                      On my machine, for 26tpi, it runs in 0.07309572899976047 seconds.

                                      Mike's version ran in 15 seconds and Ian's in 2 or 3 seconds. For a singleton user, both are perfectly acceptable. It wouldn't matter if it took the computer a minute or two. BASIC is fit for purpose.

                                      But what if the same calculation is done on a website serving several thousand users? How many users can be satisfied by each version in a minute?

                                      • Mike: 4
                                      • Ian: 30
                                      • Dave: 820

                                      And my version can serve up to 13 users in under a second so they don't realise there's a delay at all. The same 13 users wait between 15 and 195 seconds to get an answer from Mike. Most online users start twitching if they have to wait for more than a few seconds, and because most servers can only queue a limit number of requests, they drop users to avoid overloading – they never get an answer.

                                      Dave

                                      #512367
                                      Nick Clarke 3
                                      Participant
                                        @nickclarke3

                                        Teaching blind and visually impaired students I use an old, text only version of BASIC to introduce programming lower down the school because it runs in a single text window that screen readers can follow.

                                        Python is problematic for a few reasons – firstly the forced indentation is interpreted differently depending upon the editor used – either a single tab character or 4 spaces. Next the default editor opens program results in a new window which can be difficult to navigate to. The way round this is to install a different editor – but this requires a non standard installation which the network technicians were loathe to do. Finally the punctuation within longer words is ignored by screen readers so plt.plot(x, np.sin(x)) is read out as pltplot(x npsin(x)) for example.

                                        I have introduced a few more advanced pupils to text based C on a stand alone computer and this is probably the way to go in future, almost certainly on a Raspberry Pi.

                                        Dave – one more for your list ADA which used by the US military for projects because there are NO alternative versions from different manufacturers. It was also the language used to teach first year undergraduates at a large Uni near here in the 90's

                                        #512381
                                        SillyOldDuffer
                                        Moderator
                                          @sillyoldduffer

                                          Posted by Kiwi Bloke on 08/12/2020 10:48:05:

                                          …You didn't respond to my assertion that, for 'our kind of application' at least, a suitable BASIC might do the job in far fewer lines of code than something more 'proper'. We're talking quick and dirty, not a bank's financial system, after all.

                                          It's a fair cop guv! Although the source code of a simple program written in 'C' and BASIC are similar, C has substantial overheads. Apart from being low-level and harder to learn, the compiler is but one part of a complicated tool-set. There's an editor, preprocessor, type-strict compiler, and a linker to stitch user code, system code and libraries together. All these tools have multiple options, and there are yet more tools to address large project issues. For example, the 'make' utility understands which files needed to build a project, and is able to determine the minimum number that need to be recompiled when changes are made. So, it's not necessary to recompile the whole of Windows 10 every time a small change is tested. This is vital when a few thousand programmers are working on a project consisting of thousands of intertwined modules. In the same way, tools exist allowing multiple versions of code bases to exist in parallel, so past, current and future versions can coexist during development. One team will be bug fixing maintenance versions, another enhancing the current version, and a third working on the next. Careful management is needed to avoid chaos.

                                          Much of this is unnecessary overhead on singleton projects! BASIC was one of the early attempts to bring computing to the people, and I think the most successful. But, especially in the early versions, the programmer is insulated from the machine. As always tools are fit for purpose provided they do what's needed. My main objection to BASIC is it's limitations, which don't matter until they bite! Python has considerable advantages over BASIC:  to anyone wanting to learn programming, or tackle more advanced work, it's gold.

                                          No computer language is perfect, and – so far – attempts to produce a good all rounder have failed. Ada is probably the closest, but it's not popular for several reasons. The road to hell is paved with good intentions!

                                          Dave

                                           

                                          Edited By SillyOldDuffer on 08/12/2020 13:33:10

                                          #512388
                                          Bazyle
                                          Participant
                                            @bazyle

                                            LIke it matters unless your lathe cuts at 50krpm

                                            Person A "My dick is bigger than yours"
                                            Person B "I've seen bigger. By the way I'm a woman"

                                            #512406
                                            John Haine
                                            Participant
                                              @johnhaine32865

                                              I have sort of learned Python to program the Pi that logs my clock data, and though it was difficult at first I got the hang of it quite quickly. I love the indentation, it's great for making the structure clear and you don't get confused forgetting to put in }s and {s or putting in too many. But it's easy to get very confused by other aspects. And Pythonistas seem sometimes to have a funny attitude to users.

                                              For example, I needed to do some RF circuit simulation recently and was pointed at a free Python package called Scikit-RF. As an RF engineer I found it completely useless as it didn't let me describe my circuit in any way that was remotely familiar. The industry leading package lets you draw circuit diagrams and arrangements of transmission lines and extracts useful performance graphs that look just like the ones you get off the test equipment. It may be a great program, and extremely powerful, but it desperately needed a simple front end to hide away the actual software doing the work. Horses for courses as always.

                                              #512407
                                              Robert Atkinson 2
                                              Participant
                                                @robertatkinson2

                                                Well there any many versions of BASIC. SOD said " Compared with C, BASIC takes up more memory, runs slowly and has weak system programming features." and Bazyle said " Basic is interpreted.." Neitherof these is strictly true. For starters there any complied BASICs. I use one, PBP3 (Pic Basic Pro 3.)This as you might expect runs on a PIC. I'm no programmer but have used PBP for hobby and commercial applications. I once wrote PBP code to drive a prototype machine that had two DC motors, a stepper and a serial interface. Fitted easily into a 8 bit 2K PIC 16F. So with prototyping done it was handed to the "proper" programmers some ime later they came back asking for more memory! They were using a C compiler costing a lot more than PBP bu, amonst other issues, were not accessing the hardware features of the chip. Were I'd used a internal UART They were bit banging the serial! Long story short the production units used my code.

                                                It is also not fair to compare languages for the change wheel program unless they were all run on the same hardware. Python on a RPi4 will be faster than Basic on a 4MHz PIC!

                                                As others have said Horsees for courses.

                                                Do look at PBP3 though, there is a free verson for hobbyists and you are not tied to specific hardware (the free version only works with a limited, but useful selection of PICs) http://www.pbp3.com

                                                Robert G8RPI (the RPI was issued at random back in 1978, nothing to do wth Raspberrys)

                                                #512411
                                                Squint
                                                Participant
                                                  @squint

                                                  Another useful programing language/aid is Excel. It already has the output screen built. And by using Visual Basic for Applications one can write a programme, see the results and get an automatic CAD output. (Not sure what CAD means nowadays, in my days it meant Computer aided Drawing/Draughting but I think that now it means Computer Aided Design, hey ho).

                                                  Micromite backpacks are very useful and make a lot of projects very easy https://geoffg.net/micromite.html

                                                  Edited By Squint on 08/12/2020 15:56:42

                                                  Edited By Squint on 08/12/2020 16:00:14

                                                  #512430
                                                  IanT
                                                  Participant
                                                    @iant

                                                    As usual it's about context Dave. Everyone who visits this Forum is different – they have different skills, interests, available time and funds.

                                                    In the past year or two, I've dived into 3D Printing, learned a little Open SCAD, spent time working on Solid Edge 3D CAD, finished a few workshop projects and (even) progressed some of my Gauge '3' locos (and finally built a rolling road too). I have an old house (in a large garden) that also needs a lot of my attention. So my "context" is that I'm of an age where I've started to think a lot more carefully about what new things I begin and even if I can keep up with everything I've already started.

                                                    It would be nice to have the time to explore new tech and I have been tempted. If my Grandson continues with his interest in 'Robots', then I might dive into Python and ROS and help him (although the 'Black Boxes' he'd be talking to will have a 'Mite' inside them). But clearly something else would have to give.

                                                    I have tried other 'tech' and discovered that within my 'context' – e.g. an ageing brain, no professional 'coding' background and many other demands on my time – the Micromite has been a very good solution for my particular needs.

                                                    As Kiwi commented "It makes the physical and intellectual interfaces easier than anything else I've come across." In other words, you don't need to be a Computer Scientist to use them and that's the key thing for me.

                                                    Regards,

                                                    IanT

                                                    #512455
                                                    SillyOldDuffer
                                                    Moderator
                                                      @sillyoldduffer

                                                      Here's a simple Xmas programming challenge for programmers using any language. It is possible in BASIC.

                                                      Psuedo-code

                                                      Input an integer
                                                      loop:
                                                      create a copy and reverse it
                                                      add the two together
                                                      print the sum
                                                      if sum is a palindrome, print it and stop
                                                      else go to loop and reverse-sum again

                                                      EXAMPLES

                                                      Example 1:

                                                      input: 27
                                                      reverse = 72
                                                      sum: 27 + 72 = 99
                                                      print sum
                                                      stop because 99 is a palindrome.

                                                      Example 2:

                                                      input 28
                                                      reverse = 82
                                                      sum: 28 + 82 = 110
                                                      print sum

                                                      loop because 110 is not a palindrome

                                                      reverse = 011
                                                      sum: 110 + 011 = 121
                                                      stop because 121 is a palindrome

                                                      Example 3:

                                                      palinout.jpg

                                                      Then try input 196.

                                                      Silver star awarded to all working programs. Gold stars for elegfant code. Execution speed and code size don't matter.

                                                      What's the biggest non-palindromic number generated from 196 before your program malfunctions?

                                                      To set the bar, my Python program for this one is 13 lines long.

                                                      devil

                                                      Dave

                                                    Viewing 25 posts - 1 through 25 (of 84 total)
                                                    • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                                                    Advert

                                                    Latest Replies

                                                    Viewing 25 topics - 1 through 25 (of 25 total)
                                                    Viewing 25 topics - 1 through 25 (of 25 total)

                                                    View full reply list.

                                                    Advert

                                                    Newsletter Sign-up