Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.lang.basic > #851

Re: Computer guesses your number

From Physfitfreak <Physfitfreak@gmail.com>
Newsgroups alt.lang.basic
Subject Re: Computer guesses your number
Date 2023-12-29 18:26 -0600
Message-ID <umno3r$ij1s$2@solani.org> (permalink)
References <u01ec6$55qd$18@dont-email.me> <umfuji$culb$3@solani.org> <XnsB0E7A5BC8C5B7auricauricauricauric@135.181.20.170> <umig0f$eaer$3@solani.org> <XnsB0E8EDA66DB89auricauricauricauric@135.181.20.170>

Show all headers | View raw


On 12/29/2023 12:21 AM, Auric__ wrote:
> Physfitfreak wrote:
> 
>> On 12/27/2023 5:17 PM, Auric__ wrote:
>>> Physfitfreak wrote:
>>>
>>>> On 3/29/2023 8:27 AM, F. W. wrote:
>>>>> 10 Rem       *** Computer guesses your number ***
>>>>> 20 Print "Welcome to the guessing game!"
>>>>> 25 untergrenze = 1 : obergrenze = 0 : versuch = 0 : anzahl = 0
>>>>> 30 Input "To what maximal number will you guess";obergrenze
>>>>> 40 Do
>>>>> 42  versuch = untergrenze + Int((obergrenze - untergrenze) / 2)
>>>>> 43  anzahl = anzahl + 1
>>>>> 46  Print "Zwischen ";untergrenze;" und ";obergrenze
>>>>> 50  Print "I guess ";versuch
>>>>> 60  Input "g(reater, s(maller, i(t is it!";antwort$
>>>>> 63  Select Case antwort$
>>>>> 64    Case "g": untergrenze = versuch : Print "Okay, greater..."
>>>>> 65    Case "s": obergrenze = versuch : Print "Okay, smaller..."
>>>>> 66  End Select
>>>>> 70  If antwort$ = "i" Then 90
>>>>> 80 Loop Until antwort$ = "i"
>>>>> 90 Print "I needed ";anzahl;" tries. I remain a math-champion!"
>>>>>
>>>>> FW
>>>>
>>>> What language is this program in?
>>>
>>> It looks like a mashup of GWBASIC and QBasic. Some form of Microsoft
>>> BASIC anyway.
>>> - GWBASIC: No "DO" or "SELECT CASE". Change the DO-LOOP to WHILE-WEND,
>>>    and SELECT CASE to IF-ELSE, and it should work, but I'm not going to
>>>    bother.
>>> - QBasic: No line numbers inside SELECT CASE, but if you run it through
>>>    REMLINE.BAS it works. (Also in FreeBASIC
> 
> using '-lang qb' or '-lang fblite'.)
> 
>>> It works in QB64 and Bywater BASIC if you use capital letters in the
>>> inputs. (Why capitals, I don't know.)
>>>
>>> If you delete line 10 it works in Chipmunk Basic.
>>>
>>> It *doesn't* work in BBS BASIC,
> 
> Whoops. BBC BASIC.
> 
>>> PowerBASIC, PureBasic, or True Basic.
>>>
>>> Also, line 70 is probably unnecessary. Just sayin'.
>>
>> It doesn't compile in latest version of FreeBASIC; it would need
>> declaration of the variables, to begin with.
> 
> Sorry, oversight on my part, corrected above. (I don't use FB's dialect; my
> script to call fbc includes the appropriate -lang needed for the source.)
> 
>> Who would just post a BASIC program presumably for others to try,
>> without specifying what flavor of BASIC it got compiled on? I think the
>> poster wasn't serious about what he wanted to do.
> 
> Serious or otherwise, at least he tried. This group is effectively dead,
> along with most of Usenet, so [shrug]. Anyway, it's not like anyone else is
> posting code here. So here, code for a random BASIC dialect. Have fun.
> 
> /*
>      Actual BASIC code for an actual BASIC compiler (including this comment).
>      Good luck figuring out which one.
> */
> 
> SUB INTRAND(min as INT,max as INT),INT
>      RETURN RAND(min,max)
> ENDSUB
> 
> OPENCONSOLE
> DO
>      LOCATE INTRAND(1,25),INTRAND(1,80)
>      PRINT "#"
> UNTIL INKEY$ <> ""
> CLOSECONSOLE
> END
> 


You are way more proficient in BASIC than I am.

I knew BASIC and C (and FORTRAN) decades back. I've forgotten all that 
and need serious refreshing so I could write some simple programs for 
fun. I first chose BASIC thinking it would compile faster, but after I 
installed FreeBASIC and ran a few very simple codes I noticed that 
compiling was way too slow for me. So as of now, I'm aiming at 
refreshing of C++, not BASIC.

I understand that today's BASIC compilers first convert the codes to 
C++, then compile the newly created code using Windows supplied C++ 
compiler. This takes too long, and I suspect this has something to do 
with the decline of BASIC language today.

I remember how fast (or slow) compiling of BASIC code was decades back 
on DOS. They were much faster than today's compilers which first convert 
the code to C++.

Is there a way to compile BASIC code today, on Windows or Linux, without 
changing the code first to C++? I'd appreciate if I could get your input.



Back to alt.lang.basic | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Computer guesses your number "F. W." <me@home.com> - 2023-03-29 15:27 +0200
  Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2023-12-26 19:28 -0600
    Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2023-12-27 23:17 +0000
      Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2023-12-27 18:37 -0600
        Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2023-12-29 06:21 +0000
          Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2023-12-29 18:26 -0600
            Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2023-12-31 19:18 +0000
              Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-02 20:47 -0600
                Re: Computer guesses your number Gordon Henderson <gordon+usenet@drogon.net> - 2024-01-03 15:17 +0000
                Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2024-01-03 21:16 +0000
                Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-03 23:20 -0600
                Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2024-01-04 22:09 +0000
                Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-05 20:41 -0600
                Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2024-01-06 19:30 +0000
                Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-07 16:41 -0600
                Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2024-01-08 03:21 +0000
                Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-26 19:03 -0600
                Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-26 23:16 -0600
                Re: Computer guesses your number "Auric__" <not.my.real@email.address> - 2024-01-27 05:41 +0000
  Re: Computer guesses your number Gordon Henderson <gordon+usenet@drogon.net> - 2023-12-30 21:32 +0000
    Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2023-12-30 20:20 -0600
      Re: Computer guesses your number Gordon Henderson <gordon+usenet@drogon.net> - 2023-12-31 08:02 +0000
        Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-02 20:07 -0600
          Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-02 20:35 -0600
            Re: Computer guesses your number Gordon Henderson <gordon+usenet@drogon.net> - 2024-01-03 15:10 +0000
              Re: Computer guesses your number Physfitfreak <Physfitfreak@gmail.com> - 2024-01-03 23:22 -0600

csiph-web