mercredi 10 avril 2019

A code that generates random snakes and ladders in snakes and ladder game

I am a first year university students ,I am taking a c++ course ,so my skills are currently really basic , I know about loops ,arrays ,structures and some libraries only.I am required to do a project which is a "snake and ladder game" a requirement of the game is that whenever the game is opened ,5 ladders and 5 snakes are randomly positioned in a 10x10 board but they must not overlap.I tried to think of an algorithm to do that but with my minimum knowledge it is pretty hard .The most important rules that I figured are: -A square should only contain a start / end of a ladder or snake . -the first square shouldn't have a start of a ladder. -the last square shouldn't contain a head of a snake(no one will win) . -the last row shouldn't contain a start of a ladder. -first row shouldn't contain a head of snake . -the ladder is ascending while the snake is descending.

to summarize ,I need help figuring out an algorithm that does the above but not an extremely advanced one to be able to keep up(it is ok to use new functions but ones that are easy to follow and understand), if there are things that aren't clear please do ask ,and I apologize if the question isn't formatted well .




Aucun commentaire:

Enregistrer un commentaire