mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-26 09:58:48 +01:00
let's play with C
This commit is contained in:
parent
c4262eb414
commit
e73d385170
1 changed files with 40 additions and 0 deletions
40
star.c
Normal file
40
star.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#define LEVEL_HEIGHT 9
|
||||
#define LEVEL_WIDTH 16
|
||||
char* levels[] = { "WWWWWWWWWWWWWWWWWBWWVVVVVVVVGWCWWVVVVVVVVVVGVWWWWVVVVVVVWWGVVVVWWVVVWWVGVVVVVVWWWWVGVVGVVVVVGVVWWVGVVVVVVGWWVGVWWVVVVVWWGVVVVVGWWWWWWWWWWWWWWWWW" };
|
||||
|
||||
void display_level( char* lvl )
|
||||
{
|
||||
int i;
|
||||
for( i = 0 ; i < LEVEL_HEIGHT * LEVEL_WIDTH ; i++ ) {
|
||||
if ( ( i > 0 ) && ( i % LEVEL_WIDTH == 0 ) ) {
|
||||
printf( "\n" );
|
||||
}
|
||||
switch( lvl[ i ] ) {
|
||||
case 'W':
|
||||
printf( "##" );
|
||||
break;
|
||||
case 'V':
|
||||
printf( " " );
|
||||
break;
|
||||
case 'B':
|
||||
printf( "()" );
|
||||
break;
|
||||
case 'C':
|
||||
printf( "[]" );
|
||||
break;
|
||||
case 'G':
|
||||
printf( "<>" );
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
int main( int argc, char* argv[] )
|
||||
{
|
||||
display_level( levels[ 0 ] );
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue