Click here to Skip to main content
15,795,581 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello !
i'm Need To Create A Simple Sokoban Game, in this game we have One Box And One Target.
+ the game rules is:
- the worker Only can push the box.
- the box only can moved in(left,right,top,down) direction.
+ The Map Define Role is:
- . is ground
- # is wall
- B is box
- g is target
- s is worker

i can Get The String By This Format And Put This To 2d Char Array. Some Example Come Bellow :
.	.	.	.
.	S	B	.
.	#	#	.
.	.	G	.

Now I Have A Matrix Of Game Map.
Now I Need To Find The Shortest Way Between Box And Target With All Following Algorithms.
1- BFS
2- DFS
3- Bidirectional
4- A*

+ Please Talk Me How I Solve The Matrix With This Algorithms.
Thank You,My Masters ...
Updated 6-Jan-12 7:45am
Sergey Alexandrovich Kryukov 6-Jan-12 11:41am    
The game is not fully described. What's your problem? Is it your homework?
MEkramy 6-Jan-12 16:41pm    
HiThank You. More Describe :
i have a matrix that its contain game map(also Box,Worker And Target Location). i only need to find the shortest way in matrix between box and target by graph algorithms (BFS,DFS,A* And Bidirectional). But I Don't know how solving this matrix with graph algorithms.
please help me or take me a code.
some sample of game map:

Here[^] are some useful links.
Share this answer
No Body Help Me!
Please Help Me.
i have Short Time To Solve This Algorithm.
Share this answer
Richard MacCutchan 7-Jan-12 5:10am    
Did you look at any of the links I posted for you?
MEkramy 7-Jan-12 7:11am    
Yes Thank You.
But in my Project i have a button.this button work is : Help The Worker To Find Shortest Way Between Box And Target.
this program is not a game. its a algorithm for solving the game with graph algorithms (BFS,DFS,A*) And algorithm must find shortest's a Artificial intelligence program.
However thank you for your helping. please take me a code. good luck.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900