BASIC 'Hearts' game
Moderator: Moderators
BASIC 'Hearts' game
Hi all,
well it's - 'Hearts', the card game that you play when you are pretending to work, now for unexpanded Vic-20. Written entirely in BASIC. (I'm wondering if someone has already done this, but I just spent the better part of an hour searching, apparently no..)
The game includes the following rules / variants :
- 2 Clubs always goes first
- You cannot lead a heart unless a point card has been played
- If you 'shoot the moon', everyone else's score increases by 26
- First round is not 'safe' - if you have no clubs, you can trump with a point card
The computer players don't play what I would consider to be an 'optimal' game, nevertheless they still provides what I think is a reasonable level of competition.
This is the first thing I've done in BASIC on the VIC since I was a kid. I was using the Programmer's Aid cartridge for the first time (really this was just an excuse to see what that cartridge does, after all these years), and I have to say - it made the task much much easier than I remember coding on the VIC to be.
EDIT : Fixed a 'randomising' issue, now plays different games each time you start it.
EDIT 25/5/20 : - Better randomising
- fixed scoring bug when player shoots moon on last round
- Various bits of screwy code fixed
- Slightly more efficient play by computer players
well it's - 'Hearts', the card game that you play when you are pretending to work, now for unexpanded Vic-20. Written entirely in BASIC. (I'm wondering if someone has already done this, but I just spent the better part of an hour searching, apparently no..)
The game includes the following rules / variants :
- 2 Clubs always goes first
- You cannot lead a heart unless a point card has been played
- If you 'shoot the moon', everyone else's score increases by 26
- First round is not 'safe' - if you have no clubs, you can trump with a point card
The computer players don't play what I would consider to be an 'optimal' game, nevertheless they still provides what I think is a reasonable level of competition.
This is the first thing I've done in BASIC on the VIC since I was a kid. I was using the Programmer's Aid cartridge for the first time (really this was just an excuse to see what that cartridge does, after all these years), and I have to say - it made the task much much easier than I remember coding on the VIC to be.
EDIT : Fixed a 'randomising' issue, now plays different games each time you start it.
EDIT 25/5/20 : - Better randomising
- fixed scoring bug when player shoots moon on last round
- Various bits of screwy code fixed
- Slightly more efficient play by computer players
Last edited by Victragic on Mon May 25, 2020 1:15 am, edited 2 times in total.
3^4 is 81.0000001
Re: BASIC 'Hearts' game
Thanks. Very nice and clean... does what it says on the tin!
I knew I'd seen the title screen style before so I had to find it - it's similar to the Blue Meanies opening screen.
I knew I'd seen the title screen style before so I had to find it - it's similar to the Blue Meanies opening screen.
- orion70
- VICtalian
- Posts: 4341
- Joined: Thu Feb 02, 2006 4:45 am
- Location: Piacenza, Italy
- Occupation: Biologist
Re: BASIC 'Hearts' game
Well done! You really should post this HERE
- chysn
- Vic 20 Scientist
- Posts: 1205
- Joined: Tue Oct 22, 2019 12:36 pm
- Website: http://www.beigemaze.com
- Location: Michigan, USA
- Occupation: Software Dev Manager
Re: BASIC 'Hearts' game
It's really very nice. KIM shot the moon in the first hand. I was able to come back and win, but it was quite a performance.
VIC-20 Projects: wAx Assembler, TRBo: Turtle RescueBot, Helix Colony, Sub Med, Trolley Problem, Dungeon of Dance, ZEPTOPOLIS, MIDI KERNAL, The Archivist, Ed for Prophet-5
WIP: MIDIcast BASIC extension
he/him/his
WIP: MIDIcast BASIC extension
he/him/his
Re: BASIC 'Hearts' game
Thanks - I'm still tinkering a little with it before I post on the announcement board. I can make the computer play a wee bit more efficiently.
3^4 is 81.0000001
- Mayhem
- High Bidder
- Posts: 3027
- Joined: Mon May 24, 2004 7:03 am
- Website: http://www.mayhem64.co.uk
- Location: London
Re: BASIC 'Hearts' game
I’m an incredibly mean Hearts player, so interested to see how this looks heh.
Lie with passion and be forever damned...
Re: BASIC 'Hearts' game
You'll probably beat the computer players quite regularly, I'd think
The latest version is *just* good enough for a casual player like me though, I just played it twice and didn't win either time. (A computer player shot the moon in each game). My goal was to end up with something I wouldn't win *every* time when I played it.
3^4 is 81.0000001
- Mayhem
- High Bidder
- Posts: 3027
- Joined: Mon May 24, 2004 7:03 am
- Website: http://www.mayhem64.co.uk
- Location: London
Re: BASIC 'Hearts' game
Not bad, enjoyed playing that, although it's missing the "pass three cards to the next player" feature which really is an essential part of the game imo.
Lie with passion and be forever damned...
Re: BASIC 'Hearts' game
You are right, I had forgotten that competely!
If I can do it well and within 3.5k, I'll include. But I'm not sure at this stage if I can.
If I can do it well and within 3.5k, I'll include. But I'm not sure at this stage if I can.
3^4 is 81.0000001
- Mayhem
- High Bidder
- Posts: 3027
- Joined: Mon May 24, 2004 7:03 am
- Website: http://www.mayhem64.co.uk
- Location: London
Re: BASIC 'Hearts' game
If bumping to +8k means you can fit that in and expand the computer AI in the process (maybe variable difficulty levels) then I'm all for it
Lie with passion and be forever damned...
-
- Vic 20 Afficionado
- Posts: 348
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: BASIC 'Hearts' game
Hi Victragic,
I suggest to make the sorting routine a bit faster / obsolete:
Replace
with
and remove D%(I,P)=99 from line 66.
Regards,
Wim.
I suggest to make the sorting routine a bit faster / obsolete:
Replace
Code: Select all
73 t=0:n=1
74 ifd%(n,p)<d%(n-1,p)thent=d%(n-1,p):d%(n-1,p)=d%(n,p):d%(n,p)=t:ifn>1thenn=n-1:goto74
75 n=n+1:ifn<13then74
76 return
Code: Select all
73 n=i
74 ifn<12-rthend%(n,p)=d%(n+1,p):n=n+1:goto74
75 d%(n,p)=99
76 return
Regards,
Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
-
- Vic 20 Afficionado
- Posts: 348
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: BASIC 'Hearts' game
Here is the WimBasic version. Brought it down to 1912 bytes, 37 lines.
It autostarts in VICE.
Regards,
Wim.
It autostarts in VICE.
Regards,
Wim.
Last edited by wimoos on Fri Jan 15, 2021 3:24 am, edited 32 times in total.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
Re: BASIC 'Hearts' game
That's considerably more efficient!
I'll have a look at this a bit later.
BTW the original code was made on a real Vic with just the Programmer's Aid cartridge, I've no intention of expanding it beyond those specs but happy for anyone to take it further as they see fit!
I'll have a look at this a bit later.
BTW the original code was made on a real Vic with just the Programmer's Aid cartridge, I've no intention of expanding it beyond those specs but happy for anyone to take it further as they see fit!
3^4 is 81.0000001