Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <sstream>
  4. #include <vector>
  5. #include <list>
  6. #include <map>
  7. #include <cmath>
  8. #include <cstdio>
  9. #include <algorithm>
  10. #include <unistd.h>
  11. #include "sys/types.h"
  12. #include "sys/sysinfo.h"
  13. #include <time.h>
  14. #include <stdlib.h>
  15.  
  16. using namespace std;
  17.  
  18. class Point {
  19. unsigned int x_, y_;
  20.  
  21. public:
  22.  
  23. Point(int x = 0, int y = 0) : x_(x), y_(y) {}
  24.  
  25. bool operator==(const Point& other){
  26. return ((x_ == other.x_) && (y_ == other.y_));
  27. }
  28.  
  29. int getX() const {
  30. return x_;
  31. }
  32.  
  33. int getY() const {
  34. return y_;
  35. }
  36.  
  37. void setX(int x) {
  38. x_ = x;
  39. }
  40.  
  41. void setY(int y) {
  42. y_ = y;
  43. }
  44. };
  45.  
  46. int main(){
  47. // PI6I SEED TUKA
  48. int seed = 87654;
  49. srand(seed);
  50. //I E ZA KOLKO P1TI DA VR1TNE CIKALA. DAVA NQKAV FLOATING POINT EXCEPTION? PRI MNOGO IIIIIIIIIIII
  51. for(int i = 0; i < 1; i++){
  52. int x = rand() % 20;
  53. int y = rand() % 20;
  54. cout << x << " " << y << endl;
  55. int bombsc = 400;
  56. while(bombsc>x*y||bombsc==0)
  57. bombsc = rand() % 20;
  58. cout << bombsc << endl;
  59. vector<Point> bombs;
  60. for(int k = 0; k < bombsc; k++){
  61. Point randomPoint(rand()%y, rand()%x);
  62. if(!(find(bombs.begin(), bombs.end(), randomPoint)!=bombs.end())){
  63. bombs.push_back(randomPoint);
  64. }else{
  65. k--;
  66. }
  67. }
  68. for(int k = 0; k < bombs.size(); k++)
  69. cout << bombs[k].getY() << "," << bombs[k].getX() << endl;
  70. // KOLKO OPERACII DA VR1TNE. MI MNOGO OT TVA I MNOGO OT IIIIIIIIII 6E NAPRAVI LO6I RABOTI AMA TI SI ZNAE6
  71. // OPTIMALNO MOJE BI E 15?
  72. for(int k = 0; k < 10; k++){
  73. int command = rand() % 15; //0 = click 1 = flag 2 = hint
  74. Point randomPoint(rand()%y, rand()%x);
  75. string butifel;
  76. switch(command){
  77. case 0: butifel = "click "; goto a;
  78. case 1: butifel = "click "; goto a;
  79. case 2: butifel = "click "; goto a;
  80. case 3: butifel = "click "; goto a;
  81. case 4: butifel = "click "; goto a;
  82. case 5: butifel = "click "; goto a;
  83. case 6: butifel = "click "; goto a;
  84. case 7: butifel = "click "; goto a;
  85. case 8: butifel = "click "; goto a;
  86. case 9: butifel = "click "; goto a;
  87. case 10: butifel = "click "; goto a;
  88. case 11: butifel = "click "; goto a;
  89. case 12: butifel = "flag "; goto a;
  90. case 13: butifel = "flag "; goto a;
  91. case 14: butifel = "hint "; goto a;
  92. }
  93. a:
  94. cout << butifel << randomPoint.getY() << "," << randomPoint.getX() << endl;
  95. }
  96. }
  97. }
  98. // COURTESY NA ELIZA KOLMAKOV
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement