Results 1 to 12 of 12

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Feb:2011
    Location: Sofia
    Posts: 18

    C++

    ,
    .
    " W H 8x8 , "" , , 1 "

  2. #2
    Registered abUser ike's Avatar
    Join Date: Jul:2004
    Location: sofi
    Posts: 4,965
    .
    .
    Have no fear ike iz here.
    CPU Cx486DLC@40MHz, RAM 4MB, VGA Trident 512KB, HDD Conner 160MB, Monitor 14" Color

  3. #3
    Registered User
    Join Date: Feb:2011
    Location: Sofia
    Posts: 18

    Thumbs down

    Quote Originally Posted by ike View Post
    .
    .
    Code:
    #include <stdio.h>
    
    
    
    #define N     8
    
    #define N2    N*N
    
    #define IN(I) (((I)>=0) && ((I)<N))
    
    
    
    int T[N][N];        /* TABLE */
    
    int H[8];           /* HORZ DELTA */
    
    int V[8];           /* VERT DELTA */
    
    int R;
    
    
    
    void INIT();
    
    void OUTP();
    
    int  MOVE(int,int,int);
    
    
    
    int main()
    
    {
    
        INIT();
    
        MOVE(2,0,0);
    
        OUTP();
    
        return 0;
    
    }
    
    
    
    void INIT()
    
    {
    
        int I,J;
    
        T[0][0]=1;
    
        for(I=1;I<N;I++)
    
            for(J=1;J<N;J++)
    
                T[I][J]=0;
    
        H[0]= 1; V[0]= 2;
    
        H[1]= 2; V[1]= 1;
    
        H[2]= 2; V[2]=-1;
    
        H[3]= 1; V[3]=-2;
    
        H[4]=-1; V[4]=-2;
    
        H[5]=-2; V[5]=-1;
    
        H[6]=-2; V[6]= 1;
    
        H[7]=-1; V[7]= 2;
    
    }
    
    
    
    void OUTP()
    
    {
    
        int I,J;
    
        if(R)
    
            for(I=0;I<N;I++){
    
                for(J=0;J<N;J++)
    
                    printf("%.2d ",T[I][J]);
    
                printf("\n");}
    
        else
    
            printf("No solution\n");
    
    }
    
    
    
    int MOVE(int P,int X,int Y)
    
    {
    
        int I,J,K=0;
    
    M1: I=Y+V[K];
    
        J=X+H[K];
    
        R=0;K++;
    
        if(IN(I)&&IN(J))
    
            if(T[I][J]==0){
    
                T[I][J]=P;
    
                if(P<N2){
    
                    MOVE(P+1,J,I);
    
                    if(R==0)T[I][J]=0;}
    
                else R=1;}
    
        if(R||K>=8)
    
            return;
    
        goto M1;
    
    }
    ,

  4. #4
    user-friendly 0wn3r's Avatar
    Join Date: Mar:2006
    Location: Bulgaria,Plovdiv
    Posts: 1,165
    Quote Originally Posted by R1d3r View Post
    ,
    .
    " W H 8x8 , "" , , 1 "
    , :
    , :
    Code:
    moveX[8] = {1, 1, -1, ..., -2};
    moveY[8] = {2, -2, 2, ..., -1};
    1, ( , ) 8*8.

    , , - . , .

    .
    (1,1), , : 1 , , .

    , =++ .
    believing

  5. #5
    ɐ-əpoɔᴉu⋂ ɐ ə anrieff's Avatar
    Join Date: Apr:2004
    Location: Sofia
    Posts: 8,448
    , . .
    "640K ught to be enough for anybody" - Bill Gates, 1981
    ::Machine specs::Fract::AGG::::Baileys::blog::YouTube channel

  6. #6
    Registered User
    Join Date: Feb:2011
    Location: Sofia
    Posts: 18
    .... ... ...

    ---------- 17:24 ---------- 12:36 ----------

    15
    (beer)

  7. #7
    System.gc()'s Avatar
    Join Date: Apr:2007
    Location: back in time
    Posts: 1,075
    Quote Originally Posted by R1d3r View Post
    ... 15
    (beer)
    , ?
    UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
    geniusloci: ) ; ) ; ) ? nope|r.i.p.

  8. #8
    Exhumator's Avatar
    Join Date: Jan:2005
    Location: Sofia
    Posts: 14,687
    Quote Originally Posted by R1d3r View Post
    ...
    .

    , .
    | Aorus X570 Master | Ryzen 9 5900X | Hellhound 7900XT | G.SKILL 32GB DDR4 3800 CL16 | Enermax Galaxy 1000W | SSD Corsair MP510 960GB & WD-RE3 2 x 1TB RAID0 | Pioneer BDR-209EBK | Creative X-Fi Titanium Fatal1ty & GigaWorks S750 | ViewSonic VX3276-2K-MHD |

  9. #9
    Registered User
    Join Date: Feb:2011
    Location: Sofia
    Posts: 18
    .

  10. #10
    XaMaB's Avatar
    Join Date: Nov:2001
    Location:
    Posts: 20,387
    :
    : XaMaB; . 0.42

    In God we Trust (all others must submit a X.509 certificate). , ()

  11. #11
    Registered User
    Join Date: Feb:2011
    Location: Sofia
    Posts: 18
    Quote Originally Posted by XaMaB View Post
    :
    ... ...

  12. #12
    XaMaB's Avatar
    Join Date: Nov:2001
    Location:
    Posts: 20,387
    , anrieff , .

    : 2 ,
    : XaMaB; . 0.42

    In God we Trust (all others must submit a X.509 certificate). , ()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |