/** title: variante dum problema do CeNPL'01: "Apanha Moedas num Labirinto" (proposta extra-aula) ficheiro: cnpl03.c autor: PRH versao de: 2001.05.06 .uso de arrays multiplos para implementar matrizes, ou tabuleiros .resoluç~ao recursiva de problemas por "try-and-error" **/ #include #define true 1 #define false 0 typedef int bool; #define MAXL 9 #define MAXC 5 #define Moedas 7 #define InicL 5 #define InicC 4 /* #define InicC 3 */ typedef int tTabuleiro[MAXL][MAXC]; typedef int tProxMove[4]; tProxMove IncrL={-1,0,+1,0}; tProxMove IncrC={0,-1,0,+1}; tTabuleiro Tab={{0,0,0,0,-1}, {-1,0,0,0,0}, {0,0,0,-1,0}, {0,-1,0,0,0}, {0,0,0,0,0}, {0,-1,0,0,0}, {0,0,0,0,0}, {0,0,-1,0,0}, {0,0,0,0,-1} }; bool valido( int i, int j ){ return( (i>=0)&&(i=0)&&(j