-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandom_bot.cpp
More file actions
77 lines (71 loc) · 1.27 KB
/
Copy pathrandom_bot.cpp
File metadata and controls
77 lines (71 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <cstdio>
#include <iostream>
#include <string>
#include <ctime>
using namespace std;
char f[2][15][10];
char random_color()
{
int rnd = rand() % 5;
if (rnd == 0) return 'R';
if (rnd == 1) return 'G';
if (rnd == 2) return 'B';
if (rnd == 3) return 'Y';
if (rnd == 4) return 'O';
}
int main()
{
srand(time(0));
freopen("input.txt", "rt", stdin);
freopen("output.txt", "wt", stdout);
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 10; j++)
{
cin >> f[0][i][j];
}
}
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 10; j++)
{
cin >> f[1][i][j];
if (f[1][i][j] == '.') f[1][i][j] = random_color();
}
}
int step_type = rand() % 10;
if (step_type == 0)
{
int rnd = rand() % 10;
for (int i = 0; i < 100; i++)
swap(f[0][rand() % 15][rnd], f[0][rand() % 15][rnd]);
}
if (step_type == 1)
{
int rnd = rand() % 15;
for (int i = 0; i < 100; i++)
swap(f[0][rnd][rand() % 10], f[0][rnd][rand() % 10]);
}
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 10; j++)
{
cout << f[1][i][j];
}
cout << endl;
}
if (step_type >= 2)
{
cout << (rand() % 15 + 1) << " " << (rand() % 10 + 1);
return 0;
}
for (int i = 0; i < 15; i++)
{
for (int j = 0; j < 10; j++)
{
cout << f[0][i][j];
}
cout << endl;
}
return 0;
}