Snake Water Gun is one of the famous two-player game played by many people. It is a hand game in which the player randomly chooses any of the three forms i.e. snake, water, and gun. Here, we are going to implement this game using C LANG.
This C project is to build a game for a single player that plays with the computer.
Snake vs. Water: Snake drinks the water hence wins.
Water vs. Gun: The gun will drown in water, hence a point for water
Gun vs. Snake: Gun will kill the snake and win.
In situations where both players choose the same object, the result will be a draw.
The srand function is used to seed the random number generator in C. When you call rand without seeding it, it will produce the same sequence of numbers each time you run the program. By using srand with a seed value that changes (such as the current time), you ensure that rand produces different sequences of random numbers on each execution.
In summary, srand is used to ensure that the random numbers generated by rand are different each time you run the program, which is crucial for games and simulations where true randomness is desired.