CEDEC AI 2013 の決勝で使用したプログラムのソースコード。
リビジョン | e4b6cd75e8f441f68f8cbc9f73cbd7d882ad6166 (tree) |
---|---|
日時 | 2013-08-14 10:22:07 |
作者 | B_head <b_head@user...> |
コミッター | B_head |
ビジュアライザーを作成。
Signed-off-by: B_head <b_head@users.sourceforge.jp>
@@ -3,10 +3,11 @@ using System.Collections.Generic; | ||
3 | 3 | using System.Linq; |
4 | 4 | using System.Text; |
5 | 5 | using System.Threading.Tasks; |
6 | +using System.IO; | |
6 | 7 | |
7 | -namespace CedecAI | |
8 | +namespace Common | |
8 | 9 | { |
9 | - struct GameMass | |
10 | + public struct GameMass | |
10 | 11 | { |
11 | 12 | public int Player; |
12 | 13 | public Terrain Ter; |
@@ -14,7 +15,7 @@ namespace CedecAI | ||
14 | 15 | public int WaitRobot; |
15 | 16 | } |
16 | 17 | |
17 | - enum Terrain | |
18 | + public enum Terrain | |
18 | 19 | { |
19 | 20 | Outside, |
20 | 21 | Wasteland, |
@@ -27,4 +28,27 @@ namespace CedecAI | ||
27 | 28 | House, |
28 | 29 | Town, |
29 | 30 | } |
31 | + | |
32 | + public enum Direction | |
33 | + { | |
34 | + Right, | |
35 | + UpperRight, | |
36 | + DownerRight, | |
37 | + Left, | |
38 | + UpperLeft, | |
39 | + DownerLeft, | |
40 | + } | |
41 | + | |
42 | + public interface GameAI | |
43 | + { | |
44 | + string Prepare(int player, GameField field); | |
45 | + void Think(int turn, int maxTurn, int player, GameField field, Commander com); | |
46 | + } | |
47 | + | |
48 | + public interface Commander | |
49 | + { | |
50 | + void Move(int x, int y, Direction dir, int robot); | |
51 | + void Build(int x, int y, Terrain building); | |
52 | + void Finish(); | |
53 | + } | |
30 | 54 | } |
@@ -7,10 +7,11 @@ | ||
7 | 7 | <ProjectGuid>{B44455BF-0F12-47E1-AB63-FE2C7D8F5180}</ProjectGuid> |
8 | 8 | <OutputType>Library</OutputType> |
9 | 9 | <AppDesignerFolder>Properties</AppDesignerFolder> |
10 | - <RootNamespace>CedecAI</RootNamespace> | |
11 | - <AssemblyName>CedecAI</AssemblyName> | |
12 | - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |
10 | + <RootNamespace>Common</RootNamespace> | |
11 | + <AssemblyName>Common</AssemblyName> | |
12 | + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |
13 | 13 | <FileAlignment>512</FileAlignment> |
14 | + <TargetFrameworkProfile /> | |
14 | 15 | </PropertyGroup> |
15 | 16 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
16 | 17 | <DebugSymbols>true</DebugSymbols> |
@@ -33,16 +34,16 @@ | ||
33 | 34 | <Reference Include="System" /> |
34 | 35 | <Reference Include="System.Core" /> |
35 | 36 | <Reference Include="System.Xml.Linq" /> |
36 | - <Reference Include="System.Data.DataSetExtensions" /> | |
37 | 37 | <Reference Include="Microsoft.CSharp" /> |
38 | - <Reference Include="System.Data" /> | |
39 | 38 | <Reference Include="System.Xml" /> |
40 | 39 | </ItemGroup> |
41 | 40 | <ItemGroup> |
42 | 41 | <Compile Include="Common.cs" /> |
42 | + <Compile Include="ExamineFunction.cs" /> | |
43 | 43 | <Compile Include="GameField.cs" /> |
44 | 44 | <Compile Include="Field.cs" /> |
45 | 45 | <Compile Include="Properties\AssemblyInfo.cs" /> |
46 | + <Compile Include="TestAI.cs" /> | |
46 | 47 | </ItemGroup> |
47 | 48 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
48 | 49 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
@@ -0,0 +1,25 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | + | |
7 | +namespace Common | |
8 | +{ | |
9 | + public static class ExamineFunction | |
10 | + { | |
11 | + public static int GetEstimateTowerDamage(this GameField field, int player, int x, int y) | |
12 | + { | |
13 | + int result = 0, tx, ty; | |
14 | + for (int i = 1; i < 13; i++) | |
15 | + { | |
16 | + field.TransformTowerRange(i, x, y, out tx, out ty); | |
17 | + if (field.IsInRange(tx, ty)) continue; | |
18 | + if (field[tx, ty].Ter != Terrain.AttackTower) continue; | |
19 | + if (field[tx, ty].Player == player) continue; | |
20 | + result += 2; | |
21 | + } | |
22 | + return result; | |
23 | + } | |
24 | + } | |
25 | +} |
@@ -4,9 +4,9 @@ using System.Linq; | ||
4 | 4 | using System.Text; |
5 | 5 | using System.Threading.Tasks; |
6 | 6 | |
7 | -namespace CedecAI | |
7 | +namespace Common | |
8 | 8 | { |
9 | - class Field<TYPE> | |
9 | + public class Field<TYPE> | |
10 | 10 | { |
11 | 11 | protected TYPE[,] field; |
12 | 12 | public readonly int Width; |
@@ -26,5 +26,15 @@ namespace CedecAI | ||
26 | 26 | return field[x, y]; |
27 | 27 | } |
28 | 28 | } |
29 | + | |
30 | + public bool IsInRange(int x, int y) | |
31 | + { | |
32 | + return x < 0 || x >= Width || y < 0 || y >= Height; | |
33 | + } | |
34 | + | |
35 | + public void CopyTo(Field<TYPE> other) | |
36 | + { | |
37 | + Array.Copy(field, other.field, Width * Height); | |
38 | + } | |
29 | 39 | } |
30 | 40 | } |
@@ -5,100 +5,140 @@ using System.Text; | ||
5 | 5 | using System.Threading.Tasks; |
6 | 6 | using System.IO; |
7 | 7 | |
8 | -namespace CedecAI | |
8 | +namespace Common | |
9 | 9 | { |
10 | - class GameField : Field<GameMass> | |
10 | + public class GameField : Field<GameMass> | |
11 | 11 | { |
12 | 12 | public readonly int Size; |
13 | 13 | |
14 | 14 | public GameField(int size) |
15 | - : base(size * 2 + 1, size * 2 + 1) | |
15 | + : base(size * 2 - 1, size * 2 - 1) | |
16 | 16 | { |
17 | 17 | Size = size; |
18 | 18 | Initialize(); |
19 | 19 | } |
20 | 20 | |
21 | - private void Initialize() | |
21 | + protected void Initialize() | |
22 | 22 | { |
23 | 23 | for (int x = 0; x < Width; x++) |
24 | 24 | { |
25 | 25 | for (int y = 0; y < Height; y++) |
26 | 26 | { |
27 | 27 | field[x, y].Player = -1; |
28 | - if (y < 1 || y >= Height - 1) continue; | |
29 | - if (y <= Size) | |
28 | + if (y < 0 || y >= Height) continue; | |
29 | + if (y < Size) | |
30 | 30 | { |
31 | - if (x < Size - y + 1 || x >= Width - 1) continue; | |
31 | + if (x < Size - 1 - y || x >= Width) continue; | |
32 | 32 | } |
33 | 33 | else |
34 | 34 | { |
35 | - if (x < 1 || x >= Width - 1 + Size - y) continue; | |
35 | + if (x < 0 || x >= Width + Size - 1 - y) continue; | |
36 | 36 | } |
37 | 37 | field[x, y].Ter = Terrain.Wasteland; |
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | - public static GameField ParseText(TextReader read, out int turn, out int maxTurn, out int playerTurn) | |
42 | + public bool Move(int player, int fromX, int fromY, Direction dir, int robot) | |
43 | 43 | { |
44 | - string[] line; | |
45 | - line = read.ReadLine().Split(' '); | |
46 | - turn = int.Parse(line[0]); | |
47 | - maxTurn = int.Parse(line[1]); | |
48 | - playerTurn = int.Parse(line[2]); | |
49 | - line = read.ReadLine().Split(' '); | |
50 | - GameField result = new GameField(int.Parse(line[0])); | |
51 | - int count = int.Parse(line[1]); | |
52 | - for (int i = 0; i < count; i++) | |
44 | + if (!IsMove(player, fromX, fromY, dir, robot)) return false; | |
45 | + int toX, toY; | |
46 | + TransformDirection(dir, fromX, fromY, out toX, out toY); | |
47 | + GameMass from = field[fromX, fromY], to = field[toX, toY]; | |
48 | + if (to.Player == player) | |
53 | 49 | { |
54 | - line = read.ReadLine().Split(' '); | |
55 | - int x = int.Parse(line[0]), y = int.Parse(line[1]), player = int.Parse(line[2]), robot = int.Parse(line[3]); | |
56 | - Terrain ter = ParseTopography(line[5], line[6]); | |
57 | - result.field[x, y] = new GameMass { Player = player, Ter = ter, WaitRobot = robot }; | |
50 | + from.ActiveRobot -= robot; | |
51 | + to.WaitRobot += robot; | |
58 | 52 | } |
59 | - return result; | |
53 | + else | |
54 | + { | |
55 | + from.ActiveRobot -= robot; | |
56 | + if (to.WaitRobot < robot) | |
57 | + { | |
58 | + to.WaitRobot = robot - to.WaitRobot; | |
59 | + to.Player = player; | |
60 | + } | |
61 | + else | |
62 | + { | |
63 | + to.WaitRobot -= robot; | |
64 | + } | |
65 | + } | |
66 | + field[fromX, fromY] = from; | |
67 | + field[toX, toY] = to; | |
68 | + return true; | |
60 | 69 | } |
61 | 70 | |
62 | - private static Terrain ParseTopography(string ter, string building) | |
71 | + public bool IsMove(int player, int fromX, int fromY, Direction dir, int robot) | |
63 | 72 | { |
64 | - switch (ter) | |
73 | + if (robot <= 0) return false; | |
74 | + int toX, toY; | |
75 | + TransformDirection(dir, fromX, fromY, out toX, out toY); | |
76 | + if (IsInRange(toX, toY)) return false; | |
77 | + GameMass from = field[fromX, fromY], to = field[toX, toY]; | |
78 | + if (from.Player != player) return false; | |
79 | + if (from.ActiveRobot < robot) return false; | |
80 | + if (from.Ter == Terrain.Hole) return false; | |
81 | + if (to.Player == player) | |
65 | 82 | { |
66 | - case "wasteland": | |
67 | - case "settlement": | |
68 | - return Terrain.Wasteland; | |
69 | - case "base": | |
70 | - switch (building) | |
71 | - { | |
72 | - case "initial": return Terrain.Initial; | |
73 | - case "robotmaker": return Terrain.RobotMaker; | |
74 | - case "tower": return Terrain.AttackTower; | |
75 | - case "excavator": return Terrain.Excavator; | |
76 | - case "bridge": return Terrain.Bridge; | |
77 | - case "house": return Terrain.House; | |
78 | - case "town": return Terrain.Town; | |
79 | - default: throw new Exception(); | |
80 | - } | |
81 | - case "hole": | |
82 | - return Terrain.Hole; | |
83 | - default: | |
84 | - throw new Exception(); | |
83 | + if (to.Ter == Terrain.Outside) return false; | |
84 | + } | |
85 | + else | |
86 | + { | |
87 | + if (to.Ter != Terrain.Wasteland && to.Ter != Terrain.Hole) return false; | |
85 | 88 | } |
89 | + return true; | |
86 | 90 | } |
87 | 91 | |
88 | - public void SetActive(int player) | |
92 | + public bool Build(int player, int x, int y, Terrain building, ref int extraPoint) | |
93 | + { | |
94 | + if (!IsBuild(player, x, y, building)) return false; | |
95 | + int resource, robot; | |
96 | + GetRequirement(building, out resource, out robot); | |
97 | + if (building == Terrain.Town) | |
98 | + { | |
99 | + extraPoint += GetPrepareResource(x, y) - resource; | |
100 | + } | |
101 | + field[x, y].ActiveRobot -= robot; | |
102 | + field[x, y].Ter = building; | |
103 | + return true; | |
104 | + } | |
105 | + | |
106 | + public bool IsBuild(int player, int x, int y, Terrain building) | |
107 | + { | |
108 | + if (field[x, y].Player != player) return false; | |
109 | + if (field[x, y].Ter != Terrain.Wasteland && field[x, y].Ter != Terrain.Hole) return false; | |
110 | + if (field[x, y].Ter == Terrain.Wasteland && building == Terrain.Bridge) return false; | |
111 | + if (field[x, y].Ter == Terrain.Hole && building != Terrain.Bridge) return false; | |
112 | + int resource, robot; | |
113 | + GetRequirement(building, out resource, out robot); | |
114 | + if (field[x, y].ActiveRobot < robot) return false; | |
115 | + if (GetPrepareResource(x, y) < resource) return false; | |
116 | + return true; | |
117 | + } | |
118 | + | |
119 | + public void StartTurn(int player) | |
89 | 120 | { |
90 | 121 | for (int x = 0; x < Width; x++) |
91 | 122 | { |
92 | 123 | for (int y = 0; y < Height; y++) |
93 | 124 | { |
94 | - if (field[x, y].Player != player) continue; | |
95 | - field[x, y].ActiveRobot += field[x, y].WaitRobot; | |
96 | - field[x, y].WaitRobot = 0; | |
125 | + if (field[x, y].Player == player) | |
126 | + { | |
127 | + field[x, y].WaitRobot += GetAddRobot(x, y); | |
128 | + field[x, y].ActiveRobot += field[x, y].WaitRobot; | |
129 | + field[x, y].WaitRobot = 0; | |
130 | + } | |
131 | + else | |
132 | + { | |
133 | + if (field[x, y].WaitRobot <= 0) continue; | |
134 | + field[x, y].WaitRobot -= GetTowerDamage(player, x, y); | |
135 | + if (field[x, y].WaitRobot < 0) field[x, y].WaitRobot = 0; | |
136 | + } | |
97 | 137 | } |
98 | 138 | } |
99 | 139 | } |
100 | 140 | |
101 | - public void SetWait(int player) | |
141 | + public void EndTurn(int player) | |
102 | 142 | { |
103 | 143 | for (int x = 0; x < Width; x++) |
104 | 144 | { |
@@ -111,81 +151,79 @@ namespace CedecAI | ||
111 | 151 | } |
112 | 152 | } |
113 | 153 | |
114 | - public void TowerAttacking(int player) | |
154 | + public void GetRequirement(Terrain ter, out int resource, out int robot) | |
155 | + { | |
156 | + switch (ter) | |
157 | + { | |
158 | + case Terrain.RobotMaker: resource = 4; robot = 50; break; | |
159 | + case Terrain.AttackTower: resource = 5; robot = 25; break; | |
160 | + case Terrain.Excavator: resource = 4; robot = 25; break; | |
161 | + case Terrain.Bridge: resource = 4; robot = 15; break; | |
162 | + case Terrain.House: resource = 4; robot = 10; break; | |
163 | + case Terrain.Town: resource = 9; robot = 10; break; | |
164 | + default: throw new Exception(); | |
165 | + } | |
166 | + } | |
167 | + | |
168 | + public int GetTotalVictoryPoint(int player) | |
115 | 169 | { |
170 | + int result = 0; | |
116 | 171 | for (int x = 0; x < Width; x++) |
117 | 172 | { |
118 | 173 | for (int y = 0; y < Height; y++) |
119 | 174 | { |
120 | - if (field[x, y].Player == player) continue; | |
121 | - if (field[x, y].WaitRobot <= 0) continue; | |
122 | - field[x, y].WaitRobot -= GetTowerDamage(x, y); | |
175 | + if (field[x, y].Player != player) continue; | |
176 | + result += GetVictoryPoint(x, y); | |
123 | 177 | } |
124 | 178 | } |
179 | + return result; | |
125 | 180 | } |
126 | 181 | |
127 | - public bool Move(int player, int fromX, int fromY, int toX, int toY, int robot) | |
182 | + public int GetVictoryPoint(int x, int y) | |
128 | 183 | { |
129 | - GameMass from = field[fromX, fromY], to = field[toX, toY]; | |
130 | - if (from.Player != player) return false; | |
131 | - if (from.ActiveRobot < robot) return false; | |
132 | - if (from.Ter == Terrain.Hole) return false; | |
133 | - if (to.Player == player) | |
184 | + if (field[x, y].Ter == Terrain.Wasteland) | |
134 | 185 | { |
135 | - if (to.Ter == Terrain.Outside) return false; | |
136 | - from.ActiveRobot -= robot; | |
137 | - to.WaitRobot += robot; | |
186 | + return 1; | |
187 | + } | |
188 | + else if (field[x, y].Ter == Terrain.Hole || field[x, y].Ter == Terrain.Outside) | |
189 | + { | |
190 | + return 0; | |
138 | 191 | } |
139 | 192 | else |
140 | 193 | { |
141 | - if (to.Ter != Terrain.Wasteland && to.Ter != Terrain.Hole) return false; | |
142 | - from.ActiveRobot -= robot; | |
143 | - if (to.WaitRobot < robot) | |
144 | - { | |
145 | - to.WaitRobot = robot - to.WaitRobot; | |
146 | - to.Player = player; | |
147 | - } | |
148 | - else | |
149 | - { | |
150 | - to.WaitRobot -= robot; | |
151 | - } | |
194 | + return 3; | |
152 | 195 | } |
153 | - field[fromX, fromY] = from; | |
154 | - field[toX, toY] = to; | |
155 | - return true; | |
156 | 196 | } |
157 | 197 | |
158 | - public bool Build(int player, int x, int y, Terrain ter, ref int extraPoint) | |
198 | + public int GetAddRobot(int x, int y) | |
159 | 199 | { |
160 | - if (field[x, y].Player != player) return false; | |
161 | - if (field[x, y].Ter == Terrain.Wasteland && ter == Terrain.Bridge) return false; | |
162 | - if (field[x, y].Ter == Terrain.Hole && ter != Terrain.Bridge) return false; | |
163 | - int resource, robot; | |
164 | - GetRequirement(ter, out resource, out robot); | |
165 | - if (field[x, y].ActiveRobot < robot) return false; | |
166 | - int pr = GetPrepareResource(x, y); | |
167 | - if (pr < resource) return false; | |
168 | - if (ter == Terrain.Town) | |
200 | + if (field[x, y].Ter == Terrain.Initial) | |
169 | 201 | { |
170 | - extraPoint += pr - resource; | |
202 | + return 5; | |
203 | + } | |
204 | + else if (field[x, y].Ter == Terrain.RobotMaker) | |
205 | + { | |
206 | + return 1; | |
207 | + } | |
208 | + else | |
209 | + { | |
210 | + return 0; | |
171 | 211 | } |
172 | - field[x, y].ActiveRobot -= robot; | |
173 | - field[x, y].Ter = ter; | |
174 | - return true; | |
175 | 212 | } |
176 | 213 | |
177 | - public void GetRequirement(Terrain ter, out int resource, out int robot) | |
214 | + public int GetTowerDamage(int player, int x, int y) | |
178 | 215 | { |
179 | - switch (ter) | |
216 | + if (field[x, y].Player == player) return 0; | |
217 | + int result = 0, tx, ty; | |
218 | + for (int i = 1; i < 13; i++) | |
180 | 219 | { |
181 | - case Terrain.RobotMaker: resource = 4; robot = 50; break; | |
182 | - case Terrain.AttackTower: resource = 5; robot = 25; break; | |
183 | - case Terrain.Excavator: resource = 4; robot = 25; break; | |
184 | - case Terrain.Bridge: resource = 4; robot = 15; break; | |
185 | - case Terrain.House: resource = 4; robot = 10; break; | |
186 | - case Terrain.Town: resource = 9; robot = 10; break; | |
187 | - default: throw new Exception(); | |
220 | + TransformTowerRange(i, x, y, out tx, out ty); | |
221 | + if (IsInRange(tx, ty)) continue; | |
222 | + if (field[tx, ty].Ter != Terrain.AttackTower) continue; | |
223 | + if (field[tx, ty].Player != player) continue; | |
224 | + result += 2; | |
188 | 225 | } |
226 | + return result; | |
189 | 227 | } |
190 | 228 | |
191 | 229 | public int GetPrepareResource(int x, int y) |
@@ -194,6 +232,7 @@ namespace CedecAI | ||
194 | 232 | for (int i = 0; i < 7; i++) |
195 | 233 | { |
196 | 234 | TransformAdjoin(i, x, y, out tx, out ty); |
235 | + if (IsInRange(tx, ty)) continue; | |
197 | 236 | if (field[tx, ty].Player != player) continue; |
198 | 237 | result += GetYieldResource(tx, ty); |
199 | 238 | } |
@@ -207,6 +246,7 @@ namespace CedecAI | ||
207 | 246 | for (int i = 1; i < 7; i++) |
208 | 247 | { |
209 | 248 | TransformAdjoin(i, x, y, out tx, out ty); |
249 | + if (IsInRange(tx, ty)) continue; | |
210 | 250 | if (field[tx, ty].Player != player) continue; |
211 | 251 | if (field[tx, ty].Ter != Terrain.Excavator) continue; |
212 | 252 | result++; |
@@ -214,17 +254,20 @@ namespace CedecAI | ||
214 | 254 | return result; |
215 | 255 | } |
216 | 256 | |
217 | - public int GetTowerDamage(int x, int y) | |
257 | + public void TransformDirection(Direction dir, int x, int y, out int tx, out int ty) | |
218 | 258 | { |
219 | - int result = 0, player = field[x, y].Player, tx, ty; | |
220 | - for (int i = 1; i < 13; i++) | |
259 | + tx = x; | |
260 | + ty = y; | |
261 | + switch (dir) | |
221 | 262 | { |
222 | - TransformTowerRange(i, x, y, out tx, out ty); | |
223 | - if (field[tx, ty].Ter != Terrain.AttackTower) continue; | |
224 | - if (field[tx, ty].Player == player) continue; | |
225 | - result += 2; | |
263 | + case Direction.Right: tx += 1; ty += 0; break; | |
264 | + case Direction.UpperRight: tx += 1; ty += -1; break; | |
265 | + case Direction.DownerRight: tx += 0; ty += 1; break; | |
266 | + case Direction.Left: tx += -1; ty += 0; break; | |
267 | + case Direction.DownerLeft: tx += -1; ty += 1; break; | |
268 | + case Direction.UpperLeft: tx += 0; ty += -1; break; | |
269 | + default: throw new Exception(); | |
226 | 270 | } |
227 | - return result; | |
228 | 271 | } |
229 | 272 | |
230 | 273 | public void TransformAdjoin(int i, int x, int y, out int tx, out int ty) |
@@ -235,10 +278,10 @@ namespace CedecAI | ||
235 | 278 | { |
236 | 279 | case 0: tx += 0; ty += 0; break; |
237 | 280 | case 1: tx += 1; ty += 0; break; |
238 | - case 2: tx += 1; ty += 1; break; | |
281 | + case 2: tx += 1; ty += -1; break; | |
239 | 282 | case 3: tx += 0; ty += 1; break; |
240 | 283 | case 4: tx += -1; ty += 0; break; |
241 | - case 5: tx += -1; ty += -1; break; | |
284 | + case 5: tx += -1; ty += 1; break; | |
242 | 285 | case 6: tx += 0; ty += -1; break; |
243 | 286 | default: throw new Exception(); |
244 | 287 | } |
@@ -266,17 +309,5 @@ namespace CedecAI | ||
266 | 309 | default: throw new Exception(); |
267 | 310 | } |
268 | 311 | } |
269 | - | |
270 | - public void ToRedress(ref int x, ref int y) | |
271 | - { | |
272 | - x -= Size; | |
273 | - y -= Size; | |
274 | - } | |
275 | - | |
276 | - public void FromRedress(ref int x, ref int y) | |
277 | - { | |
278 | - x += Size; | |
279 | - y += Size; | |
280 | - } | |
281 | 312 | } |
282 | 313 | } |
@@ -0,0 +1,95 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | + | |
7 | +namespace Common | |
8 | +{ | |
9 | + public class TestAI : GameAI | |
10 | + { | |
11 | + Random random; | |
12 | + | |
13 | + public TestAI() | |
14 | + { | |
15 | + random = new Random(0); | |
16 | + } | |
17 | + | |
18 | + public string Prepare(int player, GameField field) | |
19 | + { | |
20 | + return "B_head:TestAI"; | |
21 | + } | |
22 | + | |
23 | + public void Think(int turn, int maxTurn, int player, GameField field, Commander com) | |
24 | + { | |
25 | + if (!Build(player, field, com)) | |
26 | + { | |
27 | + Move(player, field, com); | |
28 | + } | |
29 | + com.Finish(); | |
30 | + } | |
31 | + | |
32 | + private void Move(int player, GameField field, Commander com) | |
33 | + { | |
34 | + int w = field.Width, h = field.Height; | |
35 | + for (int x = 0; x < w; x++) | |
36 | + { | |
37 | + for (int y = 0; y < h; y++) | |
38 | + { | |
39 | + Direction dir = ToDirection(random.Next(6)); | |
40 | + int robot = random.Next(field[x, y].ActiveRobot) + 1; | |
41 | + if (field.IsMove(player, x, y, dir, robot)) | |
42 | + { | |
43 | + com.Move(x, y, dir, robot); | |
44 | + } | |
45 | + } | |
46 | + } | |
47 | + } | |
48 | + | |
49 | + private bool Build(int player, GameField field, Commander com) | |
50 | + { | |
51 | + Terrain building = ToBuilding(random.Next(6)); | |
52 | + int w = field.Width, h = field.Height; | |
53 | + for (int x = 0; x < w; x++) | |
54 | + { | |
55 | + for (int y = 0; y < h; y++) | |
56 | + { | |
57 | + if (field.IsBuild(player, x, y, building)) | |
58 | + { | |
59 | + com.Build(x, y, building); | |
60 | + return true; | |
61 | + } | |
62 | + } | |
63 | + } | |
64 | + return false; | |
65 | + } | |
66 | + | |
67 | + private Direction ToDirection(int i) | |
68 | + { | |
69 | + switch (i) | |
70 | + { | |
71 | + case 0: return Direction.DownerLeft; | |
72 | + case 1: return Direction.DownerRight; | |
73 | + case 2: return Direction.Left; | |
74 | + case 3: return Direction.Right; | |
75 | + case 4: return Direction.UpperLeft; | |
76 | + case 5: return Direction.UpperRight; | |
77 | + default: throw new Exception(); | |
78 | + } | |
79 | + } | |
80 | + | |
81 | + private Terrain ToBuilding(int i) | |
82 | + { | |
83 | + switch (i) | |
84 | + { | |
85 | + case 0: return Terrain.RobotMaker; | |
86 | + case 1: return Terrain.AttackTower; | |
87 | + case 2: return Terrain.Excavator; | |
88 | + case 3: return Terrain.Bridge; | |
89 | + case 4: return Terrain.House; | |
90 | + case 5: return Terrain.Town; | |
91 | + default: throw new Exception(); | |
92 | + } | |
93 | + } | |
94 | + } | |
95 | +} |
@@ -1,6 +1,6 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8" ?> | |
1 | +<?xml version="1.0"?> | |
2 | 2 | <configuration> |
3 | 3 | <startup> |
4 | - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | |
4 | + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> | |
5 | 5 | </startup> |
6 | -</configuration> | |
\ No newline at end of file | ||
6 | +</configuration> |
@@ -0,0 +1,150 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using System.IO; | |
7 | +using Common; | |
8 | + | |
9 | +namespace Production | |
10 | +{ | |
11 | + class LinkGameField : GameField | |
12 | + { | |
13 | + public LinkGameField(int size) | |
14 | + : base(size) | |
15 | + { | |
16 | + | |
17 | + } | |
18 | + | |
19 | + public static LinkGameField ParseText(out int turn, out int maxTurn, out int playerTurn) | |
20 | + { | |
21 | + string[] line; | |
22 | + if (Console.ReadLine() != "START") throw new Exception(); | |
23 | + line = Console.ReadLine().Split(' '); | |
24 | + turn = int.Parse(line[0]); | |
25 | + maxTurn = int.Parse(line[1]); | |
26 | + playerTurn = int.Parse(line[2]); | |
27 | + line = Console.ReadLine().Split(' '); | |
28 | + LinkGameField result = new LinkGameField(int.Parse(line[0])); | |
29 | + int count = int.Parse(line[1]); | |
30 | + for (int i = 0; i < count; i++) | |
31 | + { | |
32 | + line = Console.ReadLine().Split(' '); | |
33 | + int x = int.Parse(line[0]), y = int.Parse(line[1]), player = int.Parse(line[2]), robot = int.Parse(line[3]); | |
34 | + result.FromRedress(ref x, ref y); | |
35 | + Terrain ter = ParseTerrain(line[5], line[6]); | |
36 | + if (player == playerTurn) | |
37 | + { | |
38 | + result.field[x, y] = new GameMass { Player = player, Ter = ter, ActiveRobot = robot }; | |
39 | + } | |
40 | + else | |
41 | + { | |
42 | + result.field[x, y] = new GameMass { Player = player, Ter = ter, WaitRobot = robot }; | |
43 | + } | |
44 | + } | |
45 | + if (Console.ReadLine() != "EOS") throw new Exception(); | |
46 | + return result; | |
47 | + } | |
48 | + | |
49 | + private static Terrain ParseTerrain(string ter, string building) | |
50 | + { | |
51 | + switch (ter) | |
52 | + { | |
53 | + case "wasteland": | |
54 | + case "settlement": | |
55 | + return Terrain.Wasteland; | |
56 | + case "base": | |
57 | + switch (building) | |
58 | + { | |
59 | + case "initial": return Terrain.Initial; | |
60 | + case "robotmaker": return Terrain.RobotMaker; | |
61 | + case "tower": return Terrain.AttackTower; | |
62 | + case "excavator": return Terrain.Excavator; | |
63 | + case "bridge": return Terrain.Bridge; | |
64 | + case "house": return Terrain.House; | |
65 | + case "town": return Terrain.Town; | |
66 | + default: throw new Exception(); | |
67 | + } | |
68 | + case "hole": | |
69 | + return Terrain.Hole; | |
70 | + default: | |
71 | + throw new Exception(); | |
72 | + } | |
73 | + } | |
74 | + | |
75 | + public Commander GetCommander() | |
76 | + { | |
77 | + return new LinkCommander(this); | |
78 | + } | |
79 | + | |
80 | + private void ToRedress(ref int x, ref int y) | |
81 | + { | |
82 | + x -= Size - 1; | |
83 | + y -= Size - 1; | |
84 | + } | |
85 | + | |
86 | + private void FromRedress(ref int x, ref int y) | |
87 | + { | |
88 | + x += Size - 1; | |
89 | + y += Size - 1; | |
90 | + } | |
91 | + | |
92 | + class LinkCommander : Commander | |
93 | + { | |
94 | + LinkGameField parent; | |
95 | + | |
96 | + public LinkCommander(LinkGameField parent) | |
97 | + { | |
98 | + this.parent = parent; | |
99 | + } | |
100 | + | |
101 | + public void Move(int x, int y, Direction dir, int robot) | |
102 | + { | |
103 | + string temp = GenerateDirectionCode(dir); | |
104 | + parent.ToRedress(ref x, ref y); | |
105 | + Console.WriteLine("move {0} {1} {2} {3}", x, y, temp, robot); | |
106 | + } | |
107 | + | |
108 | + public void Build(int x, int y, Terrain building) | |
109 | + { | |
110 | + string temp = GenerateBuildingCode(building); | |
111 | + parent.ToRedress(ref x, ref y); | |
112 | + Console.WriteLine("build {0} {1} {2}", x, y, temp); | |
113 | + } | |
114 | + | |
115 | + public void Finish() | |
116 | + { | |
117 | + Console.WriteLine("finish"); | |
118 | + } | |
119 | + | |
120 | + private string GenerateDirectionCode(Direction dir) | |
121 | + { | |
122 | + switch (dir) | |
123 | + { | |
124 | + case Direction.Right: return "r"; | |
125 | + case Direction.UpperRight: return "ur"; | |
126 | + case Direction.DownerRight: return "dr"; | |
127 | + case Direction.Left: return "l"; | |
128 | + case Direction.UpperLeft: return "ul"; | |
129 | + case Direction.DownerLeft: return "dl"; | |
130 | + default: throw new Exception(); | |
131 | + } | |
132 | + } | |
133 | + | |
134 | + private string GenerateBuildingCode(Terrain building) | |
135 | + { | |
136 | + switch (building) | |
137 | + { | |
138 | + case Terrain.Initial: return "initial"; | |
139 | + case Terrain.RobotMaker: return "robotmaker"; | |
140 | + case Terrain.AttackTower: return "tower"; | |
141 | + case Terrain.Excavator: return "excavator"; | |
142 | + case Terrain.Bridge: return "bridge"; | |
143 | + case Terrain.House: return "house"; | |
144 | + case Terrain.Town: return "town"; | |
145 | + default: throw new Exception(); | |
146 | + } | |
147 | + } | |
148 | + } | |
149 | + } | |
150 | +} |
@@ -9,8 +9,9 @@ | ||
9 | 9 | <AppDesignerFolder>Properties</AppDesignerFolder> |
10 | 10 | <RootNamespace>Production</RootNamespace> |
11 | 11 | <AssemblyName>Production</AssemblyName> |
12 | - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | |
12 | + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |
13 | 13 | <FileAlignment>512</FileAlignment> |
14 | + <TargetFrameworkProfile /> | |
14 | 15 | </PropertyGroup> |
15 | 16 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
16 | 17 | <PlatformTarget>AnyCPU</PlatformTarget> |
@@ -35,18 +36,23 @@ | ||
35 | 36 | <Reference Include="System" /> |
36 | 37 | <Reference Include="System.Core" /> |
37 | 38 | <Reference Include="System.Xml.Linq" /> |
38 | - <Reference Include="System.Data.DataSetExtensions" /> | |
39 | 39 | <Reference Include="Microsoft.CSharp" /> |
40 | - <Reference Include="System.Data" /> | |
41 | 40 | <Reference Include="System.Xml" /> |
42 | 41 | </ItemGroup> |
43 | 42 | <ItemGroup> |
43 | + <Compile Include="LinkGameField.cs" /> | |
44 | 44 | <Compile Include="Program.cs" /> |
45 | 45 | <Compile Include="Properties\AssemblyInfo.cs" /> |
46 | 46 | </ItemGroup> |
47 | 47 | <ItemGroup> |
48 | 48 | <None Include="App.config" /> |
49 | 49 | </ItemGroup> |
50 | + <ItemGroup> | |
51 | + <ProjectReference Include="..\Common\Common.csproj"> | |
52 | + <Project>{b44455bf-0f12-47e1-ab63-fe2c7d8f5180}</Project> | |
53 | + <Name>Common</Name> | |
54 | + </ProjectReference> | |
55 | + </ItemGroup> | |
50 | 56 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
51 | 57 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
52 | 58 | Other similar extension points exist, see Microsoft.Common.targets. |
@@ -3,6 +3,7 @@ using System.Collections.Generic; | ||
3 | 3 | using System.Linq; |
4 | 4 | using System.Text; |
5 | 5 | using System.Threading.Tasks; |
6 | +using Common; | |
6 | 7 | |
7 | 8 | namespace Production |
8 | 9 | { |
@@ -10,6 +11,15 @@ namespace Production | ||
10 | 11 | { |
11 | 12 | static void Main(string[] args) |
12 | 13 | { |
14 | + int turn, maxTurn, player; | |
15 | + GameAI ai = new TestAI(); | |
16 | + LinkGameField field = LinkGameField.ParseText(out turn, out maxTurn, out player); | |
17 | + Console.WriteLine(ai.Prepare(player, field)); | |
18 | + for (int i = 0; i < maxTurn; i++) | |
19 | + { | |
20 | + field = LinkGameField.ParseText(out turn, out maxTurn, out player); | |
21 | + ai.Think(turn, maxTurn, player, field, field.GetCommander()); | |
22 | + } | |
13 | 23 | } |
14 | 24 | } |
15 | 25 | } |
@@ -1,6 +1,6 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8" ?> | |
1 | +<?xml version="1.0"?> | |
2 | 2 | <configuration> |
3 | 3 | <startup> |
4 | - <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> | |
4 | + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> | |
5 | 5 | </startup> |
6 | -</configuration> | |
\ No newline at end of file | ||
6 | +</configuration> |
@@ -3,6 +3,6 @@ | ||
3 | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 | 4 | StartupUri="MainWindow.xaml"> |
5 | 5 | <Application.Resources> |
6 | - | |
6 | + | |
7 | 7 | </Application.Resources> |
8 | 8 | </Application> |
@@ -0,0 +1,97 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using Common; | |
7 | + | |
8 | +namespace Visualizer | |
9 | +{ | |
10 | + class GameManager | |
11 | + { | |
12 | + public GenerateGameField Field; | |
13 | + public GameAI[] AI; | |
14 | + public string[] Name; | |
15 | + public int[] ExtraPoint; | |
16 | + public int Player; | |
17 | + public int Turn; | |
18 | + public const int MaxTurn = 200; | |
19 | + | |
20 | + public GameManager(Random random) | |
21 | + { | |
22 | + Field = new GenerateGameField(7, random); | |
23 | + AI = new GameAI[3]; | |
24 | + Name = new string[3]; | |
25 | + ExtraPoint = new int[3]; | |
26 | + Player = 0; | |
27 | + Turn = 1; | |
28 | + } | |
29 | + | |
30 | + public void Prepare() | |
31 | + { | |
32 | + for (int i = 0; i < 3; i++) | |
33 | + { | |
34 | + GameField temp = Field.GetGameFieldView(); | |
35 | + Name[i] = AI[i].Prepare(i, temp); | |
36 | + } | |
37 | + } | |
38 | + | |
39 | + public void NextTurn() | |
40 | + { | |
41 | + if (Turn > MaxTurn) return; | |
42 | + Field.StartTurn(Player); | |
43 | + GameField temp = Field.GetGameFieldView(); | |
44 | + ManagerCommander com = new ManagerCommander(this); | |
45 | + AI[Player].Think(Turn, MaxTurn, Player, temp, com); | |
46 | + Field.EndTurn(Player); | |
47 | + if (!com.IsFinish) throw new Exception(); | |
48 | + if (++Player >= 3) | |
49 | + { | |
50 | + Player = 0; | |
51 | + Turn++; | |
52 | + } | |
53 | + } | |
54 | + | |
55 | + public string GetPlayerInfo(int player) | |
56 | + { | |
57 | + return Name[0] + "\nVP:" + Field.GetTotalVictoryPoint(player).ToString() + "+" + ExtraPoint[player]; | |
58 | + } | |
59 | + | |
60 | + public bool IsGameOver() | |
61 | + { | |
62 | + return Turn > MaxTurn; | |
63 | + } | |
64 | + | |
65 | + class ManagerCommander : Commander | |
66 | + { | |
67 | + GameManager parent; | |
68 | + public bool IsMove; | |
69 | + public bool IsBuild; | |
70 | + public bool IsFinish; | |
71 | + | |
72 | + public ManagerCommander(GameManager parent) | |
73 | + { | |
74 | + this.parent = parent; | |
75 | + } | |
76 | + | |
77 | + public void Move(int x, int y, Direction dir, int robot) | |
78 | + { | |
79 | + if (IsFinish || IsBuild) throw new Exception(); | |
80 | + if (!parent.Field.Move(parent.Player, x, y, dir, robot)) throw new Exception(); | |
81 | + IsMove = true; | |
82 | + } | |
83 | + | |
84 | + public void Build(int x, int y, Terrain building) | |
85 | + { | |
86 | + if (IsFinish || IsBuild || IsMove) throw new Exception(); | |
87 | + if (!parent.Field.Build(parent.Player, x, y, building, ref parent.ExtraPoint[parent.Player])) throw new Exception(); | |
88 | + IsBuild = true; | |
89 | + } | |
90 | + | |
91 | + public void Finish() | |
92 | + { | |
93 | + IsFinish = true; | |
94 | + } | |
95 | + } | |
96 | + } | |
97 | +} |
@@ -1,12 +0,0 @@ | ||
1 | -using System; | |
2 | -using System.Collections.Generic; | |
3 | -using System.Linq; | |
4 | -using System.Text; | |
5 | -using System.Threading.Tasks; | |
6 | - | |
7 | -namespace Visualizer | |
8 | -{ | |
9 | - class GameModel | |
10 | - { | |
11 | - } | |
12 | -} |
@@ -0,0 +1,112 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using Common; | |
7 | + | |
8 | +namespace Visualizer | |
9 | +{ | |
10 | + class GenerateGameField : GameField | |
11 | + { | |
12 | + public GenerateGameField(int size, Random random) | |
13 | + : base(size) | |
14 | + { | |
15 | + Generate(random); | |
16 | + } | |
17 | + | |
18 | + public GameField GetGameFieldView() | |
19 | + { | |
20 | + GameField result = new GameField(Size); | |
21 | + CopyTo(result); | |
22 | + return result; | |
23 | + } | |
24 | + | |
25 | + private void Generate(Random random) | |
26 | + { | |
27 | + int holeCount = RandomizeHole(random); | |
28 | + SymmetryCopy(); | |
29 | + int tileCount = RandomizeInitial(random); | |
30 | + if (holeCount > 15 || tileCount < (Size * (Size - 1) - holeCount) * 3 / 2) | |
31 | + { | |
32 | + Initialize(); | |
33 | + Generate(random); | |
34 | + } | |
35 | + } | |
36 | + | |
37 | + private int RandomizeHole(Random random) | |
38 | + { | |
39 | + int result = 0; | |
40 | + for (int x = 0; x < Size; x++) | |
41 | + { | |
42 | + for (int y = Size; y < Height; y++) | |
43 | + { | |
44 | + if (random.Next(5) == 0) | |
45 | + { | |
46 | + field[x, y].Ter = Terrain.Hole; | |
47 | + result++; | |
48 | + } | |
49 | + } | |
50 | + } | |
51 | + return result; | |
52 | + } | |
53 | + | |
54 | + private void SymmetryCopy() | |
55 | + { | |
56 | + for (int x = 0; x < Width; x++) | |
57 | + { | |
58 | + for (int y = 0; y < Height; y++) | |
59 | + { | |
60 | + if (field[x, y].Ter == Terrain.Outside) continue; | |
61 | + field[y, FuncA(x, y)] = field[x, y]; | |
62 | + field[FuncA(x, y), x] = field[x, y]; | |
63 | + } | |
64 | + } | |
65 | + } | |
66 | + | |
67 | + private int RandomizeInitial(Random random) | |
68 | + { | |
69 | + int x = random.Next(0, Size), y = random.Next(Size, Height); | |
70 | + int[] player = { 0, 1, 2 }; | |
71 | + Shuffle(player, random); | |
72 | + field[x, y].Ter = Terrain.Initial; | |
73 | + field[x, y].Player = player[0]; | |
74 | + field[y, FuncA(x, y)].Ter = Terrain.Initial; | |
75 | + field[y, FuncA(x, y)].Player = player[1]; | |
76 | + field[FuncA(x, y), x].Ter = Terrain.Initial; | |
77 | + field[FuncA(x, y), x].Player = player[2]; | |
78 | + return JoiningCount(new bool[Width, Height], x, y); | |
79 | + } | |
80 | + | |
81 | + private int FuncA(int x, int y) | |
82 | + { | |
83 | + return (Size - 1) * 3 - x - y; | |
84 | + } | |
85 | + | |
86 | + private int JoiningCount(bool[,] settled, int x, int y) | |
87 | + { | |
88 | + if (IsInRange(x, y)) return 0; | |
89 | + if (settled[x, y]) return 0; | |
90 | + if (field[x, y].Ter == Terrain.Outside || field[x, y].Ter == Terrain.Hole) return 0; | |
91 | + int result = 1, tx, ty; | |
92 | + settled[x, y] = true; | |
93 | + for (int i = 1; i < 7; i++) | |
94 | + { | |
95 | + TransformAdjoin(i, x, y, out tx, out ty); | |
96 | + result += JoiningCount(settled, tx, ty); | |
97 | + } | |
98 | + return result; | |
99 | + } | |
100 | + | |
101 | + private void Shuffle<T>(T[] array, Random rand) | |
102 | + { | |
103 | + for (int i = 0; i < array.Length; i++) | |
104 | + { | |
105 | + int a = rand.Next(i, array.Length); | |
106 | + T temp = array[i]; | |
107 | + array[i] = array[a]; | |
108 | + array[a] = temp; | |
109 | + } | |
110 | + } | |
111 | + } | |
112 | +} |
@@ -1,8 +1,24 @@ | ||
1 | 1 | <Window x:Class="Visualizer.MainWindow" |
2 | 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
3 | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 | - Title="MainWindow" Height="350" Width="525"> | |
4 | + Title="MainWindow" Height="600" Width="1000"> | |
5 | 5 | <Grid> |
6 | - | |
6 | + <Grid.ColumnDefinitions> | |
7 | + <ColumnDefinition/> | |
8 | + <ColumnDefinition Width="150"/> | |
9 | + </Grid.ColumnDefinitions> | |
10 | + <Canvas x:Name="FieldInfo" Margin="0" ClipToBounds="True"/> | |
11 | + <StackPanel Grid.Column="1" Margin="10"> | |
12 | + <Button x:Name="NextButton" Content="Next" Click="NextTurnHandler"/> | |
13 | + <CheckBox x:Name="AutoNext" Content="Auto" HorizontalAlignment="Center" Checked="NextTurnHandler"/> | |
14 | + <TextBlock x:Name="Player1Info" Text="Player1" Foreground="Red"/> | |
15 | + <TextBlock x:Name="Player2Info" Text="Player2" Foreground="Blue"/> | |
16 | + <TextBlock x:Name="Player3Info" Text="Player3" Foreground="Green"/> | |
17 | + <Label Content="Show infomartion"/> | |
18 | + <CheckBox x:Name="ShowRobot" Content="Robot" IsChecked="True" Click="ShowChangeHandler"/> | |
19 | + <CheckBox x:Name="ShowResource" Content="Resource" Click="ShowChangeHandler"/> | |
20 | + <CheckBox x:Name="ShowTowerDamage" Content="Tower damage" Click="ShowChangeHandler"/> | |
21 | + </StackPanel> | |
22 | + <GridSplitter Width="1" IsEnabled="False" Background="Black" Margin="0"/> | |
7 | 23 | </Grid> |
8 | 24 | </Window> |
@@ -12,6 +12,7 @@ using System.Windows.Media; | ||
12 | 12 | using System.Windows.Media.Imaging; |
13 | 13 | using System.Windows.Navigation; |
14 | 14 | using System.Windows.Shapes; |
15 | +using Common; | |
15 | 16 | |
16 | 17 | namespace Visualizer |
17 | 18 | { |
@@ -20,9 +21,97 @@ namespace Visualizer | ||
20 | 21 | /// </summary> |
21 | 22 | public partial class MainWindow : Window |
22 | 23 | { |
24 | + GameManager manager; | |
25 | + MassInformation[,] mass; | |
26 | + | |
23 | 27 | public MainWindow() |
24 | 28 | { |
25 | 29 | InitializeComponent(); |
30 | + manager = new GameManager(new Random()); | |
31 | + manager.AI[0] = new TestAI(); | |
32 | + manager.AI[1] = new TestAI(); | |
33 | + manager.AI[2] = new TestAI(); | |
34 | + manager.Prepare(); | |
35 | + int w = manager.Field.Width, h = manager.Field.Height; | |
36 | + mass = new MassInformation[w, h]; | |
37 | + for (int x = 0; x < w; x++) | |
38 | + { | |
39 | + for (int y = 0; y < h; y++) | |
40 | + { | |
41 | + MassInformation temp = new MassInformation(); | |
42 | + mass[x, y] = temp; | |
43 | + FieldInfo.Children.Add(temp); | |
44 | + Canvas.SetLeft(temp, (x + y / 2.0) * temp.Width); | |
45 | + Canvas.SetTop(temp, y * temp.Height); | |
46 | + } | |
47 | + } | |
48 | + UpdateInfo(); | |
49 | + } | |
50 | + | |
51 | + private void UpdateInfo() | |
52 | + { | |
53 | + Player1Info.Text = manager.GetPlayerInfo(0); | |
54 | + Player2Info.Text = manager.GetPlayerInfo(1); | |
55 | + Player3Info.Text = manager.GetPlayerInfo(2); | |
56 | + GameField field = manager.Field; | |
57 | + int w = field.Width, h = field.Height; | |
58 | + for (int x = 0; x < w; x++) | |
59 | + { | |
60 | + for (int y = 0; y < h; y++) | |
61 | + { | |
62 | + mass[x, y].UpdateTerrain(field[x, y].Player, field[x, y].Ter); | |
63 | + mass[x, y].UpdateTextInfo(BuildMassInfo(x, y)); | |
64 | + } | |
65 | + } | |
66 | + } | |
67 | + | |
68 | + private string BuildMassInfo(int x, int y) | |
69 | + { | |
70 | + StringBuilder result = new StringBuilder(); | |
71 | + GameField field = manager.Field; | |
72 | + if (ShowRobot.IsChecked == true) | |
73 | + { | |
74 | + result.AppendLine("Rb:" + field[x, y].WaitRobot.ToString()); | |
75 | + } | |
76 | + if (ShowResource.IsChecked == true) | |
77 | + { | |
78 | + result.AppendLine("Rs:" + field.GetPrepareResource(x, y).ToString() + "(" + field.GetYieldResource(x, y).ToString() + ")"); | |
79 | + } | |
80 | + if (ShowTowerDamage.IsChecked == true) | |
81 | + { | |
82 | + result.AppendLine("Td:" + field.GetEstimateTowerDamage(field[x, y].Player, x, y) + "(" + field.GetTowerDamage(manager.Player, x, y).ToString() + ")"); | |
83 | + } | |
84 | + return result.ToString(); | |
85 | + } | |
86 | + | |
87 | + private void RunTurn() | |
88 | + { | |
89 | + manager.NextTurn(); | |
90 | + Dispatcher.BeginInvoke((Action)CompleteTurn, System.Windows.Threading.DispatcherPriority.Background); | |
91 | + } | |
92 | + | |
93 | + private void CompleteTurn() | |
94 | + { | |
95 | + UpdateInfo(); | |
96 | + if (AutoNext.IsChecked == true && !manager.IsGameOver()) | |
97 | + { | |
98 | + Task.Run((Action)RunTurn); | |
99 | + return; | |
100 | + } | |
101 | + NextButton.IsEnabled = true; | |
102 | + AutoNext.IsChecked = false; | |
103 | + } | |
104 | + | |
105 | + private void NextTurnHandler(object sender, RoutedEventArgs e) | |
106 | + { | |
107 | + if (!NextButton.IsEnabled) return; | |
108 | + NextButton.IsEnabled = false; | |
109 | + Task.Run((Action)RunTurn); | |
110 | + } | |
111 | + | |
112 | + private void ShowChangeHandler(object sender, RoutedEventArgs e) | |
113 | + { | |
114 | + UpdateInfo(); | |
26 | 115 | } |
27 | 116 | } |
28 | 117 | } |
@@ -0,0 +1,12 @@ | ||
1 | +<UserControl x:Class="Visualizer.MassInformation" | |
2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
6 | + mc:Ignorable="d" | |
7 | + Width="40" Height="34" BorderBrush="Black" BorderThickness="1"> | |
8 | + <Canvas> | |
9 | + <Image x:Name="TerrainImage" Height="32" Width="38"/> | |
10 | + <TextBlock x:Name="TextInfo" FontFamily="Meiryo UI" FontSize="8" Height="32" Width="38"/> | |
11 | + </Canvas> | |
12 | +</UserControl> |
@@ -0,0 +1,122 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Linq; | |
4 | +using System.Text; | |
5 | +using System.Threading.Tasks; | |
6 | +using System.Windows; | |
7 | +using System.Windows.Controls; | |
8 | +using System.Windows.Data; | |
9 | +using System.Windows.Documents; | |
10 | +using System.Windows.Input; | |
11 | +using System.Windows.Media; | |
12 | +using System.Windows.Media.Imaging; | |
13 | +using System.Windows.Navigation; | |
14 | +using System.Windows.Shapes; | |
15 | +using Common; | |
16 | + | |
17 | +namespace Visualizer | |
18 | +{ | |
19 | + /// <summary> | |
20 | + /// MassInformation.xaml の相互作用ロジック | |
21 | + /// </summary> | |
22 | + public partial class MassInformation : UserControl | |
23 | + { | |
24 | + static readonly BitmapImage[] hole; | |
25 | + static readonly BitmapImage[] attack; | |
26 | + static readonly BitmapImage[] bridge; | |
27 | + static readonly BitmapImage[] excavator; | |
28 | + static readonly BitmapImage[] house; | |
29 | + static readonly BitmapImage[] initial; | |
30 | + static readonly BitmapImage[] robotmaker; | |
31 | + static readonly BitmapImage[] town; | |
32 | + | |
33 | + static MassInformation() | |
34 | + { | |
35 | + hole = CreateBitmapImage("hole18.png"); | |
36 | + attack = CreateBitmapImage("attack0.png", "attack1.png", "attack2.png"); | |
37 | + bridge = CreateBitmapImage("bridge0.png", "bridge1.png", "bridge2.png"); | |
38 | + excavator = CreateBitmapImage("excavator0.png", "excavator1.png", "excavator2.png"); | |
39 | + house = CreateBitmapImage("house0.png", "house1.png", "house2.png"); | |
40 | + initial = CreateBitmapImage("largerobotmaker0.png", "largerobotmaker1.png", "largerobotmaker2.png"); | |
41 | + robotmaker = CreateBitmapImage("robotmaker0.png", "robotmaker1.png", "robotmaker2.png"); | |
42 | + town = CreateBitmapImage("town0.png", "town1.png", "town2.png"); | |
43 | + } | |
44 | + | |
45 | + public MassInformation() | |
46 | + { | |
47 | + InitializeComponent(); | |
48 | + } | |
49 | + | |
50 | + private static BitmapImage[] CreateBitmapImage(params string[] strs) | |
51 | + { | |
52 | + BitmapImage[] result = new BitmapImage[strs.Length]; | |
53 | + for (int i = 0; i < strs.Length; i++) | |
54 | + { | |
55 | + result[i] = new BitmapImage(new Uri("/Resources/" + strs[i], UriKind.Relative)); | |
56 | + } | |
57 | + return result; | |
58 | + } | |
59 | + | |
60 | + public void UpdateTerrain(int player, Terrain ter) | |
61 | + { | |
62 | + switch (player) | |
63 | + { | |
64 | + case 0: | |
65 | + Background = new SolidColorBrush(Color.FromRgb(255, 128, 128)); | |
66 | + break; | |
67 | + case 1: | |
68 | + Background = new SolidColorBrush(Color.FromRgb(128, 128, 255)); | |
69 | + break; | |
70 | + case 2: | |
71 | + Background = new SolidColorBrush(Color.FromRgb(128, 255, 128)); | |
72 | + break; | |
73 | + default: | |
74 | + Background = new SolidColorBrush(Color.FromRgb(128, 128, 128)); | |
75 | + break; | |
76 | + } | |
77 | + if (ter == Terrain.Outside) | |
78 | + { | |
79 | + Opacity = 0.3; | |
80 | + } | |
81 | + else | |
82 | + { | |
83 | + Opacity = 1; | |
84 | + } | |
85 | + switch (ter) | |
86 | + { | |
87 | + case Terrain.AttackTower: | |
88 | + TerrainImage.Source = attack[player]; | |
89 | + break; | |
90 | + case Terrain.Bridge: | |
91 | + TerrainImage.Source = bridge[player]; | |
92 | + break; | |
93 | + case Terrain.Excavator: | |
94 | + TerrainImage.Source = excavator[player]; | |
95 | + break; | |
96 | + case Terrain.Hole: | |
97 | + TerrainImage.Source = hole[0]; | |
98 | + break; | |
99 | + case Terrain.House: | |
100 | + TerrainImage.Source = house[player]; | |
101 | + break; | |
102 | + case Terrain.Initial: | |
103 | + TerrainImage.Source = initial[player]; | |
104 | + break; | |
105 | + case Terrain.RobotMaker: | |
106 | + TerrainImage.Source = robotmaker[player]; | |
107 | + break; | |
108 | + case Terrain.Town: | |
109 | + TerrainImage.Source = town[player]; | |
110 | + break; | |
111 | + default: | |
112 | + TerrainImage.Source = null; | |
113 | + break; | |
114 | + } | |
115 | + } | |
116 | + | |
117 | + public void UpdateTextInfo(string info) | |
118 | + { | |
119 | + TextInfo.Text = info; | |
120 | + } | |
121 | + } | |
122 | +} |
@@ -4,66 +4,58 @@ | ||
4 | 4 | // ランタイム バージョン:4.0.30319.18052 |
5 | 5 | // |
6 | 6 | // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 |
7 | -// コードが再生成されるときに損失したりします | |
7 | +// コードが再生成されるときに損失したりします。 | |
8 | 8 | // </auto-generated> |
9 | 9 | //------------------------------------------------------------------------------ |
10 | 10 | |
11 | -namespace Visualizer.Properties | |
12 | -{ | |
13 | - | |
14 | - | |
11 | +namespace Visualizer.Properties { | |
12 | + using System; | |
13 | + | |
14 | + | |
15 | 15 | /// <summary> |
16 | 16 | /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 |
17 | 17 | /// </summary> |
18 | - // このクラスは StronglyTypedResourceBuilder クラスによって ResGen | |
18 | + // このクラスは StronglyTypedResourceBuilder クラスが ResGen | |
19 | 19 | // または Visual Studio のようなツールを使用して自動生成されました。 |
20 | 20 | // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に |
21 | 21 | // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 |
22 | 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] |
23 | 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
24 | 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
25 | - internal class Resources | |
26 | - { | |
27 | - | |
25 | + internal class Resources { | |
26 | + | |
28 | 27 | private static global::System.Resources.ResourceManager resourceMan; |
29 | - | |
28 | + | |
30 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; |
31 | - | |
30 | + | |
32 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
33 | - internal Resources() | |
34 | - { | |
32 | + internal Resources() { | |
35 | 33 | } |
36 | - | |
34 | + | |
37 | 35 | /// <summary> |
38 | - /// このクラスに使用される、キャッシュされた ResourceManager のインスタンスを返します。 | |
36 | + /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 | |
39 | 37 | /// </summary> |
40 | 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
41 | - internal static global::System.Resources.ResourceManager ResourceManager | |
42 | - { | |
43 | - get | |
44 | - { | |
45 | - if ((resourceMan == null)) | |
46 | - { | |
39 | + internal static global::System.Resources.ResourceManager ResourceManager { | |
40 | + get { | |
41 | + if (object.ReferenceEquals(resourceMan, null)) { | |
47 | 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Visualizer.Properties.Resources", typeof(Resources).Assembly); |
48 | 43 | resourceMan = temp; |
49 | 44 | } |
50 | 45 | return resourceMan; |
51 | 46 | } |
52 | 47 | } |
53 | - | |
48 | + | |
54 | 49 | /// <summary> |
55 | 50 | /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、 |
56 | 51 | /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 |
57 | 52 | /// </summary> |
58 | 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
59 | - internal static global::System.Globalization.CultureInfo Culture | |
60 | - { | |
61 | - get | |
62 | - { | |
54 | + internal static global::System.Globalization.CultureInfo Culture { | |
55 | + get { | |
63 | 56 | return resourceCulture; |
64 | 57 | } |
65 | - set | |
66 | - { | |
58 | + set { | |
67 | 59 | resourceCulture = value; |
68 | 60 | } |
69 | 61 | } |
@@ -46,7 +46,7 @@ | ||
46 | 46 | |
47 | 47 | mimetype: application/x-microsoft.net.object.binary.base64 |
48 | 48 | value : The object must be serialized with |
49 | - : System.Serialization.Formatters.Binary.BinaryFormatter | |
49 | + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |
50 | 50 | : and then encoded with base64 encoding. |
51 | 51 | |
52 | 52 | mimetype: application/x-microsoft.net.object.soap.base64 |
@@ -60,6 +60,7 @@ | ||
60 | 60 | : and then encoded with base64 encoding. |
61 | 61 | --> |
62 | 62 | <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
63 | + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |
63 | 64 | <xsd:element name="root" msdata:IsDataSet="true"> |
64 | 65 | <xsd:complexType> |
65 | 66 | <xsd:choice maxOccurs="unbounded"> |
@@ -68,9 +69,10 @@ | ||
68 | 69 | <xsd:sequence> |
69 | 70 | <xsd:element name="value" type="xsd:string" minOccurs="0" /> |
70 | 71 | </xsd:sequence> |
71 | - <xsd:attribute name="name" type="xsd:string" /> | |
72 | + <xsd:attribute name="name" use="required" type="xsd:string" /> | |
72 | 73 | <xsd:attribute name="type" type="xsd:string" /> |
73 | 74 | <xsd:attribute name="mimetype" type="xsd:string" /> |
75 | + <xsd:attribute ref="xml:space" /> | |
74 | 76 | </xsd:complexType> |
75 | 77 | </xsd:element> |
76 | 78 | <xsd:element name="assembly"> |
@@ -85,9 +87,10 @@ | ||
85 | 87 | <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
86 | 88 | <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
87 | 89 | </xsd:sequence> |
88 | - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> | |
90 | + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |
89 | 91 | <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
90 | 92 | <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
93 | + <xsd:attribute ref="xml:space" /> | |
91 | 94 | </xsd:complexType> |
92 | 95 | </xsd:element> |
93 | 96 | <xsd:element name="resheader"> |
@@ -109,9 +112,9 @@ | ||
109 | 112 | <value>2.0</value> |
110 | 113 | </resheader> |
111 | 114 | <resheader name="reader"> |
112 | - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
115 | + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
113 | 116 | </resheader> |
114 | 117 | <resheader name="writer"> |
115 | - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
118 | + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
116 | 119 | </resheader> |
117 | 120 | </root> |
\ No newline at end of file |
@@ -1,28 +1,24 @@ | ||
1 | 1 | //------------------------------------------------------------------------------ |
2 | 2 | // <auto-generated> |
3 | -// This code was generated by a tool. | |
4 | -// Runtime Version:4.0.30319.18052 | |
3 | +// このコードはツールによって生成されました。 | |
4 | +// ランタイム バージョン:4.0.30319.18052 | |
5 | 5 | // |
6 | -// Changes to this file may cause incorrect behavior and will be lost if | |
7 | -// the code is regenerated. | |
6 | +// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 | |
7 | +// コードが再生成されるときに損失したりします。 | |
8 | 8 | // </auto-generated> |
9 | 9 | //------------------------------------------------------------------------------ |
10 | 10 | |
11 | -namespace Visualizer.Properties | |
12 | -{ | |
13 | - | |
14 | - | |
11 | +namespace Visualizer.Properties { | |
12 | + | |
13 | + | |
15 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
16 | 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] |
17 | - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase | |
18 | - { | |
19 | - | |
16 | + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { | |
17 | + | |
20 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
21 | - | |
22 | - public static Settings Default | |
23 | - { | |
24 | - get | |
25 | - { | |
19 | + | |
20 | + public static Settings Default { | |
21 | + get { | |
26 | 22 | return defaultInstance; |
27 | 23 | } |
28 | 24 | } |
@@ -13,6 +13,7 @@ | ||
13 | 13 | <FileAlignment>512</FileAlignment> |
14 | 14 | <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
15 | 15 | <WarningLevel>4</WarningLevel> |
16 | + <TargetFrameworkProfile /> | |
16 | 17 | </PropertyGroup> |
17 | 18 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
18 | 19 | <PlatformTarget>AnyCPU</PlatformTarget> |
@@ -23,6 +24,7 @@ | ||
23 | 24 | <DefineConstants>DEBUG;TRACE</DefineConstants> |
24 | 25 | <ErrorReport>prompt</ErrorReport> |
25 | 26 | <WarningLevel>4</WarningLevel> |
27 | + <Prefer32Bit>false</Prefer32Bit> | |
26 | 28 | </PropertyGroup> |
27 | 29 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
28 | 30 | <PlatformTarget>AnyCPU</PlatformTarget> |
@@ -32,10 +34,12 @@ | ||
32 | 34 | <DefineConstants>TRACE</DefineConstants> |
33 | 35 | <ErrorReport>prompt</ErrorReport> |
34 | 36 | <WarningLevel>4</WarningLevel> |
37 | + <Prefer32Bit>false</Prefer32Bit> | |
35 | 38 | </PropertyGroup> |
36 | 39 | <ItemGroup> |
37 | 40 | <Reference Include="System" /> |
38 | 41 | <Reference Include="System.Data" /> |
42 | + <Reference Include="System.Drawing" /> | |
39 | 43 | <Reference Include="System.Xml" /> |
40 | 44 | <Reference Include="Microsoft.CSharp" /> |
41 | 45 | <Reference Include="System.Core" /> |
@@ -61,13 +65,21 @@ | ||
61 | 65 | <DependentUpon>App.xaml</DependentUpon> |
62 | 66 | <SubType>Code</SubType> |
63 | 67 | </Compile> |
64 | - <Compile Include="GameModel.cs" /> | |
68 | + <Compile Include="GameManager.cs" /> | |
69 | + <Compile Include="GenerateGameField.cs" /> | |
65 | 70 | <Compile Include="MainWindow.xaml.cs"> |
66 | 71 | <DependentUpon>MainWindow.xaml</DependentUpon> |
67 | 72 | <SubType>Code</SubType> |
68 | 73 | </Compile> |
74 | + <Page Include="MassInformation.xaml"> | |
75 | + <SubType>Designer</SubType> | |
76 | + <Generator>MSBuild:Compile</Generator> | |
77 | + </Page> | |
69 | 78 | </ItemGroup> |
70 | 79 | <ItemGroup> |
80 | + <Compile Include="MassInformation.xaml.cs"> | |
81 | + <DependentUpon>MassInformation.xaml</DependentUpon> | |
82 | + </Compile> | |
71 | 83 | <Compile Include="Properties\AssemblyInfo.cs"> |
72 | 84 | <SubType>Code</SubType> |
73 | 85 | </Compile> |
@@ -81,10 +93,10 @@ | ||
81 | 93 | <DependentUpon>Settings.settings</DependentUpon> |
82 | 94 | <DesignTimeSharedInput>True</DesignTimeSharedInput> |
83 | 95 | </Compile> |
84 | - <EmbeddedResource Include="Properties\Resources.resx"> | |
96 | + <None Include="Properties\Resources.resx"> | |
85 | 97 | <Generator>ResXFileCodeGenerator</Generator> |
86 | 98 | <LastGenOutput>Resources.Designer.cs</LastGenOutput> |
87 | - </EmbeddedResource> | |
99 | + </None> | |
88 | 100 | <None Include="Properties\Settings.settings"> |
89 | 101 | <Generator>SettingsSingleFileGenerator</Generator> |
90 | 102 | <LastGenOutput>Settings.Designer.cs</LastGenOutput> |
@@ -94,6 +106,122 @@ | ||
94 | 106 | <ItemGroup> |
95 | 107 | <None Include="App.config" /> |
96 | 108 | </ItemGroup> |
109 | + <ItemGroup> | |
110 | + <ProjectReference Include="..\Common\Common.csproj"> | |
111 | + <Project>{b44455bf-0f12-47e1-ab63-fe2c7d8f5180}</Project> | |
112 | + <Name>Common</Name> | |
113 | + </ProjectReference> | |
114 | + </ItemGroup> | |
115 | + <ItemGroup> | |
116 | + <Content Include="Resources\attack0.png"> | |
117 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
118 | + </Content> | |
119 | + </ItemGroup> | |
120 | + <ItemGroup> | |
121 | + <Content Include="Resources\attack1.png"> | |
122 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
123 | + </Content> | |
124 | + </ItemGroup> | |
125 | + <ItemGroup> | |
126 | + <Content Include="Resources\attack2.png"> | |
127 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
128 | + </Content> | |
129 | + </ItemGroup> | |
130 | + <ItemGroup> | |
131 | + <Content Include="Resources\bridge0.png"> | |
132 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
133 | + </Content> | |
134 | + </ItemGroup> | |
135 | + <ItemGroup> | |
136 | + <Content Include="Resources\bridge1.png"> | |
137 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
138 | + </Content> | |
139 | + </ItemGroup> | |
140 | + <ItemGroup> | |
141 | + <Content Include="Resources\bridge2.png"> | |
142 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
143 | + </Content> | |
144 | + </ItemGroup> | |
145 | + <ItemGroup> | |
146 | + <Content Include="Resources\excavator0.png"> | |
147 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
148 | + </Content> | |
149 | + </ItemGroup> | |
150 | + <ItemGroup> | |
151 | + <Content Include="Resources\excavator1.png"> | |
152 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
153 | + </Content> | |
154 | + </ItemGroup> | |
155 | + <ItemGroup> | |
156 | + <Content Include="Resources\excavator2.png"> | |
157 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
158 | + </Content> | |
159 | + </ItemGroup> | |
160 | + <ItemGroup> | |
161 | + <Content Include="Resources\hole18.png"> | |
162 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
163 | + </Content> | |
164 | + </ItemGroup> | |
165 | + <ItemGroup> | |
166 | + <Content Include="Resources\house0.png"> | |
167 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
168 | + </Content> | |
169 | + </ItemGroup> | |
170 | + <ItemGroup> | |
171 | + <Content Include="Resources\house1.png"> | |
172 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
173 | + </Content> | |
174 | + </ItemGroup> | |
175 | + <ItemGroup> | |
176 | + <Content Include="Resources\house2.png"> | |
177 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
178 | + </Content> | |
179 | + </ItemGroup> | |
180 | + <ItemGroup> | |
181 | + <Content Include="Resources\largerobotmaker0.png"> | |
182 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
183 | + </Content> | |
184 | + </ItemGroup> | |
185 | + <ItemGroup> | |
186 | + <Content Include="Resources\largerobotmaker1.png"> | |
187 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
188 | + </Content> | |
189 | + </ItemGroup> | |
190 | + <ItemGroup> | |
191 | + <Content Include="Resources\largerobotmaker2.png"> | |
192 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
193 | + </Content> | |
194 | + </ItemGroup> | |
195 | + <ItemGroup> | |
196 | + <Content Include="Resources\robotmaker0.png"> | |
197 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
198 | + </Content> | |
199 | + </ItemGroup> | |
200 | + <ItemGroup> | |
201 | + <Content Include="Resources\robotmaker1.png"> | |
202 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
203 | + </Content> | |
204 | + </ItemGroup> | |
205 | + <ItemGroup> | |
206 | + <Content Include="Resources\robotmaker2.png"> | |
207 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
208 | + </Content> | |
209 | + </ItemGroup> | |
210 | + <ItemGroup> | |
211 | + <Content Include="Resources\town0.png"> | |
212 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
213 | + </Content> | |
214 | + </ItemGroup> | |
215 | + <ItemGroup> | |
216 | + <Content Include="Resources\town1.png"> | |
217 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
218 | + </Content> | |
219 | + </ItemGroup> | |
220 | + <ItemGroup> | |
221 | + <Content Include="Resources\town2.png"> | |
222 | + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |
223 | + </Content> | |
224 | + </ItemGroup> | |
97 | 225 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
98 | 226 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
99 | 227 | Other similar extension points exist, see Microsoft.Common.targets. |