#include<stdio.h>
#include<stdlib.h>
#define WIDTH 40
#define HEIGHT 30
int field[ HEIGHT] [ WIDTH] = { 0 } ;
char is_rain( int b)
{
return b == 1 ? '|' : ' ' ;
}
char is_splash( int b)
{
return b == 1 ? 'w' : ' ' ;
}
void put_field( void )
{
int x, y;
for ( y = 0 ; y < HEIGHT - 1 ; y++ ) {
for ( x = 0 ; x < WIDTH; x++ ) {
if ( y < HEIGHT - 2 ) {
printf ( "%c" , is_rain
( field
[ y
] [ x
] ) ) ; } else {
printf ( "%c" , is_splash
( field
[ y
] [ x
] ) ) ; }
}
}
for ( x = 0 ; x < WIDTH; x++ ) {
}
}
void reflesh_field( void )
{
int x, y;
for ( y = HEIGHT - 1 ; y > 0 ; y-- ) {
for ( x = 0 ; x < WIDTH; x++ ) {
field[ y] [ x] = field[ y - 1 ] [ x] ;
}
}
for ( x = 0 ; x < WIDTH; x++ ) {
field
[ 0 ] [ x
] = rand ( ) >= RAND_MAX
/ 25 ? 0 : 1 ; }
}
void main( void )
{
while ( 1 ) {
reflesh_field( ) ;
put_field( ) ;
}
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8c3RkbGliLmg+CgojZGVmaW5lIFdJRFRIIDQwCiNkZWZpbmUgSEVJR0hUIDMwCgppbnQgZmllbGRbSEVJR0hUXVtXSURUSF0gPSB7IDAgfTsKCmNoYXIgaXNfcmFpbihpbnQgYikKewoJcmV0dXJuIGIgPT0gMSA/ICd8JyA6ICcgJzsKfQoKY2hhciBpc19zcGxhc2goaW50IGIpCnsKCXJldHVybiBiID09IDEgPyAndycgOiAnICc7Cn0KCnZvaWQgcHV0X2ZpZWxkKHZvaWQpCnsKCWludCB4LCB5OwoJZm9yICh5ID0gMDsgeSA8IEhFSUdIVCAtIDE7IHkrKykgewoJCWZvciAoeCA9IDA7IHggPCBXSURUSDsgeCsrKSB7CgkJCWlmICh5IDwgSEVJR0hUIC0gMikgewoJCQkJcHJpbnRmKCIlYyIsIGlzX3JhaW4oZmllbGRbeV1beF0pKTsKCQkJfSBlbHNlIHsKCQkJCXByaW50ZigiJWMiLCBpc19zcGxhc2goZmllbGRbeV1beF0pKTsKCQkJfQoJCX0KCQlwdXRjaGFyKCdcbicpOwoJfQoJZm9yICh4ID0gMDsgeCA8IFdJRFRIOyB4KyspIHsKCQlwdXRjaGFyKCctJyk7Cgl9CglzeXN0ZW0oImNscyIpOwp9Cgp2b2lkIHJlZmxlc2hfZmllbGQodm9pZCkKewoJaW50IHgsIHk7Cglmb3IoeSA9IEhFSUdIVCAtIDE7IHkgPiAwOyB5LS0pIHsKCQlmb3IgKHggPSAwOyB4IDwgV0lEVEg7IHgrKykgewoJCQlmaWVsZFt5XVt4XSA9IGZpZWxkW3kgLSAxXVt4XTsKCQl9Cgl9CgoJZm9yKHggPSAwOyB4IDwgV0lEVEg7IHgrKykgewoJCWZpZWxkWzBdW3hdID0gcmFuZCgpID49IFJBTkRfTUFYIC8gMjUgPyAwIDogMTsKCX0KfQoKdm9pZCBtYWluKHZvaWQpCnsKCXdoaWxlKDEpIHsKCQlyZWZsZXNoX2ZpZWxkKCk7CgkJcHV0X2ZpZWxkKCk7Cgl9Cn0=
stdout
|
---------------------------------------- | |
|
----------------------------------------
| |
|
----------------------------------------
| |
|
---------------------------------------- | |
| |
|
---------------------------------------- |
| |
| |
|
----------------------------------------
|
| |
| |
|
---------------------------------------- |
|
| |
| |
|
----------------------------------------
|
|
| |
| |
|
---------------------------------------- |
|
|
| |
| |
|
---------------------------------------- |
|
|
|
| |
| |
|
---------------------------------------- | | |
|
|
|
|
| |
| |
|
---------------------------------------- ||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- | |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
----------------------------------------| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- | |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- || |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- | |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- | | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
|
---------------------------------------- |
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
| |
w
---------------------------------------- | |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
w w
---------------------------------------- |
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
---------------------------------------- | | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
| |
---------------------------------------- |
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
|
w w
---------------------------------------- | |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
w
---------------------------------------- | | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
|
----------------------------------------| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
w
---------------------------------------- | |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
|
----------------------------------------
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
|
w
---------------------------------------- |
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
| | |
w
---------------------------------------- | | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
||
w w w
---------------------------------------- |
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
|
ww
----------------------------------------
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
|
w
---------------------------------------- | |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
| |
w
----------------------------------------||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
|
w w
---------------------------------------- |
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
| |
w
----------------------------------------
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
| |
w w
---------------------------------------- || | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
|| |
w w
---------------------------------------- |
|| | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
|
ww w
---------------------------------------- | |
|
|| | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
|
w
----------------------------------------
| |
|
|| | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
|
w
---------------------------------------- |
| |
|
|| | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
|
w
---------------------------------------- | |
|
| |
|
|| | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
|
w
---------------------------------------- |
| |
|
| |
|
|| | |
|
||
| |
|
| | | |
|
| |
| |
| | | |
| |
|
| | | |
|
| |
|
| | | | |
| |
|
w
---------------------------------------- | |
|
| |
|
| |
|
|| | |
|
stderr
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found
sh: 1: cls: not found