/* yilan-oyunu v1.0 Klasik yilan oyunu (Turbo C ile derlenip DOS altında calistirilmali). Copyright (C) 2005 Engin KUZU This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ //http://www.gnu.org/copyleft/gpl.html //Turkce cevirisi: http://www.belgeler.org/howto/gpl_copy.html //Web: http://www.enginkuzu.org #include #include #include char dizi[4000][2]; char yem[2]; char son[2]; int max; int yon; int sayac; int i; char c,hata; void ilk_degerleri_ata() { dizi[0][0]=9; dizi[0][1]=12; dizi[1][0]=8; dizi[1][1]=12; dizi[2][0]=7; dizi[2][1]=12; dizi[3][0]=6; dizi[3][1]=12; dizi[4][0]=5; dizi[4][1]=12; dizi[5][0]=4; dizi[5][1]=12; dizi[6][0]=3; dizi[6][1]=12; yem[0]=22; yem[1]=22; max=6; yon=80; randomize(); _setcursortype(_NOCURSOR); } void karsilama_ekrani() { clrscr(); gotoxy(22,10); printf("Oyunda yon tuslari ile ilerlenir"); gotoxy(20,12); printf("ESC ==> Cikis P ==> Oyunu duraklat"); gotoxy(28,16); printf("Yilan Oyunu v1.0"); gotoxy(26,35); printf("ENTER ile devam edin..."); getch(); } void cerceveyi_ciz() { clrscr(); gotoxy(1,1); printf("%c",201); gotoxy(80,1); printf("%c",187); gotoxy(1,49); printf("%c",200); gotoxy(80,49); printf("%c",188); for(i=2;i<80;i++) { gotoxy(i,1); printf("%c",205); gotoxy(i,49); printf("%c",205); } for(i=2;i<49;i++) { gotoxy(1,i); printf("%c",186); gotoxy(80,i); printf("%c",186); } } void yilan_ve_yemi_ciz() { for(i=0;i0;i--) { dizi[i][0]=dizi[i-1][0]; dizi[i][1]=dizi[i-1][1]; } } void yilanin_ilk_bogumunu_ilerletme_islemleri() { if( yon==77 ) dizi[0][0]++; else if( yon==75 ) dizi[0][0]--; else if( yon==72 ) dizi[0][1]--; else dizi[0][1]++; } void yilan_duvara_carpma_kontrol() { if( dizi[0][0]<2 || dizi[0][0]>79 ) { gotoxy(22,22); printf("Duvara carptin! Oyun sona erdi."); getch(); exit(0); } else if( dizi[0][1]<2 || dizi[0][1]>48 ) { gotoxy(22,22); printf("Duvara carptin! Oyun sona erdi."); getch(); exit(0); } } void yilan_kendine_carpma_kontrol() { for(i=max;i>0;i--) { if( dizi[i][0]==dizi[0][0] && dizi[i][1]==dizi[0][1] ) { gotoxy(22,22); printf("Yilan kendisine carpti! Oyun sona erdi."); getch(); exit(0); } } } void yilanin_en_arka_bogumunu_ekrandan_sil() { gotoxy(son[0],son[1]); printf(" "); } void yilan_yemi_alma_kontrol() { if( yem[0]==dizi[0][0] && yem[1]==dizi[0][1] ) { hata=1; max++; dizi[max][0]=son[0]; dizi[max][1]=son[1]; while(hata) { hata=0; yem[0]=rand()%78+2; yem[1]=rand()%47+2; for(i=0;i