My name is Hannah. I am currently studying game design and am in the middle of being taught C++.
We've asked for our first assignment to write dart simulation program which lets player's Joe and Cid take 3 turns each at a non-depicted dart board and play a game of '301'- didn't even know what that was till recently lol.
I have to do the program in two ways: using functions i.e. in C style, and using classes i.e. in C++ style.
I have a little code when I was trying to write a program which would have calculated how many times it took "Joe" to hit the bull in ten turns etc, but other than that, I am thoroughly confused, and will take any help or suggestions I can get.
I'm guessing the scoring will be random, then. you will have to figure out the chances of one of the player hitting a particular number/bullseye and give them points accordingly, and make sure it uses the same rules as dart 301, whatever those rules may be.
here's a function I use for random numbers, it works quite well, all the others I've tried have been unbalanced.
1 2 3 4 5 6 7 8 9 10
#include <ctime> // time
#include <stdlib.h> // rand/srand
void randomize(int &random, int max = 99, int min = 1)
{
// don't forget to seed once in main with srand(time(NULL));
max = max + 1;
max = max - min;
random = (A)(rand() % max + min);
}
then just call it like this..
1 2 3 4 5 6 7 8 9 10 11 12 13
...
srand(time(NULL));
int container;
randomize(container, 20, 1);
switch (container)
{
case 1:
//add points to whoever if 1 represents bullseye for example
break;
default:
break;
}
...