commit 0d0472b64f9f09cbb34e84769d13123116cc35c5 from: Sylvain Saboua date: Mon Apr 28 12:46:07 2025 UTC syntax commit - cdd0e4423aa4714cc9e1e78c32dbf673fc480ec4 commit + 0d0472b64f9f09cbb34e84769d13123116cc35c5 blob - 9be8103cdbd00876a3408e1250e4bb4830d34654 blob + 2b69733e9fc1518b7f545009beedd9b7affacff9 --- geomant.c +++ geomant.c @@ -48,19 +48,15 @@ char *figures[15][4] = { char *txt_raw_scrap = NULL ; size_t txt_raw_scrap_size = 0UL ; - /* + * "mantize" : input fuction + * This function gathers a string of user input + * and returns a 0 or 1 for the evenness or + * oddity of the number of characters. It is called + * in a sequence by the next function to generate + * the figures one by one. + */ - "mantize" : input fuction - - This function gathers a string of user input - and returns a 0 or 1 for the evenness or - oddity of the number of characters. It is called - in a sequence by the next function to generate - the figures one by one. - -*/ - int mantize ( int n_bodypart, int n_figure ) { printf ( "Hold or repeatedly press a key or keys to generate the %s of the %s mother, then press Enter:\n", body_parts[n_bodypart], mother_figures[n_figure] ) ; @@ -68,20 +64,16 @@ int mantize ( int n_bodypart, int n_figure ) { return ( ( strlen ( txt_raw_scrap ) -1 ) % 2 ) ; // substracting 1 as the \n character } - /* - - "generate" fuction: + * "generate" fuction: + * This function takes the cast result (being 0 or 1, + * odd or even) and use it to generate + * all 15 figures, from the mothers down to the + * daughters, nieces, witnesses and judge. + */ - This function takes the cast result (being 0 or 1, - odd or even) and use it to generate - all 15 figures, from the mothers down to the - daughters, nieces, witnesses and judge. - -*/ - int generate(){ - + // generating the mothers for ( n_figure = 0 ; n_figure < 4 ; n_figure++ ) { for ( n_bodypart = 0 ; n_bodypart < 4 ; n_bodypart++ ) { @@ -90,9 +82,9 @@ int generate(){ system("clear"); } } - + //generating the four daughters from the four mothers - + figures[4][0] = figures[0][0] ; figures[4][1] = figures[1][0] ; figures[4][2] = figures[2][0] ; @@ -112,7 +104,7 @@ int generate(){ figures[7][1] = figures[1][3] ; figures[7][2] = figures[2][3] ; figures[7][3] = figures[3][3] ; - + // generating the nieces figures[8][0] = ( figures[0][0] == figures[1][0] ) ? "* *" : " * " ; @@ -134,7 +126,7 @@ int generate(){ figures[11][1] = ( figures[6][1] == figures[7][1] ) ? "* *" : " * " ; figures[11][2] = ( figures[6][2] == figures[7][2] ) ? "* *" : " * " ; figures[11][3] = ( figures[6][3] == figures[7][3] ) ? "* *" : " * " ; - + // generating the witnesses figures[12][0] = ( figures[8][0] == figures[9][0] ) ? "* *" : " * " ; @@ -146,9 +138,9 @@ int generate(){ figures[13][1] = ( figures[10][1] == figures[11][1] ) ? "* *" : " * " ; figures[13][2] = ( figures[10][2] == figures[11][2] ) ? "* *" : " * " ; figures[13][3] = ( figures[10][3] == figures[11][3] ) ? "* *" : " * " ; - + //generating the judge - + figures[14][0] = ( figures[12][0] == figures[13][0] ) ? "* *" : " * " ; figures[14][1] = ( figures[12][1] == figures[13][1] ) ? "* *" : " * " ; figures[14][2] = ( figures[12][2] == figures[13][2] ) ? "* *" : " * " ; @@ -157,28 +149,24 @@ int generate(){ return *figures[14][3] ; } - /* + * "display" function: + * This function will display onscreen the final + * geomantic Shield for the given divination. + * The "-" & "|" characters are used for separation + * while the dots are displayed using "*" + */ - "display" function: - - This function will display onscreen the final - geomantic Shield for the given divination. - The "-" & "|" characters are used for separation - while the dots are displayed using "*" - -*/ - int main(){ printf("What is the subject title of your enquiry ?\n"); getline ( &txt_topic, &txt_topic_size, stdin ) ; - + generate(); printf ("\n %s\n", txt_topic); printf (" |-----------------------------------------|\n"); // top line - + // printing the first 8 figures (4 daughters & 4 mothers) printf (" | %s %s %s %s | %s %s %s %s |\n" " | %s %s %s %s | %s %s %s %s |\n" @@ -193,7 +181,7 @@ int main(){ figures[7][3],figures[6][3],figures[5][3],figures[4][3], figures[3][3],figures[2][3],figures[1][3],figures[0][3]); printf (" |-----------------------------------------|\n"); - + // printing the four nieces printf (" | %s %s | %s %s |\n" " | %s %s | %s %s |\n" @@ -217,5 +205,5 @@ int main(){ figures[13][3],figures[14][3],figures[12][3]); printf (" \\_________________________________________/\n\n"); - + }