• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rat and Maze protocol  RSS feed

 
christian scherlong
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So far i've built an array of char W= wall, O=open, R= rat, and P= path
I have another class "RAT" which will navigate through the maze. so im having trouble with the method to get the position of the rat when it is navigating through maze. this is what i have. Anyone have any good links similar to this??

 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i would probably have a Rat class that I could ask it where it is. It should know where it started, and it knows where it moved, so it should know where it is.
 
christian scherlong
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:i would probably have a Rat class that I could ask it where it is. It should know where it started, and it knows where it moved, so it should know where it is.


Okay thanks ill write up the rat class and see if that helps me out
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
 
christian scherlong
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:And welcome to the Ranch

Thanks !!
im still having a little trouble with this lol ill let you guys know if i need any help
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is the maze array static? Do you intend all rats always to navigate the same maze? Do you intend never to change anything in the maze?
 
christian scherlong
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Why is the maze array static? Do you intend all rats always to navigate the same maze? Do you intend never to change anything in the maze?

yeah im creating a maze and a rat which will navigate through it. The maze will never change. Afterwards we have to use a client and server in order for other people to use their rat to navigate through our maze and we have to navigate through theirs. My question is since my maze will be my server and my rat the client, do i have to write the server in the same class as the maze and the client in the same class as the rat ? Thanks
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know precious little about clients and servers, but you would want the maze, rat, etc in their own classes, which would not change whether you are running on one JVM or client and server. So they should be independent of one another and you would need separate classes.

Little rule of thumb: it is quite difficult to write too many classes. It is very easy to write too few classes.
 
christian scherlong
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:I know precious little about clients and servers, but you would want the maze, rat, etc in their own classes, which would not change whether you are running on one JVM or client and server. So they should be independent of one another and you would need separate classes.

Little rule of thumb: it is quite difficult to write too many classes. It is very easy to write too few classes.


lol i like that ^^ and okay thanks ill see if i can get this thing running then ill let you guys know if i have any other questions.
 
Campbell Ritchie
Marshal
Posts: 56599
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!