Advertisement
Zanuark

Coding Project Computer RNG location

Nov 6th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. int direction;
  2. int location[12][12];
  3. int numShips = 5;
  4. int seed;
  5. /* incorporate an if statement where the initial seed value is 0 for easy, 1 for normal, 2 for hard, and 3 for insane.
  6. I don't know how it would work myself*/
  7. srand(seed);
  8. for(int i=0; i < numShips; ++i){
  9. location[(rand() % 100) % 12][(rand() % 50) % 12] = 1;
  10. cout << (rand() % 100) % 12 << endl;
  11. cout << (rand() % 50) % 12 << endl;
  12. direction = rand() % 4;
  13. cout << direction << endl;// 0=north, 1=east, 2=south, 3=west
  14. seed = rand() % 500;
  15. srand(seed);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement