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.

Messages - Richey

Pages: [1] 2 3 ... 10
Thanks B+

I'll look to re-write my code when I have time for programming again  ::)

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...

Code and examples / Re: DJPeter Math Solver in o2
« on: 28. July 2017, 09:24:43 »
Hey you're still alive! You make a fine point about JB and I did forget about LB also!!!...I learn my ship through forums now that they don't write books for this stuff. People are more fun than books anyway, ... well... they can be. ;-))

PS It was the EVAL with () that Richard posted at JB forum that had me downloading LBB again. Alas, that post, that whole thread was deleted without explanation.  >:(

Hi B+


You could always still visit the JB forum but have you thought about joining the LB Booster conforum as well? I see that Aurel is a member. I'm sure that Richard and the community would appreciate your code examples, which you could post under the 'Showcase' section.

Best wishes


Code and examples / Re: DJPeter Math Solver in o2
« on: 26. July 2017, 23:28:29 »
I thought that most BASICs had some sort of EVAL function built in that can evaluate pretty much any expression you care to give it? I know Sinclair BASIC back in '82 (and possible as far back as '80) definitely had one.

Code: [Select]
5 REM Sinclair BASIC and SpecBAS
10 PRINT VAL ("1 + 2")

Yes, the old ones (and the re-imagined old ones  ;)) are the best  :)

Code and examples / Re: DJPeter Math Solver in o2
« on: 26. July 2017, 23:21:11 »
EVAL...It is in Liberty Basic and maybe the LB Booster (I think, if Richey is still looking in he might verify.)

I still check in now and again when I can find the time  :)

Yes, LBB does indeed have EVAL

Code: [Select]
PRINT EVAL ("1 + 2")

output = 3

Btw I'm not sure why people still use JB when LBB is also free to download and use and has the additional advantage of having all of the features of Liberty BASIC (which JB does not) but without the bugs  ::)

Offtopic / Re: Programming history
« on: 12. May 2017, 07:06:17 »

of course at the time I had my hands full managing a job...

...I like the funny clothes and haircuts we once had.

Sounds like me now  :)

Interestingly, the second link contains a defence of BASIC in the programme following a call from a viewer during a phone-in slot.

Offtopic / Re: Programming history
« on: 11. May 2017, 21:43:37 »
Yes, I remember it well.

There was also this - Making the Most of the Micro

and this...BBC Micro live (this episode being introduced by a rather interesting character)

Also well worth watching is Micro Men. A docudrama based on the battle between Sinclair and Acorn back in the day (you might recognise Martin Freeman as Bilbo in the film version of the Hobbit). You can find it on youtube.

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 / Re: Wanted Poster
« on: 06. May 2017, 23:28:10 »
I prefer tea  :)

General questions and discussions / Re: ZX Spectrum Next
« on: 08. February 2017, 01:09:14 »
Still waiting...can't wait  :)

Community news and announcements / Re: Cross-platform BBC BASIC
« on: 02. February 2017, 19:32:08 »
But i really wonder who is this newb who will buy such a app for android :o

BBC-SDL is free.

Community news and announcements / Re: Cross-platform BBC BASIC
« on: 01. February 2017, 23:45:11 »
Another new version of BBC-SDL has been launched: Here is the link on the cross-platform conforum

This gives links to the site where it can be downloaded, plus details of the changes etc.

Of note, Richard has managed to get this version working on ARM-based Android devices as well as x86-based Android devices.

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 / Re: Birth of BASIC
« on: 03. January 2017, 07:37:32 »
Thanks for the link!

A great story about BASIC from the folks that wrote it.

Great video, Richey, thanks a lot!

You're both very welcome. I found the video to be very inspirational and to represent the best of human nature.

Pages: [1] 2 3 ... 10