Author Topic: axe set (with AI)  (Read 9881 times)

0 Members and 1 Guest are viewing this topic.

Offline ibid

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +2/-0
    • View Profile
axe set (with AI)
« on: October 03, 2012, 03:00:25 am »
I am porting the card game set to the 83/84 plus calculators in axe.

So far I did close to everything besides for the Human element. (I did the AI)

here's a screenshot:



Edit: Here's the above screenshot but with the frozen frames removed. As per suggestion from Sorunome I had switched over to managing the greyscale via interrupts, and so this image more closely resembles the game as it was before I abandoned it.

« Last Edit: December 07, 2017, 11:32:48 pm by ibid »

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: axe set (with AI)
« Reply #1 on: October 03, 2012, 04:35:25 am »
looks quite nice :o Is the grayscale better oncalc?
I'm not a nerd but I pretend:

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: axe set (with AI)
« Reply #2 on: October 03, 2012, 07:20:24 am »
Hmm, it looks like you are performing some computations and probably drawing a bit, too, when you press a key (the lag is noticeable between frames). I think you should try putting the LCD updating in an interrupt, then it will be constantly updating on its own :)

Offline ibid

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +2/-0
    • View Profile
Re: axe set (with AI)
« Reply #3 on: October 03, 2012, 09:03:48 am »
The greyscale kind of looks better on the calculator where you are paused more between keys. The computations are done beforehand and Dispgraphrr is in a very short loop.

I've never really used interrupts before. So I should just use FnInt( to turn it on, LnReg to turn it off, and put Dispgraphrr in the interrupt routine?

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: axe set (with AI)
« Reply #4 on: October 03, 2012, 07:32:52 pm »
nice game so far!

And yeah, probably, but i think you can't use L2 then.
EDIT: just found this fore nice greyscale: http://ourl.ca/17145/318621
« Last Edit: October 03, 2012, 07:35:20 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: axe set (with AI)
« Reply #5 on: October 03, 2012, 10:08:46 pm »
Very nice graphics :) I've never played Set before, but it looks great for a first game! (I'm assuming since you just registered that it's your first Axe game.)

And welcome to Omnimaga!
« Last Edit: October 03, 2012, 10:09:25 pm by Deep Thought »




Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: axe set (with AI)
« Reply #6 on: December 08, 2017, 05:57:02 pm »
Wow, 4 years since the initial post. :O Are you finishing this or are you working on anything programming related at the moment?

Offline ibid

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +2/-0
    • View Profile
Re: axe set (with AI)
« Reply #7 on: December 27, 2017, 07:27:21 am »
Quote
Wow, 4 years since the initial post. :O Are you finishing this or are you working on anything programming related at the moment?

I just picked it up again to try finishing it, but not sure if I'll be able to complete it.

The problem with using interrupts for greyscale is that they update the display before I'm finished drawing to the buffers. If I turn off interrupts during the drawing routines than there's a noticeable lag where the greyscale freezes into monochrome.

My usual method was to have all of the drawing commands followed by dispgraphclrdrawrr in a single loop.

Other than creating a 1,536 byte buffer in the ram, the only thing that I can think of is to rewrite all of the drawing routines to only erase each section right before it gets redrawn instead of constantly clrdraw'ing everything at once.

Offline c4ooo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 252
  • Rating: +10/-1
  • The impossible chemical compound.
    • View Profile
Re: axe set (with AI)
« Reply #8 on: December 27, 2017, 08:45:53 pm »
Have 4 buffers. Two for the final greyscale image, and two others for drawing on. When you finish drawing a frame, copy the draw buffer to the greyscale buffer. You can use GetCalc("prgmTEMP, 768*2) to make a temporary program were to store the buffer.
-German Kuznetsov
The impossible chemical compound.

Offline ibid

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +2/-0
    • View Profile
Re: axe set (with AI)
« Reply #9 on: December 27, 2017, 09:09:34 pm »
But then I'll need an extra 1,536 bytes of free ram in order to run the game (in addition to however much space the program is).

Is there a way to draw text to a custom buffer? Or should I just leave my drawing routines as they are and use the new buffers as the greyscale buffer?

Offline c4ooo

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 252
  • Rating: +10/-1
  • The impossible chemical compound.
    • View Profile
Re: axe set (with AI)
« Reply #10 on: December 27, 2017, 09:58:41 pm »
Actually there is enough free ram for 5 buffers. (Although a game i made used 6).
Take a look at this, a modified version of @Runer112's greylib:
Code: [Select]
L6->Str1B1
L3->Str1B2
L1->Str1B5
L2+103->Str1B3
L4-512->Str1B4
|E36->^^oGP
#ExprOff
Lbl GTUNE
1->K
ClrDraw^^r^^r
Rect(24,0,24,64)^^r
Rect(72,0,24,64)^^r
Rect(48,0,48,64)
Text(0,,"GREYSCALE RATE "[CF]"/"[0500]
GDISP()
While 1
Text(80,0,{Str1RATE}>Dec
Copy(L6,L3,168
GDISP()
If getKey(2)
{Str1RATE}--
Pause 50
1->K
ElseIf getKey(3)
{Str1RATE}++
Pause 50
1->K
ElseIf getKey(15)??getKey(41)??getKey(9)??getKey(54)
!If K
Return
End
Else
0->K
End
End
Return
Lbl GLOAD
Asm(3E40D3(^^oGP)^^r)
fnInt(GI, and 0)
Return
Lbl GUNLOAD
FnOff
Asm(EF204AAF32178DEF1150)
Asm(AFD3(^^oGP)^^r)
LnReg^^r
Asm(FF)
Return
#ExprOn
Lbl GDISP
FnOff
Copy(Str1B1,Str1B3)
Copy(Str1B2,Str1B4)
FnOn
Return
#ExprOff
Lbl GNOT83
Asm(DB0217ED62)
Return
#ExprOn
Lbl GI
If {Str1GNOT83}Asm(7DDEF6D303)
Asm(3E02D3(^^oGP+1)^^r3A(Str1RATE)D3(^^oGP+2)^^r
Else
Str1GI
{}--
ReturnIf ->{}
{Str1RATE}->{Str1GI}
End
DispGraph(Str1B3,Str1B4)^^r^^r
Return
L6 and L3 are still used for drawing while L2+103 and L4-512 are used for the greyscale. "Lbl GTUNE" is" the greyscale tuner, "Lbl GLOAD" initializes the greyscale (use this at start of program), "Lbl GUNLOAD" uninitilizes it (use this at end), "Lbl GDISP" flips the buffers (use this when you finish drawing your frame), "Lbl GNOT83" returns if or not the calc is an not 83, and lastly "Lbl GI" is the actual interrupt.

"Str1RATE" is a pointer to the greyscale rate, a single byte that tells how often the greyscale should update. "Str1GI" is a pointer to another byte that acts like a counter of sorts.You should ask @Runer112 for more info, I have forgot the intricacies of greyscale :(
« Last Edit: December 27, 2017, 10:02:39 pm by c4ooo »
-German Kuznetsov
The impossible chemical compound.

Offline E37

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 358
  • Rating: +23/-0
  • Trial and error is the best teacher
    • View Profile
Re: axe set (with AI)
« Reply #11 on: December 30, 2017, 04:06:45 pm »
If you want to draw text to a custom buffer, I made an axiom that lets you do just that! It also is twice as fast as standard Text( command. The tokens are under the matrix menu.

Spoiler For commands n' stuff:
Text()
Text(x,y,string) //Draws string to x,y to front buffer
Text(x,y,string,buffer) //Draws string to x,y at specified buffer
Text(string) //Draws string to the front buffer at current cursor position
Text(string,buffer) //Draws string to specified buffer at current cursor position

Dec()
Same as Text() but replace string with an unsigned int

Dec()r and Dec()rr
Same as Dec() but displays the number in hex or binary

Char()
Same as Text() but replace string with a character

Tok()
Same as Text() but replace string with a pointer to a 1 or 2 byte token
I'm still around... kind of.

Offline ibid

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +2/-0
    • View Profile
Re: axe set (with AI)
« Reply #12 on: December 31, 2017, 03:59:03 am »
I implemented Greylib, which took care of all the display problems I had. I'm now pretty much all done besides for the actual gameplay (which is where I thought I was up to when I first started this topic).

Anyways, I'm uploading a copy as it is now. It's not really playable, but it shows off the graphics, the AI, and most of the interface. The calculator lays out cards and show a set. If you press Enter, the calculator will remove the set, lay out more cards, and show a different set. (And so on until there are no more cards in the deck.) You can press the arrow keys to explore the attributes of different cards in the sidebar (in case the card designs are too hard to make out). The "Set" button at F5 doesn't do anything yet, and there's no way for you to call your own set. So as of now you can only watch the calculator play against itself.

Offline ibid

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 9
  • Rating: +2/-0
    • View Profile
Re: axe set (with AI)
« Reply #13 on: January 08, 2018, 12:50:10 pm »
Okay, it's now fully playable.



Rules

Like the original game, each card has four properties (number, color, shape, pattern). A "set" is a group of three cards in which every one of the properties is either the same or different. (but not two cards alike with only the third different).

Twelve cards (or more if needed) are laid out and you have to try finding a set. When you find one, you press [Graph] to call it, and then select the three cards. You get a point and those cards are replaced. Calling "set" incorrectly causes you to lose a point. (Though you can disable this penalty in the settings.)

If you wait to long then the calculator will "find" a set first and get a point. This time is defaulted to about 20 seconds (on the 15mHz calcs at least), but you can adjust it in the settings for an easier/harder game.

Controls

Arrow keys - move cursor around
Graph - Call a set
Graph/2nd/Enter - Select cards (after calling a set)
2nd/Enter - Deal new cards (after the calculator calls a set)
Trace - Enter/Exit the settings menu
Clear - Exit