1
Fork 0
This repository has been archived on 2025-04-09. You can view files and clone it, but cannot push or open issues or pull requests.
puzzle-wuzzle-generator/include/generator.hpp
2014-02-17 16:29:20 +01:00

20 lines
476 B
C++

#pragma once
#include "grid.hpp"
#include <random>
namespace detail {
template <int W, int H, typename URNG, size_t... I>
auto random_field(URNG&& r, std::index_sequence<I...>){
std::uniform_int_distribution<int> dis(1, 2);
return create_rectangular_field<W, H>({
((void)I, dis(r))...
});
}
}
template <int W, int H, typename URNG>
auto random_field(URNG&& r){
using Indices = std::make_index_sequence<W*H>;
return detail::random_field<W, H>(r, Indices{});
}