Módulos st atic Mat rizMarcas marcasH; static Mat rizMarcas marcasV ; st atic baol Dentro( int x, int y ) { return (x >: O && x < ANCHO && Y >: O && Y < ALTO); )
j *-------- -- Elementos públicos ----------*j
voi d PonerEnBlanco() { for (int x=O; x<ANCHO; x++) { for ( int y:Q; y<ALTO; y++) ( t. marcasH[x] [y]: marcasV[x] [y] : ' t . ) )
)
void MarcarHorizontal( int x, int y ) { i f (Dentro( x, y » { marcasH(x)[y ] : ' _ '; )
)
void MarcarVertical( int x , int y ) { if (Dent ro( x, y » ( marcasV[x] [y] E ' 1t ; ) )
void Impri mir() { f or ( int y:ALTO- l ; y>=O; y-- ) { for (int x: O; x<ANCHO; x++) ( printf( " %<;%<;" , marcasV[x}{y] , marcasH[x][y]); )
printf( " \ n" ); ) )
j***************************************************** *********** .. Interfaz de módulo: Tortuga2
• • •
Este módulo define el tipo abs tracto TORTUGA, capaz de ir trazando una trayectoria mediante avances y giros
425