Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967
Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967
Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967
Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967
Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967
Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967
Strict Standards: Non-static method BBCode::decode_php() should not be called statically in /var/www/vhosts/westca.com/httpdocs/includes/nbbcode.php on line 967 每周一题 -- Nov 17 | IT人生 | 移民生活北美论坛 | 加西网 (温哥华门户)
The enclosed code is some basic code for managing path-node and Power-Up
objects in a 3D Map. A very simple power-up heirarchy is in place but is
far from complete.
As I'm sure you know, path-nodes are used by AI agents to navigate through a
map. A typical "real" map would contain upwards of a thousand PathNodes, but
we've included a simple graph of 8 nodes. A pictoral representation of the
graph is shown in Graph.png and the data has been entered in Main.cpp.
The test has been broken up into three small parts. The entire thing should
take no-more than a few hours (an evening, tops), but take your time. Please
keep a rough idea of how long you spent at it, though -- if you spent more
time and did cooler stuff, that's all good.
===[ Part 1 ]==================================================================
Find as many bugs with the existing code as you can. There are several subtle
but common errors throughout the code. It compiles, and runs, but would not
stand up to production use.
For bonus marks, add a few statements here-and-there to make the code more
quick to detect errors.
You can impose any reasonable restrictions on how the functions can be used
and abused. Halting the program on error illegal input is acceptable in most
cases, but use your judgement for deciding when it isn't appropriate.
===[ Part 2 ]==================================================================
Implement the "findPowerUp" function sketched out in Main.cpp. It is to find a
path through the graph of PathNodes to the nearest PowerUp of the given mType.
Return NULL for no-path, or return an allocated array containing the path as
shown in the function skeleton.
Please briefly describe the algorithm you chose and why you chose it in a
comment block at the top of the function.
===[ Part 3 ]==================================================================
Fill in the Armor and Weapon classes. Add members and methods that you think
would be useful for these kinds of objects. What you add is totally up to you;
it's more meant to show your personal coding style and how you think about
what kind of functionality you'd want to add to the game.
This part is very subjective, so don't worry about it -- there is no wrong
answer.
here is what I come up with with first sight
1. strlen doesn't include the tail 0. +1 please
2. anytime use new[], use delete[]
3. destructor of PathNode is not implemented, I don't know how it can compile
4. pathnode and powerup and its inheritance, non of them implement copy construct, when they are put into stl container, memory leak/stomping everywhere.
5. one of the Vector construtor doesn't initialize its member, looking for trouble of determinism
6. if you want, you can always asset(name), but not a big deal
7. not quite sure if erase(vector.end()) is legal or not, personally, I am not a big fan of stl.