[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.8

error C2143: syntax error : missing ';' before '*

Asked by Gabriela1 in Microsoft Visual C++, C++ Programming Language

Hi guys,

I am using a toolbox, but I have some errors:
the first error ( error C2143: syntax error : missing ';' before '*)it is referring to this line

CGridWorldModel *gridworldModel;
So that means that it did not recognize this type CGridWorldModel as a known type...why is that?

This are all the errors that I have
1>------ Build started: Project: I90Controller, Configuration: Debug Win32 ------
1>Compiling...
1>I90Controller.cpp
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\i90controllerdlg.h(46) : warning C4091: 'extern ' : ignored on left of 'Position' when no variable is declared
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\i90controllerdlg.h(192) : error C2143: syntax error : missing ';' before '*'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\i90controllerdlg.h(192) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\i90controllerdlg.h(192) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>I90ControllerDlg.cpp
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(121) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(121) : warning C4183: 'CGridWorldModel': missing return type; assumed to be a member function returning 'int'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(122) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(122) : warning C4183: 'CGridWorldModel': missing return type; assumed to be a member function returning 'int'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(123) : error C2523: 'CGridWorldModel1::~CGridWorldModel' : destructor tag mismatch
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(294) : error C2143: syntax error : missing ';' before '*'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(294) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(294) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(301) : error C2061: syntax error : identifier 'CGridWorldModel'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(378) : error C2653: 'CGridWorldModel' : is not a class or namespace name
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(378) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(378) : error C2550: 'CGridWorldModel' : constructor initializer lists are only allowed on constructor definitions
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(379) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(379) : error C2227: left of '->max_bounces' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(380) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(380) : error C2227: left of '->reward_standard' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(381) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(381) : error C2227: left of '->reward_bounce' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(382) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(382) : error C2227: left of '->reward_success' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(383) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(383) : error C2227: left of '->is_parsed' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(384) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(384) : error C2227: left of '->start_points' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(385) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(385) : error C2227: left of '->rewards' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(386) : warning C4508: 'CGridWorldModel' : function should return a value; 'void' return type assumed
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(388) : error C2653: 'CGridWorldModel' : is not a class or namespace name
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(388) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(388) : error C2550: 'CGridWorldModel' : constructor initializer lists are only allowed on constructor definitions
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(389) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(389) : error C2227: left of '->max_bounces' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(390) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(390) : error C2227: left of '->reward_standard' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(391) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(391) : error C2227: left of '->reward_bounce' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(392) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(392) : error C2227: left of '->reward_success' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(393) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(393) : error C2227: left of '->is_parsed' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(394) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(394) : error C2227: left of '->start_points' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(395) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(395) : error C2227: left of '->rewards' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(396) : warning C4508: 'CGridWorldModel' : function should return a value; 'void' return type assumed
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(398) : error C2653: 'CGridWorldModel' : is not a class or namespace name
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(398) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>cgridworldmodel.cpp
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(121) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(121) : warning C4183: 'CGridWorldModel': missing return type; assumed to be a member function returning 'int'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(122) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(122) : warning C4183: 'CGridWorldModel': missing return type; assumed to be a member function returning 'int'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(123) : error C2523: 'CGridWorldModel1::~CGridWorldModel' : destructor tag mismatch
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(294) : error C2143: syntax error : missing ';' before '*'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(294) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(294) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.h(301) : error C2061: syntax error : identifier 'CGridWorldModel'
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(378) : error C2653: 'CGridWorldModel' : is not a class or namespace name
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(378) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(378) : error C2550: 'CGridWorldModel' : constructor initializer lists are only allowed on constructor definitions
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(379) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(379) : error C2227: left of '->max_bounces' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(380) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(380) : error C2227: left of '->reward_standard' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(381) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(381) : error C2227: left of '->reward_bounce' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(382) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(382) : error C2227: left of '->reward_success' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(383) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(383) : error C2227: left of '->is_parsed' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(384) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(384) : error C2227: left of '->start_points' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(385) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(385) : error C2227: left of '->rewards' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(386) : warning C4508: 'CGridWorldModel' : function should return a value; 'void' return type assumed
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(388) : error C2653: 'CGridWorldModel' : is not a class or namespace name
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(388) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(388) : error C2550: 'CGridWorldModel' : constructor initializer lists are only allowed on constructor definitions
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(389) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(389) : error C2227: left of '->max_bounces' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(390) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(390) : error C2227: left of '->reward_standard' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(391) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(391) : error C2227: left of '->reward_bounce' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(392) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(392) : error C2227: left of '->reward_success' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(393) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(393) : error C2227: left of '->is_parsed' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(394) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(394) : error C2227: left of '->start_points' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(395) : error C2673: 'CGridWorldModel' : global functions do not have 'this' pointers
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(395) : error C2227: left of '->rewards' must point to class/struct/union/generic type
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(396) : warning C4508: 'CGridWorldModel' : function should return a value; 'void' return type assumed
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(398) : error C2653: 'CGridWorldModel' : is not a class or namespace name
1>c:\documents and settings\ogvalent\desktop\i90controller_v2\i90controller_dri\cgridworldmodel.cpp(398) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Generating Code...
1>Build log was saved at "file://c:\Documents and Settings\ogvalent\Desktop\I90Controller_V2\I90Controller_DRI\Debug\BuildLog.htm"
1>I90Controller - 89 error(s), 9 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I've also attached the cpp file that has this defintions for the class.
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:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
// Copyright (C) 2003
// Gerhard Neumann (gerhard@igi.tu-graz.ac.at)
 
//                
// This file is part of RL Toolbox.
// http://www.igi.tugraz.at/ril_toolbox
//
// All rights reserved.
// 
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
//    derived from this software without specific prior written permission.
// 
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
#ifndef CGRIDWORDMODEL_H
#define CGRIDWORDMODEL_H
 
#ifdef WIN32
#include <windows.h>
#endif // WIN32
 
#include "ctransitionfunction.h"
#include "crewardfunction.h"
#include "cagentcontroller.h"
#include "cdiscretizer.h"
#include "ril_debug.h"
#include <math.h>
#include <vector>
#include <map>
#include <set>
 
#define GRIDWORLDACTION 16
 
class CGridWorld
{
protected:
	int size_x, size_y;
	std::set<char>* start_values;
	std::set<char>* target_values;
	std::set<char>* prohibited_values;
 
	std::vector<char *>* grid;
 
	void allocGrid();
	void deallocGrid();
 
	bool is_allocated;
 
public:
	CGridWorld(char* filename);
	CGridWorld(unsigned int size_x, unsigned int size_y);
	virtual ~CGridWorld();
 
	void load(char* filename);
	virtual void load(FILE *stream);
 
	void save(char* filename);
	virtual void save(FILE *stream);
 
	virtual void initGrid();
	virtual bool isValid();
 
    virtual void setGridValue(unsigned int pos_x, unsigned int pos_y, char value);
    char getGridValue(unsigned int pos_x, unsigned int pos_y);
 
	virtual void addStartValue(char value);
	virtual void removeStartValue(char value);
	std::set<char> *getStartValues();
 
	virtual void addTargetValue(char value);
	virtual void removeTargetValue(char value);
	std::set<char> *getTargetValues();
 
	virtual void addProhibitedValue(char value);
	virtual void removeProhibitedValue(char value);
	std::set<char> *getProhibitedValues();
 
	void setSize(unsigned int size_x, unsigned int size_y);
 
	unsigned int getSizeX();
	unsigned int getSizeY();
 
	std::set<char> *getUsedValues();
};
 
 
class CGridWorldModel : public CGridWorld, public CTransitionFunction, public CRewardFunction
{
protected:
	unsigned int max_bounces;
 
 
	std::vector<std::pair<int, int>* >* start_points;
	std::map<char, rlt_real> *rewards;
 
	rlt_real reward_standard;
	rlt_real reward_success;
	rlt_real reward_bounce;
 
	bool is_parsed;
	virtual void parseGrid();
 
public:
	CGridWorldModel(unsigned int size_x, unsigned int size_y, unsigned int max_bounces);	
	CGridWorldModel(char* filename, unsigned int max_bounces);	
	virtual ~CGridWorldModel();
 
	void setMaxBounces(unsigned int value);
	unsigned int getMaxBounces();
 
	/*void setActualBounces(unsigned int value);
	unsigned int getActualBounces();
 
	void setPosX(unsigned int value);
	int getPosX();
 
	void setPosY(unsigned int value);
	int getPosY();*/
 
    void setRewardStandard(rlt_real value);
	void setRewardSuccess(rlt_real value);
	void setRewardBounce(rlt_real value);
 
	void setRewardForSymbol(char symbol, rlt_real reward);
	rlt_real getRewardForSymbol(char symbol);
 
	rlt_real getRewardStandard();
	rlt_real getRewardSuccess();
	rlt_real getRewardBounce();
 
	virtual void load(FILE *stream);
	virtual void initGrid();
    virtual void setGridValue(unsigned int pos_x, unsigned int pos_y, char value);
	virtual void addStartValue(char value);
	virtual void removeStartValue(char value);
 
	virtual void transitionFunction(CState *oldstate, CAction *action, CState *newState, CActionData *data = NULL);
 
	virtual bool isResetState(CState *state);
	virtual bool isFailedState(CState *state);
 
	virtual void getResetState(CState *resetState);
 
	virtual rlt_real getReward(CStateCollection *oldState, CAction *action, CStateCollection *newState);
 
};
 
 
class CLocal4GridWorldState : public CStateModifier
{
protected:
	CGridWorld* grid_world;
public:
	CLocal4GridWorldState(CGridWorld *grid_world);	
	virtual ~CLocal4GridWorldState();
 
	virtual void getModifiedState(CStateCollection *originalState, CState *modifiedState);
};
 
 
class CLocal4XGridWorldState : public CStateModifier
{
protected:
	CGridWorld* grid_world;
public:
	CLocal4XGridWorldState(CGridWorld *grid_world);	
	virtual ~CLocal4XGridWorldState();
 
	virtual void getModifiedState(CStateCollection *originalState, CState *modifiedState);
};
 
 
class CLocal8GridWorldState : public CStateModifier
{
protected:
	CGridWorld* grid_world;
public:
	CLocal8GridWorldState(CGridWorld *grid_world);	
	virtual ~CLocal8GridWorldState();
 
	virtual void getModifiedState(CStateCollection *originalState, CState *modifiedState);
};
 
 
class CGlobalGridWorldDiscreteState : public CAbstractStateDiscretizer
{
protected:
	unsigned int size_x, size_y;
 
public:
	CGlobalGridWorldDiscreteState(unsigned int size_x, unsigned int size_y);
	virtual ~CGlobalGridWorldDiscreteState() {};
 
	virtual unsigned int getDiscreteStateNumber(CStateCollection *state);		
};
 
 
class CLocalGridWorldDiscreteState : public CAbstractStateDiscretizer
{
protected:
	CStateModifier* orig_state;
	std::map<char, short>* valuemap;
 
public:
	CLocalGridWorldDiscreteState(CStateModifier* orig_state, unsigned int neigbourhood, std::set<char> *possible_values);
	virtual ~CLocalGridWorldDiscreteState();
 
	virtual unsigned int getDiscreteStateNumber(CStateCollection *state);		
};
 
 
class CSmallLocalGridWorldDiscreteState : public CAbstractStateDiscretizer
{
protected:
	CStateModifier* orig_state;
	CGridWorld *gridworld;
 
public:
	CSmallLocalGridWorldDiscreteState(CStateModifier* orig_state, unsigned int neigbourhood, CGridWorld *gridworld);
	virtual ~CSmallLocalGridWorldDiscreteState();
 
	virtual unsigned int getDiscreteStateNumber(CStateCollection *state);		
};
 
 
class CGridWorldAction : public CPrimitiveAction
{
protected:
	int x_move, y_move;
 
public:
	CGridWorldAction(int x_move, int y_move);
 
	int getXMove();
    int getYMove();
};
 
 
class CGridWorldController : public CAgentStatisticController, public CSemiMDPListener
{
	struct GridControllerRecord
	{
		CGridWorldAction* action;
		int pos_x;
		int pos_y;
		rlt_real factor;
		rlt_real distance;
	};
 
protected:
	CGridWorld *gridworld;
	std::vector<GridControllerRecord> *record;
	std::set<std::pair<unsigned int, unsigned int>*>* target_points;
	int lastXMove, lastYMove;
 
public:
	CGridWorldController(CGridWorld *gridworld, CActionSet *actions);
	virtual ~CGridWorldController();
 
	void init();
 
	virtual CAction* getNextAction(CStateCollection *state, CActionStatistics *stat);
 
	virtual void  nextStep(CStateCollection *oldState, CAction *action, CStateCollection *nextState) {}; 
   
	virtual void  intermediateStep(CStateCollection *oldState, CAction *action, CStateCollection *nextState) {};
 
	virtual void  newEpisode();
};
 
 
#ifdef WIN32
 
class CGridWorldVisualizer : public CSemiMDPListener
{
protected:
	CGridWorldModel *gridworld;
	bool flgDisplay;
	bool flgTranspose;
	HANDLE console;
	short xpos, ypos, xoffset, yoffset;
 
public:
    CGridWorldVisualizer(CGridWorldModel *gridworld);
	virtual ~CGridWorldVisualizer();
 
	virtual void  nextStep(CStateCollection *oldState, CAction *action, CStateCollection *nextState); 
   
	virtual void  intermediateStep(CStateCollection *oldState, CAction *action, CStateCollection *nextState) {};
 
	virtual void  newEpisode();
 
	bool getDisplay();
 
	void setDisplay(bool flgDisplay);
};
 
#endif // WIN32
 
 
class CRaceTrackDiscreteState : public CAbstractStateDiscretizer
{
protected:
	CStateModifier* orig_state;
	CGridWorld *gridworld;
 
public:
	CRaceTrackDiscreteState(CStateModifier* orig_state, unsigned int neigbourhood, CGridWorld *gridworld);
	virtual ~CRaceTrackDiscreteState();
 
	virtual unsigned int getDiscreteStateNumber(CStateCollection *state);		
};
 
 
class CRaceTrack
{
public:
	static void generateRaceTrack(CGridWorld *gridworld, unsigned int width = 40, unsigned int length = 200, unsigned int h_max = 5, unsigned int dy_min = 1, unsigned int dy_max = 8);
};
 
 
#endif // CGRIDWORDMODEL_H
[+][-]10/14/09 05:42 PM, ID: 25576445Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/14/09 05:48 PM, ID: 25576472Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/14/09 07:00 PM, ID: 25576685Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/14/09 10:42 PM, ID: 25577532Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 06:44 AM, ID: 25580422Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 06:55 AM, ID: 25580545Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 11:11 AM, ID: 25583161Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 11:14 AM, ID: 25583192Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 11:18 AM, ID: 25583240Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Microsoft Visual C++, C++ Programming Language
Sign Up Now!
Solution Provided By: Infinity08
Participating Experts: 3
Solution Grade: A
 
[+][-]10/15/09 11:57 AM, ID: 25583599Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 11:59 AM, ID: 25583615Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 12:03 PM, ID: 25583640Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 12:12 PM, ID: 25583721Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 12:18 PM, ID: 25583785Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 12:25 PM, ID: 25583851Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 12:30 PM, ID: 25583889Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 01:30 PM, ID: 25584570Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 01:37 PM, ID: 25584637Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10/15/09 01:45 PM, ID: 25584718Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/15/09 01:49 PM, ID: 25584768Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/15/09 02:23 PM, ID: 25585066Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/16/09 12:55 AM, ID: 25587622Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/16/09 12:57 AM, ID: 25587630Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/16/09 04:00 AM, ID: 25588319Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/16/09 07:02 AM, ID: 25589630Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625