25 lines
814 B
C++
25 lines
814 B
C++
#include <chrono>
|
|
#include "queens.hh"
|
|
#include <iostream>
|
|
#include <fstream>
|
|
|
|
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()
|
|
{
|
|
std::ofstream log;
|
|
log.open ("time.csv", std::ios::app);
|
|
for (int k = 0; k<24*24; k++)
|
|
{
|
|
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();
|
|
} |