Programmi C / C++ - prof. Claudio Maccherani - Perugia - 2018
LABIRINTO
/* 'Labirinto - Dev-C++ - prof. Claudio Maccherani - Perugia - 2018/19 */ #include
#include
#include
#include
HANDLE hCon = GetStdHandle(STD_OUTPUT_HANDLE); // per impostare i colori using namespace std; void gotorc(short r, short c) { COORD pos = {c, r}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } int R1=1,C1=1,R,C,attesa=100,fine=0,T_ini=0,T_fin=0; float tempo; char tracciamento='n',Avatar='O'; string L[24],msg; void Inizializza() { // inizializza il "labirinto" G L[ 0] = " LABIRINTO: devi arrivare all'uscita 'U' (prof.Claudio Maccherani, Perugia) "; L[ 1] = " ##############################################################################"; L[ 2] = " # # # # #"; L[ 3] = " # # # # ########## ###################### # ###### ###### #"; L[ 4] = " # ####### # # # # #"; L[ 5] = " # # # ####### # # # ############## #"; L[ 6] = " ######## ##### ##################### # # # #"; L[ 7] = " I # # # ########## # ########### ######"; L[ 8] = " ########### ################## # # # # #"; L[ 9] = " U # # # # # #################### #"; L[10] = " ### #### ############## ### # # # # # #"; L[11] = " # # # # # # # # # # ########## # ######### #"; L[12] = " # #### # #### # # # ###### # # # # # #"; L[13] = " # # # # # # # # # # # # # ########## #"; L[14] = " # ## ####### # # # # # # # # #"; L[15] = " # # # #### # # ## # ############### ###### # #"; L[16] = " # # # # # # #"; L[17] = " # ############# # ####################### # # #"; L[18] = " ####### # #"; L[19] = " # ########### ####### # ################## ######## ######"; L[20] = " # # # #"; L[21] = " # ######################## # # # ################## #"; L[22] = " # # # # #"; L[23] = " ##############################################################################"; msg = "CIAO"; T_ini = time(0); } void Disegna_Labirinto() { // disegna il terreno di gioco for(int i=0;i<=23;i++) { gotorc(R1+i-1,C1-1); cout<