2024-03-13 00:52:23 +00:00
|
|
|
#include <chrono>
|
2024-03-12 23:06:47 +00:00
|
|
|
#include "queens.hh"
|
|
|
|
#include <iostream>
|
2024-03-13 00:52:23 +00:00
|
|
|
#include <fstream>
|
2024-03-12 23:06:47 +00:00
|
|
|
|
|
|
|
void print_conflict(queens::Conflict c)
|
|
|
|
{
|
|
|
|
std::cout << "🚨 Conflict! "<< "Piece 1: x="<< c.piece_1_x << ", y=" << c.piece_1_y
|
|
|
|
<< " Piece 2: x="<< c.piece_2_x << ", y=" << c.piece_2_y << "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
2024-03-13 00:52:23 +00:00
|
|
|
{
|
|
|
|
std::ofstream log;
|
|
|
|
log.open ("time.csv", std::ios::app);
|
|
|
|
for (int k = 0; k<24*24; k++)
|
2024-03-12 23:06:47 +00:00
|
|
|
{
|
2024-03-13 00:52:23 +00:00
|
|
|
auto t0 = std::chrono::high_resolution_clock::now();
|
|
|
|
queens::Configuration config = queens::Configuration(24, 24, k);
|
|
|
|
std::vector<queens::Conflict> conflicts = config.get_conflicts();
|
|
|
|
auto t1 = std::chrono::high_resolution_clock::now();
|
|
|
|
log << 1.0e-06 * std::chrono::duration_cast<std::chrono::microseconds>(t1-t0).count() << "\n";
|
|
|
|
}
|
|
|
|
log.close();
|
2024-03-12 23:06:47 +00:00
|
|
|
}
|