NOTE: This is not a screenshot


I'm trying to create Pac-Man for the TI-83 plus. I've got the maze, pellets, and Our Humble Hero, but I'm wondering how to do the ghosts. Any suggestions?

Bump: Implemented a new matrix-based scene for the maze and pellets, instead of the old graph based system. Turns out, it's a little slower, but I think the payoff when I put in the ghosts will be worth it.


Code:
0->theta
1->S
0->T
AxesOff
GridOff
ClrDraw
ZStandard
106->Xmax
72->Ymax
ZInteger
4->Xscl
4->Yscl
GridOn
Line(0,60,94,60,0
{15,23->dim([A]
{4095,1,1533,1029,1525,1029,2037,1->L1
For(A,1,8
For (B,1,12
1+not(2fPart(L1(A)/2^B)-fPart(2L1(A)/2^B->[A](A,B
Ans->[A](16-A,B
Ans->[A](24-B
Ans->[A](16-A,24-B
End
End
For(A,2,14,12
For(B,2,22,20
3->[A](A,B
Pt-On(4B,4A-4,2
Pt-Off(4B,4A-4,3
Pt-On(4B,4A-4
End
End
0->[A](8,12
Pt-Off(48,28
For(A,1,15,2
For(B,1,23,2
If 1=[A](A,B
Then
If A-1
Then
If 1=[A](A-1,B
Line(4B,4A-4,4B,4A-12
End
If B-1
Then
If 1=[A](A,B-1
Line(4B,4A-4,4B-8,4A-4
End
End
End
End
Text(0,0,0
48->X
28->Y
Repeat K=45
getKey->K
If max(K={24,25,26,34,45
Then
(K=26)-(K=24->S
(K=25)-(K=34->T
End
[A](Y/4+1+T,X/4+S->W
If W>1
Then
0->[A](Y/4+1+T,X/4+S
theta+10+90(W=3->theta
Text(0,0,theta
End
For(Z,0,K!=45
If Z
rand(3
Pt-Off(X,Y-1,2
Pt-Off(X,Y+1,2
Pt-Off(X-1,Y,2
Pt-Off(X+1,Y,2
X+2S(1!=W->X
Y+2T(1!=W->Y
Pt-On(X,Y-1,2
Pt-On(X,Y+1,2
Pt-On(X-1,Y,2
Pt-On(X+1,Y,2
If Z
Then
Pt-Off(X+S,Y+T,3
Pt-Off(X+2S,Y+2T,3
End
End
End
Text(0,0,int(1.0085theta


BTW, if you're confused as to what that last line is for, complete the maze, exit, and find out.
This looks pretty good! Are you going to enter CC19? i think you would do well!
Pieman7373 wrote:
This looks pretty good! Are you going to enter CC19? i think you would do well!


We'll see!
Hooray!
Wow, I just tried this out and I am impressed at the quality. I would not expect these kinds of graphics in TI-BASIC, let alone at this speed. Congratulations!

If you're confused about how you should do the graphics for the ghost, it can be done in 6 Pt commands, like so:


If you want ideas on AI, perhaps you could do a system similar to the original Pac-Man. Here's an abbreviated version of that AI:

Blinky will go to the tile that is the closest to Pac-Man.
Pinky will go to the tile that is the closest to a position 4 tiles in front of Pac-Man.
Inky will go to the tile that is the closest to...um...this one is kinda hard to explain...
...take a spot 2 tiles in front of Pac-Man. Draw a line from Blinky's position to that position. Extend that line, and the endpoint of the extension is the spot Inky tries to move to.
Clyde, if he is outside of a circle with an 8 tile radius centered at Pac-Man, will move towards Pac-Man, otherwise he goes to the lower-left corner.

Failing that, you could fake some of the more "complicated" original AIs with pure randomness. Or make everyone random. Or make everyone chase you.

Good luck on this!
JWinslow23 wrote:

If you want ideas on AI, perhaps you could do a system similar to the original Pac-Man. Here's an abbreviated version of that AI:

Blinky will go to the tile that is the closest to Pac-Man.
Pinky will go to the tile that is the closest to a position 4 tiles in front of Pac-Man.
Inky will go to the tile that is the closest to...um...this one is kinda hard to explain...
...take a spot 2 tiles in front of Pac-Man. Draw a line from Blinky's position to that position. Extend that line, and the endpoint of the extension is the spot Inky tries to move to.
Clyde, if he is outside of a circle with an 8 tile radius centered at Pac-Man, will move towards Pac-Man, otherwise he goes to the lower-left corner.

Failing that, you could fake some of the more "complicated" original AIs with pure randomness. Or make everyone random. Or make everyone chase you.

Good luck on this!


I think that everything should be true to the original, except Inky, which should be random.
JWinslow23 wrote:
Wow, I just tried this out and I am impressed at the quality. I would not expect these kinds of graphics in TI-BASIC, let alone at this speed. Congratulations!

...

If you want ideas on AI, perhaps you could do a system similar to the original Pac-Man. Here's an abbreviated version of that AI:

Blinky will go to the tile that is the closest to Pac-Man.
Pinky will go to the tile that is the closest to a position 4 tiles in front of Pac-Man.
Inky will go to the tile that is the closest to...um...this one is kinda hard to explain...
...take a spot 2 tiles in front of Pac-Man. Draw a line from Blinky's position to that position. Extend that line, and the endpoint of the extension is the spot Inky tries to move to.
Clyde, if he is outside of a circle with an 8 tile radius centered at Pac-Man, will move towards Pac-Man, otherwise he goes to the lower-left corner.

Failing that, you could fake some of the more "complicated" original AIs with pure randomness. Or make everyone random. Or make everyone chase you.

Good luck on this!



My main trouble with the ghosts is that I'm afraid they will slow down the program too much. (Edit: Confirmed!) I don't think that doing all four ghosts will work, especially with the small maze size. Maybe two or three, starting with a random Inky, and then Blinky, Pinky, and MAYBE Clyde. Sorry, Clyde. One other thought is to have the number of ghosts be a variable that the player can change in a settings menu.

As for making everyone chase me, or having everyone be random, those would be hard and easy modes, respectively. The uniquely programmed ghosts would then be medium, and the default mode.

If anyone is interested in how I came up with the right numbers to use for the rand function in the maze generator, I have two words for you: Brute Force.
RandomGuest wrote:
JWinslow23 wrote:
Wow, I just tried this out and I am impressed at the quality. I would not expect these kinds of graphics in TI-BASIC, let alone at this speed. Congratulations!

...

If you want ideas on AI, perhaps you could do a system similar to the original Pac-Man. Here's an abbreviated version of that AI:

Blinky will go to the tile that is the closest to Pac-Man.
Pinky will go to the tile that is the closest to a position 4 tiles in front of Pac-Man.
Inky will go to the tile that is the closest to...um...this one is kinda hard to explain...
...take a spot 2 tiles in front of Pac-Man. Draw a line from Blinky's position to that position. Extend that line, and the endpoint of the extension is the spot Inky tries to move to.
Clyde, if he is outside of a circle with an 8 tile radius centered at Pac-Man, will move towards Pac-Man, otherwise he goes to the lower-left corner.

Failing that, you could fake some of the more "complicated" original AIs with pure randomness. Or make everyone random. Or make everyone chase you.

Good luck on this!



My main trouble with the ghosts is that I'm afraid they will slow down the program too much. I don't think that doing all four ghosts will work, especially with the small maze size. Maybe two or three, starting with a random Inky, and then Blinky, Pinky, and MAYBE Clyde. Sorry, Clyde. One other thought is to have the number of ghosts be a variable that the player can change in a settings menu.

As for making everyone chase me, or having everyone be random, those would be hard and easy modes, respectively. The uniquely programmed ghosts would then be medium, and the default mode.

If anyone is interested in how I came up with the right numbers to use for the rand function in the maze generator, I have two words for you: Brute Force. I have a feeling my batteries don't like me anymore.

Well, you can always experiment! If you feel 4 ghosts, or even 3, is the most you can personally put in and have it still be playable, only put that amount in. But I think you should at least try it first.

I agree with the idea about an easy, medium, and hard mode.

And holy shoot, I didn't even pay attention to most of the code while typing, but that's amazing! You're probably going to need a different method once you add any element of randomness, though. Razz
JWinslow23 wrote:
And holy shoot, I didn't even pay attention to most of the code while typing, but that's amazing! You're probably going to need a different method once you add any element of randomness, though. 


I didn't think of that. *facepalm* Maybe some kind of list storage, or a purely random maze. Or Inky is the ghost that doesn't make the cut, instead of Clyde.

Clyde wrote:
Thank you.
RandomGuest wrote:
Or Inky is the ghost that doesn't make the cut, instead of Clyde.

Huh, I always thought that Clyde was the outcast. (*runs and hides). Good job on the work!
Okay. One problem I've had with the ghosts is that when moving them around, they'd destroy the pellets, as the pellets are currently graph-based, not stored in any kind of matrix or list. One solution I thought of is having the ghosts go in and out through Pt-Change, instead of Pt-On and Pt-Off. As expected, this slowed down the program by a lot. Any suggestions?
That appears to be the simplest way, yes.

If you stored em in a list or matrix it would be easier. I would recommend a matrix as it only requires a little bit of code to be changed.

Edit (scrolling up)
My calc's batteries have needed to be replaced 3 times this past year. Yours have nothing to complain about.

I would also like to note that pxl-test/pt-test commands are incredibly slow, if you need to store data that way, you need to redesign your program! I personally would have a list with all of the dots, then simply delete the ones as they are eaten.
I might try a matrix, as using a list of dots seems impractical. Equating Pac-Man' position with the corresponding list element seems off the top of my head to be a little cumbersome, but we'll see. I'll try some different methods out, and get back to you.

And JWinslow23, I did take the rand method out of generating the maze.


Code:

For(X,20,60,40
For(Y,8,48,8
Line(X,Y,X+16,Y
End
End
For(A,12,76,24
A-8(A=60->A
12-abs(A-44
For(B,28-Ans,28+Ans,2Ans
Line(A,B,A+8,B
End
End
Because I am taking a break, I am putting this program on hiatus. I will post the final program if and when I finish it.
  
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 1
» 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