Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Richey

Pages: [1] 2
I have come up with the following code in SpecBAS in response to a programming challenge to create an AI guessing game.

The aim is to get the computer to generate a random number and then for the computer to try and guess the number.

I can get the computer to eventually guess the randomly generated number but only through increments or decrements of 1.

Is there a way of getting the computer to reach the randomly generated number through a process of elimination as a human would, which may or may not necessarily be done through increments / decrements of 1?

Here is my code...

Code: [Select]
5 REM AI Guessing Game
20 LET AIChoose=INT(RND*100)
30 PRINT "The number is ";AIChoose
60 LET AIGuess=INT(RND*100)
80 DO
90 IF AIGuess<AIChoose THEN INC AIGuess,AIGuess TO 100
95 IF AIGuess>AIChoose THEN DEC AIGuess,AIGuess TO AIChoose
110 PRINT "Is it ";AIGuess;"?"
120 IF AIGuess=AIChoose THEN EXIT
130 LOOP UNTIL AIGuess=AIChoose
140 PRINT "Yes, the number I guessed was ";AIGuess;" and the number you chose was ";AIChoose
150 STOP

Many thanks in advance for any help. Any other suggestions for improvements would also be greatly appreciated.

Tutorials and articles / Under 5 Minute BASIC tutorials
« on: 30. July 2017, 00:36:39 »
A nice little site with 'less than 5 minute tutorials' in Sinclair BASIC

Originally posted at the World of Spectrum forums - ideal for people like me trying to squeeze programming time into their busy schedules...

Community news and announcements / Recent BASIC releases
« on: 10. May 2017, 00:10:20 »
Having been away for a while, I return to find not only a new version of SpecBAS (hooray!) but also new versions of BBC BASIC, Liberty BASIC and Liberty BASIC Booster too.

BBC BASIC for Windows version 6.10a

BBC BASIC for SDL 2.0 v0.17a for Win32, Linux(x86), MAC OS-X, Android and Raspberry PI (note this is free to download and use)

Liberty BASIC (currently released as v4.5.1 Beta 4)

LBB v3.07

Like London buses - you miss one and then several come along all at once!

Offtopic / ZXDB Game Search
« on: 03. January 2017, 22:00:13 »
Here is a database archive containing thousands of games, books, listings, hardward devices, interviews, downloads and more for the Sinclair ZX Spectrum.

Might be of interest to retrogaming and Spectrum fans.

Offtopic / Birth of BASIC
« on: 01. January 2017, 22:04:01 »
Very interesting documentary with Kurtz and Dartmouth Alumni describing the birth of BASIC at Dartmouth and the Dartmouth Time-Sharing System

One thing that really comes across in the video is how BASIC really democratised programming and made it available to the masses.

BASIC was not just for math, science and computer science graduates - it opened to world of programming to all.

Today, there is a renewed emphasis on trying to get more people and from all backrounds and abilities to learn to code; and so BASIC, it would seem, should be more relevant than ever.

Community news and announcements / BB4W Games Website
« on: 09. December 2016, 21:26:53 »
This site was down for a long time but is now back up and running. Many of the games have the source code available.

All written using BBC BASIC for Windows.

Community news and announcements / New Liberty BASIC Umbrella Forum
« on: 31. October 2016, 19:20:46 »
A forum has been created where all three implementations of Liberty BASIC - Just BASIC, Liberty BASIC v4.5.0 and Liberty BASIC Booster v3.06 - can all be discussed freely.

Community news and announcements / Logic BASIC
« on: 19. September 2016, 00:31:03 »
Logic BASIC for Windows and Linux

Nice IDE and good documentation and Help files.

Community news and announcements / Discorunner Successor: PERCOL-8
« on: 01. September 2016, 00:52:05 »
The authors of Discorunner are developing a successor.

Here is a link showing them demonstrating their prototype system to KFest 2016.

"Melody Ayres-Griffiths and her Australian wife April will be demonstrating the successor to their Apple II BASIC interpreter DiscoRunner, the Go-ported quasi-emulator PERCOL-8, a compatible, cloud-connected, 3D-enhanced update to the Apple II environment intended to introduce today's kids to 1980s computing "with the rough edges filed down and sparklers applied." PERCOL-8 provides numerous enhancements while maintaining compatibility with both Integer and Applesoft BASIC, 6502 machine code and Apple LOGO. These include cloud-based file services, an integrated BBS for messaging and chat, Internet multi-player gaming support, an OpenGL-based VDU, enhanced sound architecture, improved editing tools and a "piggyback" function syntax."

Here is the link to the video:

About dialect development / Writing a BASIC interpreter
« on: 15. August 2016, 22:23:31 »
Came across this on the web, which might be of interest to those wanting to write their own interpreter (looks familiar, might have been posted on - looks like you need to know C++ though...

Other Languages / C into the future
« on: 09. August 2016, 01:11:18 »
This is what TIOBE have to say this month about the C programming language

The C programming language has a score of 11.303%, which is its lowest score ever since we started the TIOBE index back in 2001. One of the main reasons for this drop is that C is hardly suitable for the booming fields of web and mobile app development. Moreover the C programming language doesn't evolve like the other big languages such as Java, C++ and C#. There is a "new" C11 standard available but this contains only minor changes. The constraint that C object code should remain small and fast doesn't help here. Moreover, adding C++ like features is also out of the picture because that's what C++ is for already. So C is a bit stuck. Yet another reason why C is getting into trouble is that there is no big company promoting the language. Oracle supports Java, Microsoft supports C++, C# and TypeScript, Google supports Java, Python, Go, Dart and JavaScript, Apple promotes Swift and Objective-C, etc. but none of them supports C publicly.

I don't know. Although there may be some truth in what they say, it seems a bit pessimistic to me.

They state that C "doesn't evolve like the other big programming languages" as if that should always be considered to be a problem. There are however be a lot of programs out there written in C, many of them quite old; constantly 'evolving' the language would create backward compatibility issues for a lot of software. The new C11 standard "contains only minor changes"; no doubt because not much needed to be changed!! If it ain't broke...

Worse, the article suggests that one of the reasons for this lack of evolution (stability I would call it) is the '"constraint that C object code should remain small and fast". I'm not entirely sure I would consider this to be a 'constraint'!

The logic of their argument seems to be, taken to the extreme, that the language should constantly change thereby creating backward compatibility issues and, in order to help this along, it should be open to becoming big and slow!

C may well have it's lowest popularity score on the TIOBE Index since 2001 but it is still at number 2 and more popular than all those other languages the article mentions, except Java, which can hardly be described as "getting into trouble". So, neither Microsoft, Google nor Apple supports C. Well, somebody does because it remains at number 2 in the index.

Okay, so C may well not be the most suitable language for mobile and app development and this is a growing area; but C is and remains suitable for many many other tasks: the right tool for the right job...

Offtopic / Aurel Google Python...and Go
« on: 08. August 2016, 23:31:59 »
Well, it seems that Aurel's conspiracy theory has some support...

TIOBE Index for August 2016

"Oracle supports Java, Microsoft supports C++, C# and TypeScript, Google supports Java, Python, Go, Dart and JavaScript, Apple promotes Swift and Objective-C"

There are plenty of old magazines and books out there containing Sinclair BASIC type-in listings.

It is not often however that you see a new book offering to do the same thing.

"ZX Spectrum Games Code Club" by Gary Plowman contains twenty Sinclair BASIC games listings for you to type in, learn from and extend.

Just get hold of BASin by Dunny (you will also find tutorials on this site, btw)

or an emulator if you don't have a ZX Spectrum to hand and away you go!

Offtopic / Huge home-built computer
« on: 09. July 2016, 23:50:20 »
I would love to go and see this

Perhaps he should donate it to the National Museum of Computing at Bletchley Park so that it can be seen by the public; looks like a home-made version of Colossus, the world's first electronic computer.

General questions and discussions / Assembly in TIOBE Top 10
« on: 09. July 2016, 23:41:46 »
Using their way of calculating popularity, TIOBE have recorded Assembly Language entering the top 10 most popular programming languages.

They attribute this to the increasing number of small devices, which benefit from being powered by Assembly.

Perhaps for the same reason, if true, we might see Forth gain in popularity once more?

Interesting also to see Perl back in the top 10 and COBOL still in the top 20.

BBC BASIC remains the only BASIC in the top 100; both purebasic and thinbasic seem to have dropped out of the listings.

Perhaps this is appropriate given the topic; BBC BASIC for Windows benefits from a built-in Assembler!

Pages: [1] 2