Yes, I know there's a TI-BASIC version, as well as a C version, but why not an ICE version? Smile

I have started writing Connect4 ICE. Currently, it has the classic board style, I might add more settings and stuff after I figure out how the heck I'm supposed to read from AppVars. I also will probably have to experiment with GetPixel(, and use that to determine placement of the 'pieces', etc. Feel free to post feedback, suggestions, etc. here. I'll update this thread as I get things going.

GitHub Repo is here

To-Do
Main menu
win detection

Done
Draw board and tokens/coins/pieces
move and drop tokens/coins/pieces
stack/ column stuff (see below GIF)

(GIF is recent, matches the code in the repo)
To bad ICE does not support matrices. Sad They would make it a lot easier.
<pokes PT_ to add matrices to ICE>
yeah, the BASIC Connect 4 uses lists, which I'll have to figure out how to use...

**pokes P_T for a Lists how-to docs
Good luck with this project! I'd just make the board sprite, and experiment with placements for circles/sprite circles. (And a row thingy maggigy) You'll need to make an AI, or keep it double playered, which isn't as fun sometimes (when you're by yourself)
Legoman314 wrote:
To bad ICE does not support matrices. Sad They would make it a lot easier.
<pokes PT_ to add matrices to ICE>


No need for matrices. You have lists that are MUCH longer than the length of the lists in TI-BASIC and through intelligent programming, you can imitate a matrix even larger than what is supported normally.
_iPhoenix_ wrote:
Legoman314 wrote:
To bad ICE does not support matrices. Sad They would make it a lot easier.
<pokes PT_ to add matrices to ICE>


No need for matrices. You have lists that are MUCH longer than the length of the lists in TI-BASIC and through intelligent programming, you can imitate a matrix even larger than what is supported normally.

Yep, All you would have to do to convert from (x,y) into an index would be
1+(x-1)+(y-1)*width
(assuming you want the coordinate system to be the same as the normal matrices in basic). You would have to store the matrix from left to right, top to bottom, so a matrix like this [[1,2,3][4,5,6][7,8,9]] would become {1,2,3,4,5,6,7,8,9}
Despite the fact that the conversion is very easy, I think it would be beneficial for ICE to actually support matrices correctly, in order to make porting code easier, and maybe even have the code run a little faster, which I know is something PT_ likes to hear Wink
Well, I'm drawing the board, no sprite. I'll get screens up in the next hour or so, along with a how-to request...

I got it to the point where the board is drawn, and the circles can be moved and 'stacked', but I can't get it to switch 'stacks'. I'll put up a GIF that explains this better.
SM84CE wrote:
Well, I'm drawing the board, no sprite. I'll get screens up in the next hour or so, along with a how-to request...

I got it to the point where the board is drawn, and the circles can be moved and 'stacked', but I can't get it to switch 'stacks'. I'll put up a GIF that explains this better.


What's your idea for making an AI? I'd look at the Basic version(s), or the C version if it wasn't that complicated to see how.
Well, my friend and I were discussing AI, but decided against it, because it's complex, and more fun if it actually analyzes to board AND your strategy, which is something that isn't doable in ICEICE highlights P_T... (analyzing YOUR strategy). The BASIC version is like you play, then hand it over to a friend. He/She plays, then hands it back. The cycle continues.

here's the GIF!!

As you can see here, the 'stack' does not reset when you move to the next column, is there any way to accomplish this? Als0, how would win detection work? I know that there would be a GetPixel( involved? I also think it'd be easier with lists but I have no idea how to go about that. Any help would be appreciated.
I wouldn't use getpixel, I would store a list of the pieces and then draw the pieces based on those lists. Using getpixel would be horribly hard to work with Smile Once you clean that up, then things will be a lot easier to manage.

here's the GIF!!

* Animated PNG Smile
It's looking really nice! Why are there blank spaces? (Just wondering)
Next to the board? That's so I can add key help stuff, like arrows to move, ___ to quit, etc.
Would you be able to add a falling animation or something so that the tile does not just appear?
Looks really cool! Idea
That would be slow! I guess... That's just an excuse for me to use getpixel. I'll make the animation, though.
SM84CE wrote:
That would be slow! I guess... That's just an excuse for me to use getpixel. I'll make the animation, though.


SLOW?!??!? WHAT DO YOU MEAN?!??!?! ICE is really fast.

Animations would be nice, but I'd make it go by really fast. whooooosh!
It can be fast, but just a little somthing so that you know you have dropped the tile.
My scale of slow was milliseconds. Razz I'll probably make a Pause 100 after each hole, max wait time is .7 seconds (7x7 board)
SM84CE wrote:
My scale of slow was milliseconds. Razz I'll probably make a Pause 100 after each hole, max wait time is .7 seconds (7x7 board)


That seems like a fast speed. Maybe 150 ms, so in almost once second, it'll reach the bottom.
I'll do that, after I get basic mechanics done. Right now, I need help on how to read/write lists in ICE, as well as how I get the coin to fall to the bottom of each column, instead of the highest point (shown in above GIF). I think you need Data( to write to lists, but I have no idea on how to do, for example,

Code:

{5,2,5,8,2->L1
L1(1

in ICE.
Make list:
Code:
Data(3,1,2,3,4,5->LISTA

Copy to L1:

Code:
Copy(L1,LISTA,15

Display value:

Code:
Disp L1(3)
displays 2.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
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

 

Advertisement