C
Programming and Technical
Programming
Program
Algorithm for snake and ladder game?
Read Solution (Total 2)
-
- Using linked list
well we can use an array which will contain all positions from start to end e.g. 100. so the game starts on 1 and ends at 100. now every element in the array is the head of a link list with just one "next" element and the head of the node has two flags either ladder or snake.
e.g
struct node
{
bool snake;
bool ladder;
struct node* next;
}
the "next" is pointing to the position which will take you whether its a snake or a ladder. and if hte flag is set to true then its a snake or else if ladder is set to true then its a ladder if both are flase then its nothing. - 10 years agoHelpfull: Yes(0) No(1)
- Hey...@Manikandani
plz explain clearly.. - 10 years agoHelpfull: Yes(0) No(1)
C Other Question