Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBot.cs
More file actions
Latest commit
63 lines (57 loc) · 1.48 KB
/
Copy pathBot.cs
File metadata and controls
63 lines (57 loc) · 1.48 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
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Text.RegularExpressions;
namespacecSharpbot
{
classBot
{
privatecharletter=' ';
privateintx;
privateinty;
privateString[][]map;
publicBot(charletter)
{
this.letter=letter;
}
publicvoidupdateMap(stringmapa)
{
string[]rows=Regex.Split(mapa,"\n");
map=newString[rows.Length][];
for(inti=0;i<rows.Length;i++)
{
map[i]=Regex.Split(rows[i],",");
}
intpos=mapa.IndexOf(this.letter)/2;
this.y=pos/rows.Length;
this.x=pos%rows.Length;
}
publicStringmove()
{
Randomrandom=newRandom();
intmov=random.Next(0,7);
Console.WriteLine("mov "+mov);
switch(mov)
{
case0:
return"N";
case1:
return"E";
case2:
return"S";
case3:
return"O";
case4:
return"BN";
case5:
return"BE";
case6:
return"BS";
case7:
return"BO";
}
return"P";
}
}
}