committed patch to create 'Idle AI'

This commit is contained in:
Dave White 2004-04-30 05:29:51 +00:00
parent db0492bf45
commit e90b40797f
3 changed files with 32 additions and 14 deletions

View file

@ -36,6 +36,10 @@ ai_interface* create_ai(const std::string& name, ai_interface::info& info)
if(name == "sample_ai")
return new sample_ai(info);
else if(name == "idle_ai")
return new idle_ai(info);
else if(name != "")
std::cerr << "ERROR: AI not found: '" << name << "'\n";
return new ai(info);
}

View file

@ -135,6 +135,13 @@ private:
///this function is used to create a new AI object with the specified algorithm name
ai_interface* create_ai(const std::string& algorithm_name, ai_interface::info& info);
///a trivial ai that sits around doing absolutely nothing
class idle_ai : public ai_interface {
public:
idle_ai(info& i) : ai_interface(i) {}
void play_turn() {}
};
class sample_ai : public ai_interface {
public:
sample_ai(info& i) : ai_interface(i) {}
@ -397,8 +404,8 @@ protected:
//lower scores being better, and the lowest possible rating being '10'.
virtual void analyze_potential_recruit_movements();
virtual std::map<std::string,int> unit_movement_scores_;
virtual std::set<std::string> not_recommended_units_;
std::map<std::string,int> unit_movement_scores_;
std::set<std::string> not_recommended_units_;
//function which will analyze all the units that this side can recruit and rate
//their fighting suitability against enemy units. Ratings will be placed in

View file

@ -210,18 +210,25 @@ int play_game(int argc, char** argv)
continue;
}
if(val == "--help" || val == "-h") {
std::cout << "usage: " << argv[0]
<< " [options] [data-directory]\n"
<< " -d, --debug Shows debugging information in-game\n"
<< " -f, --fullscreen Runs the game in full-screen\n"
<< " -h, --help Prints this message and exits\n"
<< " -t, --test Runs the game in a small example scenario\n"
<< " -w, --windowed Runs the game in windowed mode\n";
return 0;
} else if(val == "--version" || val == "-v") {
std::cout << "Battle for Wesnoth " << game_config::version << "\n";
return 0;
if(val == "--help" || val == "-h") {
std::cout << "usage: " << argv[0]
<< " [options] [data-directory]\n"
<< " -d, --debug Shows debugging information in-game\n"
<< " -f, --fullscreen Runs the game in full-screen\n"
<< " -h, --help Prints this message and exits\n"
<< " --path Prints the name of the game data directory and exits\n"
<< " -t, --test Runs the game in a small example scenario\n"
<< " -w, --windowed Runs the game in windowed mode\n"
<< " -v, --version Prints the game's version number and exits\n";
return 0;
} else if(val == "--version" || val == "-v") {
std::cout << "Battle for Wesnoth " << game_config::version
<< "\n";
return 0;
} else if(val == "--path") {
std::cout << game_config::path
<< "\n";
return 0;
}
}