Format Project

This commit is contained in:
Tobias Linz committed 2026-10-29 16:00:21 +01:00
1 parent 4a7d34044b
commit e94da31756
4 files changed
+24 -30

No files matched your search

+4 -19
View File
@@ -1,45 +1,30 @@
# clang-format-Konfiguration, abgeleitet aus dem bestehenden Wortsalat-Code
BasedOnStyle: LLVM
# Einrückung: 4 Leerzeichen, keine Tabs
IndentWidth: 4
TabWidth: 4
UseTab: Never
ContinuationIndentWidth: 4
# Allman-Stil: geschweifte Klammern für Funktionen, Schleifen, if/else stehen in eigenen Zeilen
BreakBeforeBraces: Allman
# Keine automatischen Zeilenumbrüche, der Code bricht lange Zeilen bereits selbst um
ColumnLimit: 0
ReflowComments: false
# Zeiger-Sternchen rechts: char *word, SearchWord *words
PointerAlignment: Right
DerivePointerAlignment: false
# Kein Leerzeichen vor der Klammer bei if/for/while und bei Funktionsaufrufen
SpaceBeforeParens: Custom
SpaceBeforeParensOptions:
AfterControlStatements: false
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
SpaceAfterCStyleCast: false
# Kurze Konstrukte bleiben mehrzeilig
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortFunctionsOnASingleLine: None
AllowShortCaseLabelsOnASingleLine: false
# Geschweifte Initialisierer: {0, 0}
InsertBraces: true
Cpp11BracedListStyle: true
# Includes nicht umsortieren (Reihenfolge ist teils bewusst gewählt)
SortIncludes: Never
IncludeBlocks: Preserve
SortIncludes: CaseSensitive
IncludeBlocks: Regroup
# Leerzeilen
MaxEmptyLinesToKeep: 2
KeepEmptyLinesAtTheStartOfBlocks: true
+11 -2
View File
@@ -1,8 +1,9 @@
#include "game.h"
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
#define MAX_RAND_TRIES_PER_WORD 10
#define EMPTY_CHAR 0
@@ -19,7 +20,9 @@ int createWordSalad(
unsigned int wordCount)
{
if (searchFieldLen == 0 || searchFieldLen > MAX_SEARCH_FIELD_LEN)
{
return 0;
}
int placedWords = 0;
@@ -27,8 +30,12 @@ int createWordSalad(
// Spielfeld leeren:
for (int x = 0; x < searchFieldLen; x++)
{
for (int y = 0; y < searchFieldLen; y++)
{
salad[x][y] = EMPTY_CHAR;
}
}
// Wörter platzieren
@@ -37,7 +44,9 @@ int createWordSalad(
int wordlenght = strlen(words[w]); // Wortlänge festgelegt
if (wordlenght == 0 || wordlenght > searchFieldLen)
{
continue;
}
for (int attempts = 0;
attempts < MAX_RAND_TRIES_PER_WORD;
+5 -6
View File
@@ -1,14 +1,17 @@
#include "input.h"
#include <string.h>
int readWord(char *buffer, char *divisor, char words[][MAX_WORD_LEN], unsigned int maxWordCount, int *count);
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) {
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
char buffer[MAX_LINE_LEN];
int count = 0;
char *divisor = " ,;.\n";
while (fgets(buffer, MAX_LINE_LEN, file) != NULL) {
while (fgets(buffer, MAX_LINE_LEN, file) != NULL)
{
for (char *word = strtok(buffer, divisor); word != NULL && count < maxWordCount; word = strtok(NULL, divisor))
{
strncpy(words[count], word, MAX_WORD_LEN);
@@ -17,7 +20,3 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
}
return count;
}
+4 -3
View File
@@ -1,8 +1,9 @@
#include <stdlib.h>
#include <stdio.h>
#include "input.h"
#include "game.h"
#include "graphicalGame.h"
#include "input.h"
#include <stdio.h>
#include <stdlib.h>
#define MAX_NUMBER_OF_WORDS 100
#define SALAD_SIZE 20