Exemplo n.º 1
0
Arquivo: main.c Projeto: Kai7/CProgram
int main(void)
{
	printf ("\n\nPlease input your name: ");
	scanf  ("%s", &name );
	printf ("\nPlease enter the degree angle (ex> 90): " );
	scanf  ("%f", &angle );
	haha( name );
	sin_value( angle );
	cos_value( angle );
}
Exemplo n.º 2
0
Arquivo: main.cpp Projeto: Vonng/study
int main()
{
	printf("hello,world ,I'm  in main function'");
	haha();
	xixi();

	hali();
	printf("\n");
	
	return 0;
}
Exemplo n.º 3
0
int main()
{
    // Lua 를 초기화 한다.
    lua_State* L = lua_open();

    // Lua 기본 함수들을 로드한다.- print() 사용
    luaopen_base(L);

    // Lua 테이블을 생성하고 스택에 푸쉬한다.
    lua_tinker::table haha(L, "haha");

    // haha.value = 1 값을 넣는다.
    haha.set("value", 1);

    // table 내에 table을 만들어 넣는다.
    haha.set("inside", lua_tinker::table(L));

    // haha.inside 의 포인터를 스택위로 복사한다.
    lua_tinker::table inside = haha.get<lua_tinker::table>("inside");

    // inside.value = 2 값을 넣는다.
    inside.set("value", 2);

    // sample4.lua 파일을 로드/실행한다.
    lua_tinker::dofile(L, "sample4.lua");

    // Lua 에서 생성한 haha.test 값을 읽는다.
    const char* test = haha.get<const char*>("test");
    printf("haha.test = %s\n", test);

    // 전역에 등록하지 않고 Lua 스택에 빈 테이블을 생성한다.(지역변수)
    lua_tinker::table temp(L);

    // 빈 테이블.name 에 값을 넣는다.
    temp.set("name", "local table !!");

    // table을 의 인자로 사용하여 print_table 을 호출한다.
    lua_tinker::call<void>(L, "print_table", temp);

    // 함수가 리턴하는 table을 받는다.
    lua_tinker::table ret = lua_tinker::call<lua_tinker::table>(L, "return_table", "give me a table !!");
    printf("ret.name =\t%s\n", ret.get<const char*>("name"));

    // 프로그램 종료
    lua_close(L);

    return 0;
}
Exemplo n.º 4
0
int main( int argc,char *argv[] )
{
	hulua::lua_context L;

//	lua_State* L = lua_open();

	luaopen_base(L);

	hulua::table haha(L, "haha");

	haha.set("value", 1);

	haha.set("inside", hulua::table(L));

	hulua::table inside = haha.get<hulua::table>("inside");

	inside.set("value", 2);

	hulua::dofile(L, "sample4.lua");

	const char* test = haha.get<const char*>("test");
	printf("haha.test = %s\n", test);

	hulua::table temp(L);

	temp.set("name", "local table !!");

	hulua::call<void>(L, "print_table", temp);

	hulua::table ret = hulua::call<hulua::table>(L, "return_table", "give me a table !!");
	printf("ret.name =\t%s\n", ret.get<const char*>("name"));

//	lua_close(L);

	return 0;
}
Exemplo n.º 5
0
int five_pk(int fd,int first)
{
    int cx, ch, cy,datac,fdone,x /* ,y */;
    char genbuf[100],data[90],xy_po[5],genbuf1[20] /* ,x1[1],y1[1],done[1] */;
    /*    struct user_info *opponent; */
    /*     char fname[50]; */
    int i,j /* ,k */,fway,banf,idone;


    /*
     *      Ôö¼ÓÁÄÌ칦ÄÜ. Added by satan. 99.04.02
     */

#define START    17
#define END      21
#define PROMPT   23
#undef MAX
#define MAX      (END - START)
#define BSIZE    60


    char chatbuf[80], *cbuf;
    int ptr = 0, chating = 0 /*, over = 0 */;

    setutmpmode(FIVE);       /*Óû§×´Ì¬ÉèÖÃ*/
    clear ();
    InitScreen();
    five_chat (NULL, 1);

    cbuf = chatbuf + 19;
    chatbuf[0] = '\0';
    chatbuf[79] = '\0';
    cbuf[0] = '\0';
    sprintf (chatbuf + 1, "%-16s: ", cuser.username);

    add_io(fd, 0);

begin:
    for(i=0; i<=14; i++)
        for(j=0; j<=14; j++)
            playboard[i][j]=0;


    hand=1;
    winner=0;
    quitf=0;
    px=14;
    py=7;
    fway = 1;
    banf = 1;
    idone = 0;


    sprintf(genbuf, "%s (%s)", cuser.userid, cuser.username);

    if(first)
    {
        move(1,33);
        prints("ºÚ¡ñÏÈÊÖ %s  ",genbuf);
        move(2,33);
        prints("°×¡ðºóÊÖ %s  ",save_page_requestor);
    }
    else
    {
        move(1,33);
        prints("°×¡ðºóÊÖ %s  ",genbuf);
        move(2,33);
        prints("ºÚ¡ñÏÈÊÖ %s  ",save_page_requestor);
    }


    move(15,35);
    if(first)
        outs("¡ïµÈ´ý¶Ô·½ÏÂ×Ó¡ï");
    else
        outs("¡ôÏÖÔÚ¸Ã×Ô¼ºÏ¡ô");
    move(7,14);
    outs("¡ñ");
    player=white;
    playboard[7][7]=black;
    chess[1][0]=14; /*¼Í¼ËùÏÂλַ*/
    chess[1][1]=7;
    move(4,35);
    outs("µÚ 1ÊÖ ¡ñH 8");

    if(!first)
    {   /*³¬¹Ö!*/
        move (7, 14);
        fdone=1;
    }
    else
        fdone=0;    /*¶ÔÊÖÍê³É*/

    while (1)
    {
        ch=igetkey();

        if (ch == I_OTHERDATA)
        {
            datac = recv(fd, data, sizeof(data), 0);
            if (datac <= 0)
            {
                move(17,30);
                outs(" ¶Ô·½Í¶½µÁË...@_@ ");
                break;
            }
            if (data[0] == '\0')
            {
                five_chat (data + 1, 0);
                if (chating)
                    move (PROMPT, ptr + 6);
                else
                    move (py, px);
                continue;
            }
            else if (data[0] == '\1')
            {
                bell ();
                RMSG = YEA;
                saveline (PROMPT, 0);
                sprintf (genbuf, "%s ˵: ÖØÀ´Ò»Å̺ÃÂð? (Y/N)[Y]:", save_page_requestor);
                getdata (PROMPT, 0, genbuf, genbuf1, 2, LCECHO, YEA);
                RMSG = NA;
                if (genbuf1[0] == 'n' || genbuf1[0] == 'N')
                {
                    saveline (PROMPT, 1);
                    send (fd, "\3", 1, 0);
                    continue;
                }
                else
                {
                    saveline (PROMPT, 1);
                    InitScreen ();
                    first = 0;
                    send (fd, "\2", 1, 0);
                    goto begin;
                }
            }
            else if (data[0] == '\2')
            {
                bell ();
                saveline (PROMPT, 0);
                move (PROMPT, 0);
                clrtoeol ();
                prints ("%s ½ÓÊÜÁËÄãµÄÇëÇó :-)", save_page_requestor);
                refresh ();
                sleep (1);
                saveline (PROMPT, 1);
                InitScreen ();
                first = 1;
                goto begin;
            }
            else if (data[0] == '\3')
            {
                bell ();
                saveline (PROMPT, 0);
                move (PROMPT, 0);
                clrtoeol ();
                prints ("%s ¾Ü¾øÁËÄãµÄÇëÇó :-(", save_page_requestor);
                refresh ();
                sleep (1);
                saveline (PROMPT, 1);
                if (chating)
                    move (PROMPT, ptr + 6);
                else
                    move (py, px);
                continue;
            }
            else if (data[0] == '\xff')
            {
                move (PROMPT, 0);
                quit ();
                break;
            }
            i=atoi(data);
            cx=i/1000;   /*½âÒëdata³ÉÆåÅÌ×ÊÁÏ*/
            cy=(i%1000)/10;
            fdone=i%10;
            hand+=1;

            if(hand%2==0)
                move(((hand-1)%20)/2+4,48);
            else
                move(((hand-1)%19)/2+4,35);

            prints("µÚ%2dÊÖ %s%c%2d",hand,
                   (player==black)?"¡ñ":"¡ð",abcd[cx/2],15-cy);


            move(cy,cx);
            x=cx/2;
            playboard[x][cy]=player;
            if(player==black)
            {
                outs("¡ñ");
                player=white;
            }
            else
            {
                outs("¡ð");
                player=black;
            }
            move (cy, cx);
            refresh ();
            bell ();
            move(15,35);
            outs("¡ôÏÖÔÚ¸Ã×Ô¼ºÏ¡ô");
            haha (5);

            tdeadf=tlivef=livethree=threefour=0;
            for(j=0; j<=10; j++)
                calvalue(cx/2,j,cx/2,j+1,cx/2,j+2,cx/2,j+3,cx/2,j+4);
            for(i=0; i<=10; i++) /*ºáÏò*/
                calvalue(i,cy,i+1,cy,i+2,cy,i+3,cy,i+4,cy);
            for(i=-4; i<=0; i++) /*бÓÒÏÂ*/
                calvalue(cx/2+i,cy+i,cx/2+i+1,cy+i+1,cx/2+i+2,cy+i+2,
                         cx/2+i+3,cy+i+3,cx/2+i+4,cy+i+4);
            for(i=-4; i<=0; i++) /*б×óÏÂ*/
                calvalue(cx/2-i,cy+i,cx/2-i-1,cy+i+1,cx/2-i-2,cy+i+2,cx/2-i-3,
                         cy+i+3,cx/2-i-4,cy+i+4);

            for(j=0; j<=9; j++)
                callfour(cx/2,j,cx/2,j+1,cx/2,j+2,cx/2,j+3,cx/2,j+4,cx/2,j+5);
            for(i=0; i<=9; i++) /*ËĺáÏò*/
                callfour(i,cy,i+1,cy,i+2,cy,i+3,cy,i+4,cy,i+5,cy);
            for(i=-5; i<=0; i++)
            {   /*ËÄбÓÒÏÂ*/
                callfour(cx/2+i,cy+i,cx/2+i+1,cy+i+1,cx/2+i+2,cy+i+2,
                         cx/2+i+3,cy+i+3,cx/2+i+4,cy+i+4,cx/2+i+5,cy+i+5);
                /*ËÄб×óÏÂ*/
                callfour(cx/2-i,cy+i,cx/2-i-1,cy+i+1,cx/2-i-2,cy+i+2,cx/2-i-3,
                         cy+i+3,cx/2-i-4,cy+i+4,cx/2-i-5,cy+i+5);
            }

            py = cy;
            px = cx;
            if(tlivef>=2 && winner==0)
                bandhand(4);
            if(livethree>=2 && tlivef ==0)
                bandhand(3);
            if(threefour==black)
                haha(1);
            else if(threefour==white)
                haha(1);
            if (chating)
            {
                sleep (1);
                move (PROMPT, ptr + 6);
            }
            else
                move (py, px);
            if (winner)
            {
                InitScreen ();
                goto begin;
            }
        }
        else
        {
            if (ch == Ctrl('X'))
            {
                quitf = 1;
            }
            else if (ch==Ctrl('C') || ((ch=='Q' || ch=='q') && !chating))
            {
                RMSG = YEA;
                saveline (PROMPT, 0);
                getdata(PROMPT, 0, "ÄúÈ·¶¨ÒªÀ뿪Âð? (Y/N)?[N] ", genbuf1, 2, LCECHO, YEA);
                if (genbuf1[0] == 'Y' || genbuf1[0] == 'y')
                    quitf = 1;
                else
                    quitf = 0;
                saveline (PROMPT, 1);
                RMSG = NA;
            }
            else if (ch==Ctrl('N') || ((ch=='N' || ch=='n') && !chating))
            {
                saveline (PROMPT, 0);
                RMSG = YEA;
                getdata(PROMPT,0,"ÄúÈ·¶¨ÒªÖØпªÊ¼Âð? (Y/N)?[N] ",genbuf1,2,LCECHO, YEA);
                if (genbuf1[0] == 'Y' || genbuf1[0] == 'y')
                {
                    send (fd, "\1", 1, 0);
                    move (PROMPT, 0);
                    bell ();
                    clrtoeol ();
                    move (PROMPT, 0);
                    outs ("ÒѾ­ÒѾ­ÌæÄú·¢³öÇëÇóÁË");
                    refresh ();
                    sleep (1);
                }
                RMSG = NA;
                saveline (PROMPT, 1);
                if (chating)
                    move (PROMPT, ptr + 6);
                else
                    move (py, px);
                continue;
            }
            else if (ch == '\t')
            {
                if (chating)
                {
                    chating = 0;
                    move (py, px);
                }
                else
                {
                    chating = 1;
                    move (PROMPT, 6 + ptr);
                }
                continue;
            }
            else if (ch == '\0')
                continue;
            else if (chating)
            {
                if (ch == '\n' || ch == '\r')
                {
                    if (!cbuf[0])
                        continue;
                    ptr = 0;
                    five_chat (chatbuf + 1, 0);
                    send (fd, chatbuf, strlen (chatbuf + 1) + 2, 0);
                    cbuf[0] = '\0';
                    move (PROMPT, 6);
                    clrtoeol ();
                }
                else if (ch == KEY_LEFT)
                {
                    if (ptr)
                        ptr --;
                }
                else if (ch == KEY_RIGHT)
                {
                    if (cbuf[ptr])
                        ptr ++;
                }
                else if (ch == Ctrl ('H') || ch == '\177')
                {
                    if (ptr)
                    {
                        ptr --;
                        memcpy (&cbuf[ptr], &cbuf[ptr+1], BSIZE-ptr);
                        move (PROMPT, ptr+6);
                        clrtoeol ();
                        prints ("%s",&cbuf[ptr]);
                    }
                }
                else if (ch == KEY_DEL)
                {
                    if (cbuf[ptr])
                    {
                        memcpy (&cbuf[ptr], &cbuf[ptr+1], BSIZE-ptr);
                        clrtoeol ();
                        prints ("%s",&cbuf[ptr]);
                    }
                }
                else if (ch == Ctrl ('A'))
                {
                    ptr = 0;
                }
                else if (ch == Ctrl ('E'))
                {
                    while (cbuf[++ptr])
                        ;
                }
                else if (ch == Ctrl ('K'))
                {
                    ptr = 0;
                    cbuf[ptr] = '\0';
                    move (PROMPT, ptr+6);
                    clrtoeol ();
                }
                else if (ch == Ctrl ('U'))
                {
                    memmove (cbuf, &cbuf[ptr], BSIZE - ptr + 1);
                    ptr = 0;
                    move (PROMPT, ptr+6);
                    clrtoeol ();
                    prints ("%s",cbuf);
                }
                else if (ch == Ctrl ('W'))
                {
                    if (ptr)
                    {
                        int optr;

                        optr = ptr;
                        ptr --;
                        do
                        {
                            if (cbuf[ptr] != ' ')
                                break;
                        }
                        while (-- ptr);
                        do
                        {
                            if (cbuf[ptr] == ' ')
                            {
                                if (cbuf[ptr+1] != ' ')
                                    ptr ++;
                                break;
                            }
                        }
                        while (-- ptr);
                        memcpy (&cbuf[ptr], &cbuf[optr], BSIZE-optr+1);
                        move (PROMPT, ptr+6);
                        clrtoeol ();
                        prints ("%s",&cbuf[ptr]);
                    }
                }
                else if (isprint2 (ch))
                {
                    if (ptr == BSIZE)
                        continue;
                    if (!cbuf[ptr])
                    {
                        cbuf[ptr] = ch;
                        move (PROMPT, 6 + ptr);
                        outc (ch);
                        cbuf[++ptr] = 0;
                    }
                    else
                    {
                        memmove (&cbuf[ptr+1], &cbuf[ptr], BSIZE-ptr+1);
                        cbuf[ptr] = ch;
                        move (PROMPT, 6 + ptr);
                        prints ("%s",&cbuf[ptr]);
                        ptr ++;
                    }
                }
                move (PROMPT, 6 + ptr);
                continue;
            }
        }

        if(fdone==1 && !chating && ch != I_OTHERDATA)/*»»ÎÒ*/
        {

            move(py,px);
            switch (ch)
            {

            case KEY_DOWN:
            case 'j':
            case 'J':
                py=py+1;
                if(py>14)
                    py=0;
                break;

            case KEY_UP:
            case 'k':
            case 'K':
                py=py-1;
                if(py<0)
                    py=14;
                break;

            case KEY_LEFT:
            case 'h':
            case 'H':
                px=px-1;
                if(px<0)
                    px=28;
                break;

            case KEY_RIGHT:
            case 'l':
            case 'L':
                px=px+1;
                if(px>28)
                {
                    px=0;
                    px=px-1;
                }                      /*»áÌø¸ñßÖ*/
                break;
            case ' ':
                if(banf==1)
                    break;

                if((px%2)==1)
                    px=px-1; /*½â¾önetterm²»ºÏÎÊÌâ*/
                move(py,px);
                hand+=1;
                playboard[x][py]=player;
                if(player==black)
                {
                    outs("¡ñ");
                    player=white;
                }
                else
                {
                    outs("¡ð");
                    player=black;
                }
                chess[hand][0]=px;
                chess[hand][1]=py;
                if(hand%2==0)
                    move(((hand-1)%20)/2+4,48);
                else
                    move(((hand-1)%19)/2+4,35);

                prints("µÚ%2dÊÖ %s%c%2d",hand,
                       (hand%2==1)?"¡ñ":"¡ð",abcd[px/2],15-py);
                idone=1;
                move (py, px);
                refresh ();
                break;
            default:
                break;
            }
            move(py,px);
            x=px/2;
            if(playboard[x][py]!=0)
                banf=1;
            else
                banf=0;

            if(idone==1)
            {
                xy_po[0] = px/10 + '0';
                xy_po[1] = px%10 + '0';
                xy_po[2] = py/10 + '0';
                xy_po[3] = py%10 + '0';
                fdone=0;
                xy_po[4]='1';
                if(send(fd,xy_po,sizeof(xy_po),0)==-1)
                    break;

                move(15,35);
                outs("¡ïµÈ´ý¶Ô·½ÏÂ×Ó¡ï");
                haha (5);

                tdeadf=tlivef=livethree=threefour=0;
                for(j=0; j<=10; j++)
                    calvalue(px/2,j,px/2,j+1,px/2,j+2,px/2,j+3,px/2,j+4);
                for(i=0; i<=10; i++) /*ºáÏò*/
                    calvalue(i,py,i+1,py,i+2,py,i+3,py,i+4,py);
                for(i=-4; i<=0; i++) /*бÓÒÏÂ*/
                    calvalue(px/2+i,py+i,px/2+i+1,py+i+1,px/2+i+2,py+i+2,
                             px/2+i+3,py+i+3,px/2+i+4,py+i+4);
                for(i=-4; i<=0; i++) /*б×óÏÂ*/
                    calvalue(px/2-i,py+i,px/2-i-1,py+i+1,px/2-i-2,py+i+2,px/2-i-3,
                             py+i+3,px/2-i-4,py+i+4);

                for(j=0; j<=9; j++)
                    callfour(px/2,j,px/2,j+1,px/2,j+2,px/2,j+3,px/2,j+4,px/2,j+5);
                for(i=0; i<=9; i++) /*ËĺáÏò*/
                    callfour(i,py,i+1,py,i+2,py,i+3,py,i+4,py,i+5,py);
                for(i=-5; i<=0; i++)
                {   /*ËÄбÓÒÏÂ*/
                    callfour(px/2+i,py+i,px/2+i+1,py+i+1,px/2+i+2,py+i+2,
                             px/2+i+3,py+i+3,px/2+i+4,py+i+4,px/2+i+5,py+i+5);
                    /*ËÄб×óÏÂ*/
                    callfour(px/2-i,py+i,px/2-i-1,py+i+1,px/2-i-2,py+i+2,px/2-i-3,
                             py+i+3,px/2-i-4,py+i+4,px/2-i-5,py+i+5);
                }

                if(tlivef>=2 && winner==0)
                    bandhand(4);
                if(livethree>=2 && tlivef ==0)
                    bandhand(3);
                if(threefour==black)
                    haha(1);
                else if(threefour==white)
                    haha(1);

            }
            idone=0;
        }
        if (quitf)
        {
            genbuf1[0] = '\xff';
            send (fd, genbuf1, 1, 0);
            press ();
            break;
        }
        if (winner)
        {
            InitScreen ();
            goto begin;
        }
    }

    add_io(0, 0);
    close(fd);
    return;
}
Exemplo n.º 6
0
int callfour(int x1,int y1,int x2,int y2,int x3,int y3,
             int x4,int y4,int x5,int y5,int x6,int y6)
{
    int n_black,n_white,dead /* ,i,j,k */;

    n_black=n_white=dead=0;

    if(x1<0||x2<0||x3<0||x4<0||x5<0||x6<0||
            x1>14||x2>14||x3>14||x4>14||x5>14||x6>14)
        return;

    if(winner!=0)
        return;

    if((playboard[x1][y1]!=0 && playboard[x6][y6]==0)||
            (playboard[x1][y1]==0 && playboard[x6][y6]!=0))
        dead=1;      /* for checking  ³åËÄ */

    if(playboard[x2][y2]==black)
        n_black+=1;
    if(playboard[x2][y2]==white)
        n_white+=1;
    if(playboard[x3][y3]==black)
        n_black+=1;
    if(playboard[x3][y3]==white)
        n_white+=1;
    if(playboard[x4][y4]==black)
        n_black+=1;
    if(playboard[x4][y4]==white)
        n_white+=1;
    if(playboard[x5][y5]==black)
        n_black+=1;
    if(playboard[x5][y5]==white)
        n_white+=1;

    if(playboard[x1][y1]==0 && playboard[x6][y6]==0 &&
            (playboard[x3][y3]==0 || playboard[x4][y4]==0))
    {
        if(n_black==3 || n_white==3)
            haha(0);
        if(n_black==3)
            livethree+=1;
    }


    if(n_black==4)
    {
        if(playboard[x1][y1]== black && playboard[x6][y6]== black)
            bandhand(6);
        if(playboard[x1][y1]!=0 && playboard[x6][y6]!=0)
            return;

        if(dead)
        {
            /* add by satan Mar 19, 1999 start*/
            if (playboard[x1][y1]==0 && playboard[x5][y5]==0 ||
                    playboard[x2][y2]==0 && playboard[x6][y6]==0)
                livethree -= 1;
            /* add by satan Mar 19, 1999 end*/

            haha(2);
            tdeadf+=1;
            tlivef+=1;      /*ºÚËÀËÄÀ²*/
            threefour=0;
            return;
        }

        threefour=black;
        tlivef+=1;         /*»îËÄÒ²ËãË«ËÄ*/
    }
    if(n_white==4)
    {
        if(playboard[x1][y1]!=0 && playboard[x6][y6]!=0)
            return;
        if(dead)
        {
            haha(2);
            tdeadf+=1;
            threefour=0;
            return;
        }

        threefour=white;
        tlivef+=1;

    }
    if(playboard[x1][y1]==black)
        n_black+=1;     /*check Á¬×Ó*/
    if(playboard[x6][y6]==black)
        n_black+=1;

    if(n_black==5 && (playboard[x3][y3]==0 || playboard[x4][y4]==0 ||
                      playboard[x5][y5]==0 || playboard[x2][y2]==0))
        tlivef-=1;     /* ÁùȱһÐÍ, ²»Ëã³åËÄ */

    if( n_black >= 6 )
        bandhand(6);
    return;
}
Exemplo n.º 7
0
int calvalue(int x1,int y1,
             int x2,int y2,
             int x3,int y3,
             int x4,int y4,
             int x5,int y5)
{
    int n_black,n_white,empty,i,j /* ,k */;

    n_black=n_white=empty=0;

    if(x1<0||x2<0||x3<0||x4<0||x5<0||
            x1>14||x2>14||x3>14||x4>14||x5>14)
        return;
    if(winner!=0)
        return;
    if(playboard[x2][y2]==0 || playboard[x3][y3]==0
            || playboard[x4][y4]==0)
        empty=1; /*check 10111ÐÍËÀËÄ*/

    if(playboard[x1][y1]==black)
        n_black+=1;
    if(playboard[x1][y1]==white)
        n_white+=1;
    if(playboard[x2][y2]==black)
        n_black+=1;
    if(playboard[x2][y2]==white)
        n_white+=1;
    if(playboard[x3][y3]==black)
        n_black+=1;
    if(playboard[x3][y3]==white)
        n_white+=1;
    if(playboard[x4][y4]==black)
        n_black+=1;
    if(playboard[x4][y4]==white)
        n_white+=1;
    if(playboard[x5][y5]==black)
        n_black+=1;
    if(playboard[x5][y5]==white)
        n_white+=1;

    if(playboard[x1][y1]==0 && playboard[x5][y5]==0)
    {
        if(n_white==3 || n_black==3)
            haha(0);

        if(n_black==3)
            livethree+=1;
    }

    if((n_white==4 || n_black==4) && (empty ==1))
    {
        tdeadf+=1;
        tlivef+=1;
        haha(2);
        return;
    }

    if(n_black==5)
    {   /*ÔÙɨÁ¬Áù*/
        tlivef=-1;
        tdeadf=0;
        livethree=0;
        for(i=0; i<=14; i++ )  /*ËÄ×ÝÏò*/
            for(j=0; j<=9; j++)
                callfour(i,j,i,j+1,i,j+2,i,j+3,i,j+4,i,j+5);
        for(i=0; i<=9; i++)    /*ËĺáÏò*/
            for(j=0; j<=14; j++)
                callfour(i,j,i+1,j,i+2,j,i+3,j,i+4,j,i+5,j);
        for(i=0; i<=9; i++)    /*ËÄбÓÒÏÂ*/
            for(j=0; j<=9; j++)
            {
                callfour(i,j,i+1,j+1,i+2,j+2,i+3,j+3,i+4,j+4,i+5,j+5);
                /*ËÄб×óÏÂ*/
                callfour(i,j+5,i+1,j+4,i+2,j+3,i+3,j+2,i+4,j+1,i+5,j);
            }
        if(winner==0)
            win( black );
    }
    if(n_white==5)
        win( white );
    return;
}
Exemplo n.º 8
0
int main(int argc, char* argv[])
{
	haha(0, 5, 8.0, "haha");
	getchar();
	return 0;
}