??? - PowerPoint PPT Presentation

About This Presentation
Title:

???

Description:

Title: -Queues problem Last modified by: antonis Created Date: 11/4/2002 9:23:13 PM Document presentation format – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 7
Provided by: accy150
Category:
Tags: queues

less

Transcript and Presenter's Notes

Title: ???


1
???ß??µata ??a??t?s??
2
? ?as???sse? st? S???? ?-Queens Problem
  • ?8. ??? t?p??et??µe 8 ßas???sse? se µ?a s?a????a
    ????? ??p??a ßas???ssa ?a ape??e? µ?a ????
  • ??apa?ast??µe t?? ??se?? t?? ßas???ss?? µe µ?a
    ??sta t?? y-s??teta?µ???? t???
  • Y1, Y2, Y3, ..., Y8
  • solution (X) -
  • permutation (1, 2, 3, 4, 5, 6, 7,
    8, X), safe (X).
  • ?a??de??µa "generate and test"

3
? ?as???sse? (s????e?a)
  • safe ()
  • safe (Queen Others) -
  • safe (Others),
  • noattack (Queen, Others,1).
  • noattack (Queen, , XPosition).
  • noattack (Y, Y1 Rest, Xdist) -
  • Y1 Y ? Xdist,
  • Y Y1 ? Xdist,
  • Dist Xdist 1,
  • noattack (Y, Rest, Dist).
  • permutation (, ).
  • permutation (X L, P) - permutation (L, L1),
    insert (X, L1, P).

4
? ?as???sse? (s????e?a)
  • ??apa??stas? t?? ??s?? µ?a? ßas???ssa?
  • pos (X, Y) s??teta?µ??e?
  • ?p??t?s?/??s? ?a e??a? µ?a ??sta
  • pos (X1, Y1), pos (X2, Y2), , pos (X8, Y8)
  • pos (1, Y1), pos (2, Y2), , pos (8, Y8)
  • correct ().
  • correct (pos ( X, Y) Rest) -
  • correct (Rest),
  • member (Y, 1, 2, 3, 4, 5, 6, 7, 8), Choise
  • noattack (pos (X, Y), Rest).

5
? ?as???sse? (s????e?a)
  • noattack (QueenPosition, ListQueensPositions)
  • noattack (Queen, ).
  • noattack (pos (X, Y), post (X1, Y1) Rest) -
  • X ? X1,
  • Y ? Y1,
  • Y1 Y ? X1 X,
  • Y Y1 ? X X1,
  • noattack (pos (X, Y), Rest).
  • solution (X) - template (X), correct (X).
  • template (pos (1, Y1), pos (2, Y2), , pos (8,
    Y8)).
  • ? solution (X)

6
?????? t?? ?a??? (Towers of Hanoi)
  • ???e ????s? µ??? ??a d?s??. Se ?aµµía ?at?stas?
    de? µp????µe ?a ????µe d?s?? p??? ap? µ????te??
    d?s??.
  • hanoi (s (o), A, B, C, move (A, B)).
  • hanoi (s (N), A, B, C, Moves) -
  • hanoi (N, A, C, B, Moves1),
  • hanoi (N, B, A, C, Moves2),
  • append (Moves1, move (A, C) Moves2, Moves).
  • H µetaß??t? Moves ??at? t? ??s? se µ?a d?µ?
    ded?µ???? p?? ap?f?s?se ? ???st??.

A
B
C
Write a Comment
User Comments (0)
About PowerShow.com