Merge branch 'develop' of https://github.com/ykolomiets/fillit into develop
This commit is contained in:
commit
858b0ea8bb
1 changed files with 14 additions and 0 deletions
14
main.c
14
main.c
|
@ -120,6 +120,8 @@ t_ttr ttr_tamplates[19] =
|
||||||
"...." }
|
"...." }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// read from file. Returns string.
|
||||||
char *read_file(char *path)
|
char *read_file(char *path)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -147,6 +149,7 @@ char *read_file(char *path)
|
||||||
return (string);
|
return (string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Split string to table by newline character. Each string contain one line of the file
|
||||||
char **to_table(char *string)
|
char **to_table(char *string)
|
||||||
{
|
{
|
||||||
char **table;
|
char **table;
|
||||||
|
@ -157,6 +160,7 @@ char **to_table(char *string)
|
||||||
return (table);
|
return (table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test func. Print string table.
|
||||||
void print_table(char **table)
|
void print_table(char **table)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -172,6 +176,7 @@ void print_table(char **table)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test func. Print table but one string contain whole figure.
|
||||||
void print_one_string(char **glued)
|
void print_one_string(char **glued)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -193,6 +198,8 @@ void print_one_string(char **glued)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function creates string table in which one line represent one figure
|
||||||
|
// by "glueing" evry 4 strings from table
|
||||||
char **glue_figure(char **table)
|
char **glue_figure(char **table)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -224,6 +231,8 @@ char **glue_figure(char **table)
|
||||||
return (ttr_table);
|
return (ttr_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Moves figures to top left corner.
|
||||||
|
// table contains strings each represent one figure
|
||||||
void move_up_left(char **table)
|
void move_up_left(char **table)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -259,6 +268,7 @@ void move_up_left(char **table)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert "#" symbols to letters
|
||||||
void to_letters(char **ttr)
|
void to_letters(char **ttr)
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
|
@ -281,6 +291,8 @@ void to_letters(char **ttr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test func. Compare figures from file
|
||||||
|
// with templates
|
||||||
void test_check(char **ttr, t_ttr *tamplates)
|
void test_check(char **ttr, t_ttr *tamplates)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -304,6 +316,8 @@ void test_check(char **ttr, t_ttr *tamplates)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Forgot for what this func was added:)
|
||||||
int ft_dumb_sqrt(int nb)
|
int ft_dumb_sqrt(int nb)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
Loading…
Reference in a new issue