Я пытаюсь сделать это для более крупных сетей. Цель кода состоит в том, чтобы взять текстовый файл с размерами сетки и словами, которые должны появиться в сетке и словах, чем не могут появиться в сетке, а затем сделать как можно больше комбинаций этих слов и случайных букв для заполнения сетки. Мне не обязательно нужен от вас код, так как это заслуга, и я не знаю, где стоят мораль, но хотели бы любые советы. #include
#include
#include
#include
#include
#include
// Global Variables Here
std::vector include_words;
std::vector disclude_words;
int grid_width;
int grid_height;
std::vector wordCount;
// Helper functions
/*
name of file to be read and information stored
Takes in a file name, reads file line by line, stores grid dimensions
and words
*/
void read_file(const std::string& input_file_name) {
std::ifstream input(input_file_name);
// Check if the file is open
if (!input) {
std::cerr > grid_height;
wordCount = std::vector(grid_height, std::vector
(grid_width, 0));
// Temporary variables for reading lines
std::string line;
char symbol;
std::string word;
// Read the rest of the file line by line
while (input >> symbol >> word) {
if (symbol == '+') {
// Add the word to the include_words vector
include_words.push_back(word);
} else if (symbol == '-') {
// Add the word to the disclude_words vector
disclude_words.push_back(word);
std::reverse(word.begin(), word.end());
disclude_words.push_back(word);
} else {
// Handle invalid symbols (optional)
std::cerr
Подробнее здесь: https://stackoverflow.com/questions/795 ... mprovement