|
|
 |
انجمن را در گوگل محبوب کنيد :
|
| تبليغات سايت |
|
|
۱۲-۲۵-۱۳۸۸, ۱۲:۰۶ بعد از ظهر
|
#6 (لینک دائم)
|
|
Administrator
تاريخ عضويت: خرداد ۱۳۸۷
محل سكونت: تهران-کرج!
پست ها: 3,465
تشكرها: 754
16,339 تشكر در 3,127 پست
My Mood:
|
برنامه معمای 8 (پازل 8)
كد:
#include
#include
#include
#include
#include
#define TRUE 1
#define FALSE 0
unsigned int a,b,c,d,e,f,g,h;
void main(void)
{
unsigned char chk_crash(unsigned char,unsigned char,unsigned char);
void draw_puzzle(void);
clrscr();
for (a=1;a<=8;a++);
for (b=1;b<=8;b++);
if (chk_crash(a,b,1))
for (c=1;c<=8;c++)
if ((chk_crash(c,b,1)) && (chk_crash(c,a,2)))
for (d=1;d<=8;d++)
if ((chk_crash(d,c,1)) && (chk_crash(d,b,2)) && (chk_crash(d,a,3)))
for(e=1;e<=8;e++)
if ((chk_crash(e,d,1)) && (chk_crash(e,c,2)) && (chk_crash(e,b,3)) && (chk_crash(e,a,4)))
for (f=1;f<=8;f++)
if ((chk_crash(f,e,1)) && (chk_crash(f,d,2)) && (chk_crash(f,c,3)) && (chk_crash(f,b,4)) && (chk_crash(f,a,5)))
for (g=1;g<=8;g++)
if ((chk_crash(g,f,1)) && (chk_crash(g,e,2)) && (chk_crash(g,d,3)) && (chk_crash(g,c,4)) && (chk_crash(g,b,5)) && (chk_crash(g,a,6)))
for (h=1;h<=8;h++)
if ((chk_crash(h,g,1)) && (chk_crash(h,f,2)) && (chk_crash(h,e,3)) && (chk_crash(h,d,4)) && (chk_crash(h,c,5)) && (chk_crash(h,b,6)) && (chk_crash(h,a,7)))
{
draw_puzzle();
getch();
}
getch();
}
unsigned char chk_crash(unsigned char i,unsigned char j,unsigned char d)
{
if ((i==j) || (abs(i-j)==d))
return(FALSE);
else
return(TRUE);
}
void draw_puzzle(void)
{
unsigned char a1,b1,a2,b2,i,v;
clrscr();
for (a1=1;a1<=16;a1++)
for (b1=18;b<=65;b1++)
{
gotoxy(b1,a1+d);
a2=(a1-1)/2+1;
b2=(b1-18)/6+1;
if (((a2+b2)%2)==0)
textcolor(11);
else
textcolor(1);
cprintf("A\0");
for (i=0;i<8;i++)
{
switch(i)
{
case 0:{v=a;break;}
case 1:{v=b;break;}
case 2:{v=c;break;}
case 3:{v=d;break;}
case 4:{v=e;break;}
case 5:{v=f;break;}
case 6:{v=g;break;}
case 7:{v=h;break;}
}
gotoxy(15+6*v,5+i*2);
cprintf("*\0");
}
}
}
|
|
|
|
از Astaraki تشكر كرده اند:
|
astronomer (۰۷-۱۷-۱۳۹۲), ayfer.a11 (۰۸-۴-۱۳۹۰), delsa s (۰۸-۲-۱۳۹۲), elit (۰۷-۲۳-۱۳۹۱), Goback (۰۵-۲۱-۱۳۸۹), khokho (۰۱-۲۱-۱۳۹۰), norozi_a_2007 (۰۳-۱۷-۱۳۹۱), pincode (۰۸-۴-۱۳۹۲), rouhallah (۱۲-۲۹-۱۳۸۸), Sahebi (۰۱-۱۱-۱۳۸۹), samane_89 (۱۲-۲۸-۱۳۸۹), وجیهه نصر (۰۸-۷-۱۳۹۲), voice (۰۸-۴-۱۳۹۲), zari11368 (۱۲-۱۷-۱۳۹۰) |
|
كاربران در حال ديدن تاپيک: 1 (0 عضو و 1 مهمان)
|
|
|
قوانين ارسال
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
كدهاي HTML غير فعال است
|
|
|
زمان محلي شما با تنظيم GMT +3.5 هم اکنون ۰۴:۲۴ قبل از ظهر ميباشد.
|
Inactive Reminders By Icora Web Design
|