![]() |
4-gewinnt
1.0.0
Klassiker "4-gewinnt" als Konsolenanwendung
|
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
gehe zum Quellcode dieser Datei
Funktionen | |
void | showHallOfShame (int highlight, int startFrom) |
int | updateSaveHoS (char *victor, char *victim, int moves) |
int | extractMoves (char *line) |
int | getOldFileLength () |
int extractMoves | ( | char * | line | ) |
This function extracts the number of moves of the parameter line.
line | Pointer to char array (string). |
Definiert in Zeile 160 der Datei hallofshame.c.
Benutzt moves.
Wird benutzt von updateSaveHoS().
int getOldFileLength | ( | ) |
Determine the length of the current HallOfShame.dat file.
Definiert in Zeile 185 der Datei hallofshame.c.
Wird benutzt von updateSaveHoS().
void showHallOfShame | ( | int | highlight, |
int | startFrom | ||
) |
This function prints a certain number (c.f. HOS_LINES) of lines of the HallOfShame.dat to the console.
highlight | Highlight a special line with "-> " |
startFrom | The output is reduced to a constant number of lines (c.f. variables.h HOS_LINES). The parameter controls which lines actually are printed. |
Definiert in Zeile 13 der Datei hallofshame.c.
Benutzt flushBuffer(), HOS_LINES, moves, output(), setLineAlign(), startBuffer(), userInput und victor.
Wird benutzt von gameFunction() und mainMenuReactToEnter().
int updateSaveHoS | ( | char * | victor, |
char * | victim, | ||
int | moves | ||
) |
This functions uses the 3 parameters to update and save the Hall of Shame. The 3 parameters will be interpreted as a line which has to be inserted to the HallOfShame.dat document. A kind of Insertion Sort is used to put the line on the right place.
victor | Name of player who won the game. |
vicitim | Name of player who lost. |
moves | Number of steps after the game has finished. |
Definiert in Zeile 101 der Datei hallofshame.c.
Benutzt EXITCODE_OUTOFMEMORY, extractMoves() und getOldFileLength().
Wird benutzt von gameFunction().