flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Examples and Tutorials > Hobby Basic, a BASIC-like interpreter for Windows

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15324
Location: Bigweld Industries


filox wrote:
Sorry but where i can find sources of Hobbybasic?

Have a look at the first post in this thread.
Post 21 Oct 2016, 12:13
View user's profile Send private message Visit poster's website Reply with quote
system error



Joined: 01 Sep 2013
Posts: 671

This is good. Keep it coming, bro!
Post 22 Oct 2016, 13:32
View user's profile Send private message Reply with quote
filox



Joined: 13 Feb 2013
Posts: 10


revolution wrote:

filox wrote:
Sorry but where i can find sources of Hobbybasic?

Have a look at the first post in this thread.



No source, only EXE and Demo.bas
Post 26 Oct 2016, 12:24
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 6961
Location: ˛                              ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ Posts: 6699

hi filox,
you could try pm picnic for source etc
Post 26 Oct 2016, 12:36
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1211
Location: Greece

Hi filox, the source is not available, at least not yet. Hobby Basic has still some way to go. I want to extend the command list, find methods to make the intepreter faster, add features like user procedures with parameters and local variables and some other ideas i have. This is done somewhat slowly, the only days i can steal some time to work are the weekends.
Post 26 Oct 2016, 13:37
View user's profile Send private message Reply with quote
filox



Joined: 13 Feb 2013
Posts: 10


Picnic wrote:
Hi filox, the source is not available, at least not yet. Hobby Basic has still some way to go. I want to extend the command list, find methods to make the intepreter faster, add features like user procedures with parameters and local variables and some other ideas i have. This is done somewhat slowly, the only days i can steal some time to work are the weekends.



Hi picnic, if u can share code with us, we can help you possibly to improve it faster and i'm interested in it for educational scope Very Happy
Post 18 Nov 2016, 13:19
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1211
Location: Greece


Quote:
...and i'm interested in it for educational scope


Take a look at MINI-BASIC for fasm. It's a piece of code available for modifications.
Post 21 Nov 2016, 15:50
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1211
Location: Greece

I have uploaded a new version with bug fixes and various internal tweaking.

Simple Xs and Os game in Hobby Basic.

Code:

    rem  Xs and Os for Hobby Basic

    P1 fix m[x,y]
    P2 fix m[x+i,y+j]
    P3 fix m[x+i*2,y+j*2]
    screen 80,25
    cursor 0,0

start#
    color 0,7:cls:locate 0,15
    n=0:dim m[3,3]=0,0,0,0,0,0,0,0,0
    at 4,1,"Xs and Os"
    at 0,3,"Player X  vs  CPU O"
    paint 1,7,17,1,'_',0
    paint 1,10,17,1,'_',0
    paint 6,5,1,9,'|',0
    paint 12,5,1,9,'|',0
    @@at 0,15,"Play first? [y/n]"
    inkey:p=V0:if p=27 then end
    if p='y' or p='Y' then p=1 else p=0
    at 0,15,"Strong CPU? [y/n]"
    inkey:z=V0:if z=27 then goto @b
    do
        if p=0 then gosub cpu_move else gosub player_move
        gosub is_winner:p=p^1:n=n+1
    until w<>0 or n=9
    pen 7:erase 0,15,30,' ',0
    if w=0 then at 0,15,"Game was a draw"
    if w=1 then at 0,15,"Player X has won!"
    if w=2 then at 0,15,"CPU O has won!"
    at 0,16,"press a key":inkey:goto start

player_move#
    pen 7:at 0,15,"Player X''s turn       "
    @@mouse:x=(V0+1)/7:y=(V1+4)/3-3:btn=V2:wait 1
    if x<0 or x>2 or y<0 or y>2 or btn=0 then goto @b
    if m[x,y]=0 then m[x,y]=1:pen 10:at x*6+3,y*3+6,'X':return
    goto @b

cpu_move#
    pen 7:at 0,15,"CPU O''s turn          "
    b=0:cx=0:cy=0
    x=0:i=1:j=0:for y=0 to 2:gosub scoring:next y
    y=0:i=0:j=1:for x=0 to 2:gosub scoring:next x
    x=2:y=0:i=-1:j=1:gosub scoring
    x=0:i=1:j=1:gosub scoring
    m[cx,cy]=2:wait RND(1000)+400
    pen 15:at cx*6+3,cy*3+6,'O'
    return

scoring#
    r=0:k=0:s=0
    if P1=0 then r=x:k=y:s=1
    if P2=0 then r=x+i:k=y+j:s=1
    if P3=0 then r=x+i*2:k=y+j*2:s=1
    if P1=1 and P2=0 and P3=0 then r=x+i*2:k=y+j*2:s=2
    if P1=0 and P2=1 and P3=0 then r=x:k=y:s=2
    if P1=0 and P2=0 and P3=1 then r=x:k=y:s=2
    if P1=0 and P2=0 and P3=0 then r=x:k=y:s=4
    if P1=2 and P2=0 and P3=0 then r=x+i*2:k=y+j*2:s=8
    if P1=0 and P2=2 and P3=0 then r=x:k=y:s=8
    if P1=0 and P2=0 and P3=2 then r=x:k=y:s=8
    if P1=1 and P2=1 and P3=0 then r=x+i*2:k=y+j*2:s=16
    if P1=1 and P2=0 and P3=1 then r=x+i:k=y+j:s=16
    if P1=0 and P2=1 and P3=1 then r=x:k=y:s=16
    if P1=2 and P2=2 and P3=0 then r=x+i*2:k=y+j*2:s=32
    if P1=2 and P2=0 and P3=2 then r=x+i:k=y+j:s=32
    if P1=0 and P2=2 and P3=2 then r=x:k=y:s=32
    if m[1,1]=0 and z='y' then r=1:k=1:s=64
    if s>b then b=s:cx=r:cy=k
    return

is_winner#
    w=0:x=0:i=1:j=0:for y=0 to 2:gosub win:next y
    y=0:i=0:j=1:for x=0 to 2:gosub win:next x
    x=2:y=0:i=-1:j=1:gosub win
    x=0:i=1:j=1:gosub win
    return

win#
    if P1=1 and P2=1 and P3=1 then w=1
    if P1=2 and P2=2 and P3=2 then w=2
    return



Image


Last edited by Picnic on 07 Oct 2017, 07:56; edited 14 times in total
Post 21 Dec 2016, 12:34
View user's profile Send private message Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 149
Location: Madrid - Spain

Hello, it is very interesting. I was very fond of qbasic. I'd just say that it would be nice to see your page in English, Greek is a bit hard for me Smile
Post 21 Dec 2016, 13:20
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3

< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.