I am thinking of creating a simple text based fighting game, with upward, downward, and sideways strikes. There would also be upward, downward, and sideways blocks, to counter the appropriate strikes. I want the player's opponent to randomly select strikes and blocks... Unfortunately, I have absolutely no idea how to do this. Could anyone help me with this? Any reply would be appreciated.
At the very beginning of your program, call srand(time(0)); to seed the random generator. Then you can call rand() to generate a random number. You will need to #include <cstdlib>