Skip to content

Commit

Permalink
Rename task_t to explorer_t
Browse files Browse the repository at this point in the history
  • Loading branch information
lucka-me committed Apr 20, 2023
1 parent 244b5ea commit db5a976
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace ingress_drone_explorer {

class task_t {
class explorer_t {
public:
void load_portals(const std::vector<std::string>& filenames);
void load_keys(const std::string& filename);
Expand Down
14 changes: 7 additions & 7 deletions src/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <boost/program_options.hpp>

#include "extensions/iostream_extensions.hpp"
#include "task/task_t.hpp"
#include "explorer/explorer_t.hpp"

namespace ingress_drone_explorer {

Expand Down Expand Up @@ -46,15 +46,15 @@ void command::execute(const int argc, const char* const argv[]) {

boost::program_options::notify(variables);

task_t task;
task.load_portals(portal_list_filenames);
explorer_t explorer;
explorer.load_portals(portal_list_filenames);
if (variables.count("key-list")) {
task.load_keys(variables["key-list"].as<std::string>());
explorer.load_keys(variables["key-list"].as<std::string>());
}
task.explore_from(start);
task.report();
explorer.explore_from(start);
explorer.report();
if (variables.count("output-drawn-items")) {
task.save_drawn_items_to(variables["output-drawn-items"].as<std::string>());
explorer.save_drawn_items_to(variables["output-drawn-items"].as<std::string>());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/task/explore.cpp → src/explorer/explore.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "task/task_t.hpp"
#include "explorer/explorer_t.hpp"

#include <chrono>
#include <iomanip>
Expand All @@ -8,7 +8,7 @@

namespace ingress_drone_explorer {

void task_t::explore_from(const coordinate_t& start) {
void explorer_t::explore_from(const coordinate_t& start) {
_start = start;
const auto start_time = std::chrono::steady_clock::now();
const auto start_cell = s2::cell_t(start);
Expand Down
6 changes: 3 additions & 3 deletions src/task/load.cpp → src/explorer/load.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "task/task_t.hpp"
#include "explorer/explorer_t.hpp"

#include <chrono>
#include <filesystem>
Expand All @@ -12,7 +12,7 @@

namespace ingress_drone_explorer {

void task_t::load_portals(const std::vector<std::string>& filenames) {
void explorer_t::load_portals(const std::vector<std::string>& filenames) {
const auto start_time = std::chrono::steady_clock::now();
std::cout << "⏳ Loading Portals..." << std::endl;

Expand Down Expand Up @@ -93,7 +93,7 @@ void task_t::load_portals(const std::vector<std::string>& filenames) {
<< std::endl;
}

void task_t::load_keys(const std::string& filename) {
void explorer_t::load_keys(const std::string& filename) {
std::cout << "⏳ Loading Keys from " << filename << "..." << std::endl;
std::ifstream in(filename);
if (!in.is_open()) {
Expand Down
12 changes: 6 additions & 6 deletions src/task/report.cpp → src/explorer/report.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "task/task_t.hpp"
#include "explorer/explorer_t.hpp"

#include <fstream>
#include <iomanip>
Expand All @@ -12,7 +12,7 @@

namespace ingress_drone_explorer {

void task_t::report() const {
void explorer_t::report() const {
size_t portals_count = 0;
size_t reachable_portals_count = 0;
portal_t furthest_portal;
Expand All @@ -38,12 +38,12 @@ void task_t::report() const {
<< std::endl;
return;
}
const auto total_numberDigits = digits(portals_count);
const auto total_number_digits = digits(portals_count);
const auto reachable_number_digits = digits(reachable_portals_count);
const auto unreachable_number_digits = digits(portals_count - reachable_portals_count);
std::cout
<< "⬜️ In "
<< std::setw(total_numberDigits) << _cells.size()
<< std::setw(total_number_digits) << _cells.size()
<< " cell(s), "
<< std::setw(reachable_number_digits) << _reachable_cells.size()
<< " are ✅ reachable, "
Expand All @@ -52,7 +52,7 @@ void task_t::report() const {
<< std::endl;
std::cout
<< "📍 In "
<< std::setw(total_numberDigits) << portals_count
<< std::setw(total_number_digits) << portals_count
<< " Portal(s), "
<< std::setw(reachable_number_digits) << reachable_portals_count
<< " are ✅ reachable, "
Expand All @@ -72,7 +72,7 @@ void task_t::report() const {
<< std::endl;
}

void task_t::save_drawn_items_to(const std::string& filename) const {
void explorer_t::save_drawn_items_to(const std::string& filename) const {
std::ofstream out(filename);
if (!out.is_open()) {
throw std::runtime_error("Unable to open drawn items file.");
Expand Down

0 comments on commit db5a976

Please sign in to comment.