Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: tifreak on March 21, 2013, 08:12:10 pm

Title: TI-84+CSE: Connect 4
Post by: tifreak on March 21, 2013, 08:12:10 pm
Recently, I started in on a port of Connect 4 for the 84+CSE. It seemed only logical that this game make its debut on this color screen.

As it stands right now, here's what I've got:

(http://tifreakware.net/tifreak8x/connect4/connect4.5.jpg)

Got to make sure all the holes fill properly, and the list values are correct, don't I? :p And they of course, did.

(http://tifreakware.net/tifreak8x/connect4/connect4.5anim.gif)

This was taken with Calc Capture. It doesn't like color, it seems. Anyways, the calc is a little bit faster than this. And I might be changing the board to blue and removing the background image, since I'm going to want to use Text on the same screen while playing.

Next up is to set up the testing to see if there is a winner.

Just thought I'd post this up here, now that I actually have something substantial to post about.

Credit to Kerm for writing up the code for the boxes and circles drawing code.
Title: Re: TI-84+CSE: Connect 4
Post by: DJ Omnimaga on March 21, 2013, 10:44:29 pm
This looks really cool. And yes CalcCapture destroys colors D:. I was a bit concerned about the speed but then I remembered that on emulator+CalcCapture it was always slower than the real thing.

I would probably either keep the board yellow and add some dark background or do like you said. Anyway nice job so far :)
Title: Re: TI-84+CSE: Connect 4
Post by: Sorunome on March 22, 2013, 12:06:04 am
wow, that is looking slow, but the color makes it pretty! :)/me wonders how quick it could get with assembly
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 22, 2013, 04:47:17 am
Sorunome, the board takes 35 seconds to draw, and everything else is fairly instant.

DJ: I do have a background in it, look at the other screenshot above it. :p But having the background means if I display text over it, it leaves blocks of white behind the text, and makes it look not as nice. Hence switching to blue and getting rid of the background.
Title: Re: TI-84+CSE: Connect 4
Post by: TIfanx1999 on March 22, 2013, 09:13:56 am
A couple things: Is that the circles command you're using to draw the board and pieces (it seems to draw a bit differently). If so, are you using the fast circle trick?
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 22, 2013, 10:10:43 am
No, it's a custom thing Kerm set up for me, draws the boxes with empty circles, and there is a filled circle routine posted in the basic routines section on Cemetech. The fast circle trick does not work on the CSE. :<
Title: Re: TI-84+CSE: Connect 4
Post by: TIfanx1999 on March 22, 2013, 02:54:16 pm
Ah ok. That's a shame. :/
Title: Re: TI-84+CSE: Connect 4
Post by: Sorunome on March 22, 2013, 07:01:40 pm
Speaking of faster circle trick, does the large-font trick still work?
Title: Re: TI-84+CSE: Connect 4
Post by: Adriweb on March 22, 2013, 08:23:29 pm
Yep, just tested :

(http://i.imgur.com/3DlN7NP.jpg)
Title: Re: TI-84+CSE: Connect 4
Post by: Dapianokid on March 22, 2013, 10:09:12 pm
This can also be recreated if you use the following syntax, and this is something I recently discovered:

Compare the following two:
Circle(0,0,10 makes a slow circle at origin with a radius of 10.
Circle0,0,10,{-i} makes a fast circle of the same dimensions. The i is the imaginary I. Test it on the CSE please!
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 23, 2013, 05:09:12 am
Dapian, it doesn't work. It was removed because they added the color syntax to it. The circle drawing routine is actually faster than what it used to be, though.

As to my project, I've started in on win detection. Going to be fun to implement. :p
Title: Re: TI-84+CSE: Connect 4
Post by: TIfanx1999 on March 23, 2013, 05:14:14 am
This can also be recreated if you use the following syntax, and this is something I recently discovered:

Compare the following two:
Circle(0,0,10 makes a slow circle at origin with a radius of 10.
Circle0,0,10,{-i} makes a fast circle of the same dimensions. The i is the imaginary I. Test it on the CSE please!

This is what I mentioned a few posts up. It's refered to as the "fast circle" trick.
Title: Re: TI-84+CSE: Connect 4
Post by: DJ Omnimaga on March 23, 2013, 10:17:17 am
Dapian, it doesn't work. It was removed because they added the color syntax to it. The circle drawing routine is actually faster than what it used to be, though.

As to my project, I've started in on win detection. Going to be fun to implement. :p
I am still curious about if the trick if still present in the TI-OS code, though... I wonder if anyone has looked at the OS disassembly yet?
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 24, 2013, 04:40:27 pm
No idea. :<

Update so far today:

Win detection works and is confirmed on at least 3 directions, so I'm going to assume it's fully functional. I will be doing finalizing tests, of course.

I'm going to add some text here and there to kind of fill in the emptiness (since I'd like to have a title and who it's by on the screen somewhere) plus I need to make it so that when it is won, it will clear the tokens out and let you start over.

I think I might scrap the AI idea I had. That's going to severely bloat the code. I might give it a shot for a future version, who knows.

Edit:

(http://tifreakware.net/tifreak8x/connect4/connect4.6.gif)

So, what I have left to do:

1. Make it so it will clear out the spaces that are used

2. Make it so you keep on playing instead of dropping out of the program

3. Make the tokens fit the holes better

Thoughts?
Title: Re: TI-84+CSE: Connect 4
Post by: DJ Omnimaga on March 24, 2013, 07:05:34 pm
Nice stuff :). By the way after looking carefully at the animated screenshot, do you think you could make it so when you move the coin around, it is erased with "Text(-1" instead of line by line?
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 24, 2013, 08:32:28 pm
DJ: I had considered it, but never bothered to try it. Just trying to keep things uniform. And I'm not sure that Text(-1 trick is tall enough to cover the coin. I might look into it, I was just trying to keep it looking the same being deconstructed as it was being constructed to the screen. The thing isn't that slow on calc. Hopefully someone else with an 84+CSE can test it and agree to it :p There is also the issue with having to keep track of 2 separate coordinates for the coin and clearing the coin. This, surprisingly, used up a lot of variables to make.
Title: Re: TI-84+CSE: Connect 4
Post by: DJ Omnimaga on March 24, 2013, 08:35:53 pm
Yeah I thought about two spaces for Text(-1. It would definitively look more consistent with the coin animation removed, though.
Title: Re: TI-84+CSE: Connect 4
Post by: Sorunome on March 24, 2013, 09:56:08 pm
That color screen just makes the game look so beautiful :)
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 25, 2013, 07:20:40 am
Thank you, Sorunome :) I'm hoping that others will find it equally appealing. Going to try to set it up so that the animation goes away and it can display a simpler board, for those that want it. Though it's going to be defaulted to all the fancy stuff :p Pending I can make it work. Otherwise, it will just have the full board and be done with it.
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 25, 2013, 09:43:28 pm
(http://tifreakware.net/tifreak8x/connect4/connect4.7anim.gif)

(http://tifreakware.net/tifreak8x/connect4/connect4.7anim2.gif)

All that I think that needs doing is fixing the circles and making it so it doesn't show the animation!
Title: Re: TI-84+CSE: Connect 4
Post by: DJ Omnimaga on March 25, 2013, 11:00:08 pm
Looks quite nice actually. I liked the other version better but this one is faster. :)
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 26, 2013, 04:28:20 am
You get to choose your boards, this is just the simple one. Default is the nice board that takes 30 seconds to generate :)
Title: Re: TI-84+CSE: Connect 4
Post by: Ranman on March 26, 2013, 08:21:03 am
Lookin' good tifreak!

I'm wondering if the CSE has a solid circle already in it's ASCII table.
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 26, 2013, 07:58:04 pm
(http://tifreakware.net/tifreak8x/connect4/connect4.8anim.gif)

So! Fast drop works! Found out I need to have it detect from the middles as well! SO! I am going to spend some time expanding the win detection. And then Weregoose can say oh hey, let's take that 1kb of code, and make it 3 lines! And I will walk away in shame. ;) lol

Anyways, on to making the circles prettier.

Edit:

(http://tifreakware.net/tifreak8x/connect4/connect4.8anim2.gif)

Circles are now the same as the ones 'cut' out of the other board. Only thing I need to do now is to check for winning when the piece falls into one of the two possible middle spots for the 7 directions. Should be fun.

Edit 2:

Added the remaining win checks:

(http://tifreakware.net/tifreak8x/connect4/connect4.8anim3.gif)

And it doesn't seem to error out where ever you decide to drop the coin, so that's a good thing. Going to try to do a little bit of polishing work with it before I drop it for a public beta. Plus the Readme and all that.
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on March 27, 2013, 08:38:58 am
I've uploaded Connect4 to Cemetech Archives and ticalc, it's awaiting approval there.

http://www.cemetech.net/programs/index.php?mode=file&id=884
Title: Re: TI-84+CSE: Connect 4
Post by: DJ Omnimaga on April 25, 2013, 12:18:28 am
So yeah I tried this a few weeks ago and you did a quite nice job :). Of course those who want the board to load fast might prefer using the simple mode, but otherwise the slower mode looks even better. :)
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on April 25, 2013, 04:32:43 am
Thanks DJ :D I tried to make it the best it could be, without being ASM. :)

I'd also still like to add AI at some point, it's just not on the top of the list of things to do, want to get other things done so I can get back to pokemon!
Title: Re: TI-84+CSE: Connect 4
Post by: Stefan Bauwens on April 25, 2013, 04:46:21 am
Looks awesome! :D
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on April 25, 2013, 09:33:37 am
Thanks! :D It plays faster than what the screenshot shows, as well!
Title: Re: TI-84+CSE: Connect 4
Post by: Sorunome on April 25, 2013, 08:41:14 pm
Looking pretty awesome, it is nice to see already games for that new calc :D
Title: Re: TI-84+CSE: Connect 4
Post by: tifreak on April 26, 2013, 04:16:06 pm
Have to get on top of things now while the getting is good, before others go out and throw their versions down :)