Backtracking+8 queen problem

Embed Size (px)

Citation preview

  • 8/7/2019 Backtracking+8 queen problem

    1/36

    Fombtvombe`c

    ]xi ag ]xf}ht}

    o`d

    B`oz}omb

  • 8/7/2019 Backtracking+8 queen problem

    2/36

    Fombtvombe`c 6

    Fombtvombe`c

    Tsa whv}ea`} ag fombtvombe`c oncavetli}

    ]anxtea` `hhd} a`nu ta fh gho}efnh ,}ote}guzvafnhi} ma`}tvoe`t}%

    }xi ag }xf}ht}

    ]anxtea` `hhd} on}a ta fh azteion

    b`oz}omb

  • 8/7/2019 Backtracking+8 queen problem

    3/36

    Fombtvombe`c =

    Tlh fombtvombe`c ihtlad

    O cewh` zvafnhi lo} o }ht ag ma`}tvoe`t} o`dza}}efnu o` afkhmtewh gx`mtea`

    Tlh }anxtea` azteie{h} o` afkhmtewh gx`mtea`.o`d!av e} gho}efnh

    Sh mo` vhzvh}h`t tlh }anxtea` }zomh gav tlh

    zvafnhi x}e`c o }toth }zomh tvhh Tlh vaatag tlh tvhh vhzvh}h`t} : mlaemh}.

    @adh} ot dhztl ? vhzvh}h`t gev}t mlaemh

    @adh} ot dhztl 6 vhzvh}h`t tlh }hma`d mlaemh.

    htm E` tle} tvhh ozotl gvai o vaat ta o nhog

    vhzvh}h`t} o mo`dedoth }anxtea`

  • 8/7/2019 Backtracking+8 queen problem

    4/36

    Fombtvombe`c 4

    ]xi ag }xf}ht}

    Zvafnhi

    ; Cewh` ` za}etewh e`thchv} s?.... s`o`do za}etewh e`thchv ] Ge`d onn }xf}ht} ags?.... s

    tlot }xi ta ]

    H|oiznh;

    `9=. ]97. o`d s?96. s694. s=97

    ]anxtea`};

    r6.4y o`d r7y

  • 8/7/2019 Backtracking+8 queen problem

    5/36

    Fombtvombe`c 8

    ]xi ag }xf}ht}

    Sh senn o}}xih o fe`ovu }toth }zomh tvhh

    Tlh `adh} ot dhztl ? ovh gav e`mnxde`c ,uh}. `a%

    ethi ?. tlh `adh} ot dhztl 6 ovh gav ethi 6. htm

    Tlh nhgt fvo`mle`mnxdh}se. o`d tlh veclt fvo`ml

    h|mnxdh}se.

    Tlh `adh} ma`toe` tlh }xi ag tlh sheclt}e`mnxdhd }a gov

  • 8/7/2019 Backtracking+8 queen problem

    6/36

    Fombtvombe`c 7

    ]xi ag }xf}ht Zvafnhi;

    ]toth ]zomhTvhh gav = ethi}

    s? 9 6. s6 9 4. s= 9 7 o`d ]9 7

    e?

    e6

    e=

    uh} `a

    :

    :

    :

    :

    6

    6

    6

    7

    7?6 9M !!vaai gav `h|t ethi

    7 |ReY9? !!ethi e e} oddhd ta b`oz}omb

    3 sheclt9sheclt"sReY2 fax`d 9 fax`d "zReY

  • 8/7/2019 Backtracking+8 queen problem

    28/36

    Fombtvombe`c 6