亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ssched.pro

?? prolog開發(fā)工具
?? PRO
字號(hào):
/* Amzi! Sports Scheduling Demo

   Amzi! inc.
   40 Samuel Prescott Dr.
   Stow, MA 01775
   USA

   tel. 508/897-7332
   fax. 508/897-2784
   e-mail info@amzi.com
   http://www.amzi.com
   */
  
/* ------------------------------------------------------
   The main schedule interface.  These are the predicates
   that provide services to the user interface portion of
   the program, whether it is the Prolog section above or
   written in a host language such as Delphi in the demo.

   The calling program must first clear the schedule, then
   assert schedule information about teams (team/2) and
   rounds (round/2).  Then it calls schedule/1 and retrieves
   the scheduled rounds (round/3).

   clear_schedule - clear dynamic database for new
      schedule

   init_teams - called to initialize the team list

   schedule(N) - run the main scheduler, N is 1 or 2
      for number of cycles

   saveas(F) - save text version of schedule in file F

   Dynamic database predicates used by schedule:

   team(N, Name) - team number and name for each team,
      asserted by calling program

   round(N, Name) - round number and name for each round,
      asserted by calling program
   */

/* Clear the dynamic database of assertions */

clear_schedule :-
  retractall(team(_,_)),
  retractall(teams(_,_)),
  retractall(round(_,_)),
  retractall(round(_,_,_)),
  retractall(final_schedule(_)),
  retractall(fault_count(_)),
  assert(fault_count(0)).

/* Initialize the list of teams */

init_teams :-
  findall(N, team(N, _), LN),
  length(LN, L),
  (L mod 2 =:= 1 ->
    assert(team(0, bye)), TL = [0|LN], LL is L + 1
    ; TL = LN, LL is L),
  assert(teams(LL, TL)).

/* Run the main scheduler */

schedule(N) :-
  catch( sched(N), Exception, process_ex(Exception) ).

process_ex(give_up) :- fail.
process_ex(_) :- fail.

sched(1) :-
  games(G),
  !,
  first_half(1-I2, G, []+Sr, []+_),
  reverse(Sr, S),
  assert_sched(S).
sched(2) :-
  games(G),
  !,
  first_half(1-I2, G, []+S1, []+G2),
  once( reverse(G2, G2r) ),
  second_half(I2, G2r, []+S2),
  append(S2, S1, R),
  reverse(R, S),
  assert_sched(S).

/* Save the schedule output to a text file */

saveas(F) :-
  string_atom(F, FA),
  final_schedule(S),
  tell(FA),
  disp_sched(S), nl,
  disp_team_scheds(S), nl,
  told.
saveas(F) :- told.


/* The predicates that do the work of scheduling
   --------------------------------------------- */

/* first_half schedules the first half of a full
   2-cycle round robin, second half the second.
   Most all of the predicates have slightly
   different forms for each half.  In particular
   the first half predicates keep a list of the
   rematch games for feeding to the second
   half predicates, which don't need to carry that
   extra argument */
    
first_half(I2-I2, [], S+S, G2+G2).
first_half(I-I2, G, Sa+S, G2a+G2) :-
  sched1_round(I, G, Round, Gx, G2x),
  once( append(G2x, G2a, G2n) ),
  status(I),
  II is I + 1,
  first_half(II-I2, Gx, [Round|Sa]+S, G2n+G2).

second_half(I, [], S+S).
second_half(I, G, Sa+S) :-
  sched2_round(I, G, Round, Gx),
  status(I),
  II is I + 1,
  second_half(II, Gx, [Round|Sa]+S).

status(I) :-
  report(finished(I), Continue),
  (Continue=stop -> throw(give_up); true).
status(I) :-
  retract(fault_count(N)),
  NN is N + 1,
  assert(fault_count(NN)),
  report(fault(NN), Continue),
  (Continue=stop -> throw(give_up); true),
  fail.

/* Initialize a round and get the games for
   that round */

sched1_round(I, G, round(I, Games), Gz, G2) :-
  init1_round(I, Games, G2),
  get1_games(I, G, Games),
  once( left1_to_sched(G, Games, Gz) ).

sched2_round(I, G, round(I, Games), Gz) :-
  init2_round(I, Games),
  get2_games(I, G, Games),
  once( left2_to_sched(G, Games, Gz) ).

/* Each round is initialized by a template.  In
   this case, each is the same general pattern,
   but this mechanism allows specific games to
   be placed on specific rounds. */

init1_round(N, Games1, Games2) :-
  teams(NT, _),
  template1(NT, []+Games1, []+Games2R),
  reverse(Games2R, Games2).

init2_round(N, Games) :-
  teams(NT, _),
  template2(NT, []+Games).

/* The template for a round is a list of games, in
   this case set to a number of variable pairs.  For
   the first half, the template includes two lists, one
   with a game, and the other with the rematch of the
   game.  For the second half, the template is just
   the games. */

template1(0, G1+G1, G2+G2).
template1(NT, G1a+G1, G2a+G2) :-
  NT > 0,
  NT2 is NT-2,
  template1(NT2, [Away-Home|G1a]+G1, [Home-Away|G2a]+G2).

template2(0, G+G).
template2(NT, Ga+G) :-
  NT > 0,
  NT2 is NT - 2,
  template2(NT2, [T1-T2|Ga]+G).

/* After the games have been scheduled for a day, take
   them out of the list of games left to be scheduled. */

left1_to_sched(G, [], G).
left1_to_sched(G, [Away-Home|X], Gl) :-
  delete(Away-Home, G, Gx),
  delete(Home-Away, Gx, Gy),
  left1_to_sched(Gy, X, Gl).

left2_to_sched(G, [], G).
left2_to_sched(G, [Game|X], Gl) :-
  delete(Game, G, Gx),
  left2_to_sched(Gx, X, Gl).

/* Generate games for a given round by walking the pairs
   in the template for the round, unifying them with a game
   from the list of games left to play.  After picking a
   game for the round, clean the list so that no other games
   involving either of those teams will be scheduled that
   round. */

get1_games(_, [], []).
get1_games(I, G, [Away-Home|Gs]) :-
  deal(Away-Home, G, Gx),
  once( clean(Gx, Home, Away, Gn) ),
  get1_games(I, Gn, Gs).

get2_games(_, [], []).
get2_games(I, G, [Away-Home|Gs]) :-
  deal(Away-Home, G, Gx),
  once( clean(Gx, Home, Away, Gn) ),
  get2_games(I, Gn, Gs).


/* Textual display of full schedule
   -------------------------------- */

disp_sched([]).
disp_sched([round(N, Games)|T]) :-
  round(N, Date),
  write(Date), nl,
  disp_games(Games), nl,
  disp_sched(T).

  disp_games([]).
  disp_games([Bye|X]) :-
    (Bye = 0-T; Bye = T-0),
    !,
    team(T, Name),
    tab(2), write(Name), tab(1),
    write(bye), nl,
    disp_games(X).
  disp_games([H-A|X]) :-
    team(H, Home),
    team(A, Away),
    tab(2), write(Home), tab(1), write('@'),
    tab(1), write(Away), nl,
    disp_games(X).

/* Display the schedule for each team */

disp_team_scheds(S) :-
  teams(_, T),
  team_scheds(T, S).

  team_scheds([], _).
  team_scheds([0|X], S) :-
    team_scheds(X, S).
  team_scheds([T|X], S) :-
    team(T, Name),
    write($\nSchedule for : $), write(Name), nl,
    team_sched(T, S),
    team_scheds(X, S).

  team_sched(_, []).
  team_sched(T, [round(N, Games)|X]) :-
    round(N, Date),
    disp_round(T, round(Date, Games)),
    team_sched(T, X).

  disp_round(T, round(N, Games)) :-
    member(T-O, Games), !,
    team(O, Name),
    write(N),
    (O > 0 -> write($: Away $); write($: $)),
    write(Name), nl.
  disp_round(T, round(N, Games)) :-
    member(O-T, Games), !,
    team(O, Name),
    write(N),
    (O > 0 -> write($: Home $); write($: $)),
    write(Name), nl.


/* Utility Predicates
   ------------------ */

/* Generate a list of games from the list of teams.  Home
   and away games are alternated to provide better balance
   in the schedule.  The game list is the primary input to
   the scheduler, which picks games from the list to build
   each round's schedule.  The game list is of the form:

   [2-1, 1-3, 4-1, 1-5, ...... 1-2, 3-1, 1-4...] */

games(G) :-
  teams(_, T),
  g_list(T, T, []+G).

  g_list([_], [], G+G).
  g_list([_|X], [], A+G) :-
    teams(_, T),
    g_list(X, T, A+G).
  g_list([T|X1], [T|X2], A+G) :-
    g_list([T|X1], X2, A+G).
  g_list([T1|X1], [T2|X2], A+G) :-
    (T1+T2) mod 2 =:= 1, !,
    g_list([T1|X1], X2, [T2-T1|A]+G).
  g_list([T1|X1], [T2|X2], A+G) :-
    g_list([T1|X1], X2, [T1-T2|A]+G).

/* reverse a list */

reverse(F, R) :-
  rev(F, [], R).

  rev([], R, R).
  rev([H|T], A, R) :-
    rev(T, [H|A], R).

/* append two lists together */

append([], Z, Z).
append([H|X], Y, [H|Z]) :-
  append(X, Y, Z).

/* find members of a list */

member(X, [X|_]).
member(X, [_|Y]) :-
  member(X, Y).

/* get the length of a list */

length(L, N) :-
  len(L, 0, N).

  len([], N, N).
  len([_|X], A, N) :-
    AA is A + 1,
    len(X, AA, N).

/* clean removes all the games that no longer make
   sense for a given round from the list of remaining
   games.  If, for example, we've selected game 3-8 for
   the round we're working on, then we don't need to look
   at any other games involving teams 3 or 8. */

clean(Gx, Home, Away, Gn) :-
  remove(Home, Gx, Gy),
  remove(Away, Gy, Gn).

clean(Gx, T, Gn) :-
  remove(T, Gx, Gn).

  remove(T, Gx, Gz) :-
    delete(T-_, Gx, Gy),
    remove(T, Gy, Gz).
  remove(T, Gx, Gz) :-
    delete(_-T, Gx, Gy),
    remove(T, Gy, Gz).
  remove(T, Gx, Gz) :-
    delete(T=T, Gx, Gy),
    remove(T, Gy, Gz).
  remove(_, Gn, Gn).

/* set an element of a list to a certain value */

set_elem(1, X, [_|Z], [X|Z]) :- !.
set_elem(N, X, [A|Z1], [A|Z2]) :-
  NN is N - 1,
  set_elem(NN, X, Z1, Z2).

/* delete an element from a list and return the
   remaining list.  When the first argument is
   a variable, delete/3 can be used in a back-tracking
   loop to select elements from a list. */

delete(A,[A|X],X).
delete(A,[B|X],[B|Y]) :- delete(A,X,Y).

/* deal/3 (like deal cards from a deck) is often identical
   to delete/3.  In this application, deal/3 is used to
   select games to schedule on a given round, and the list of
   games for the round can be in any order.  So, deal/3 is
   modified so that it only returns the remainder of a list,
   thereby eliminating permutations from the search. */

deal(A-H, X, Y) :-
  var(A), var(H),
  !, pick(A-H, X, Y).
deal(A-H, X, Y) :-
  delete(A-H, X, Y).

pick(A,[A|X],X).
pick(A,[B|X],Y) :- pick(A,X,Y).

/* delete all the elements in the first list from the
   second, returning the remainder in the third. */

delete_list([], A, A).
delete_list([G|X], A, Z) :-
  delete(G, A, A2),
  delete_list(X, A2, Z).

/* same as delete_list, except some of the elements in the
   first list might not be in the second.  The third argument
   contains the list of elements that were actually deleted. */

delete2_list([], Del, Del, Gz, Gz).
delete2_list([G|X], Ad, Del, Ag, Gz) :-
  once( delete(G, Ag, AGx) ), !,
  delete2_list(X, [G|Ad], Del, AGx, Gz).
delete2_list([G|X], Ad, Del, Ag, Gz) :-
  delete2_list(X, Ad, Del, Ag, Gz).

/* delete a pattern, find all the elements that match it.
   /3 version just deletes, /5 version returns list of
   deleted elements */

delete_pat(_, [], []).
delete_pat(P, [H|X], X2) :-
  not(not(P=H)), !,
  delete_pat(P, X, X2).
delete_pat(P, [H|X], [H|X2]) :-
  delete_pat(P, X, X2).

delete_pat(_, [], [], Z, Z).
delete_pat(P, [H|X], X2, A, Z) :-
  not(not(P=H)), !,
  delete_pat(P, X, X2, [H|A], Z).
delete_pat(P, [H|X], [H|X2], A, Z) :-
  delete_pat(P, X, X2, A, Z).

/* move all elements of a list that match a pattern to
   the end of the list */

move_to_back(P, G, G2) :-
  delete_pat(P, G, GLeft, [], GDel),
  append(GLeft, GDel, G2).

/* move all elements of a list that match a pattern to
   the front of the list */

move_to_front(P, G, G2) :-
  delete_pat(P, G, GLeft, [], GDel),
  append(GDel, GLeft, G2).
  
/* scramble a list into a random order, can be used
   to scramble starting team or game list so that
   each run produces a random variation of a valid
   schedule */

shuffle(Tin, Tout) :-
  time(_, Min, Sec, _),
  N is Min + Sec,
  set_random(N),
  shuffle1(Tin, [], Tout).

  set_random(N) :-
    for(I, 1, N, 1),
    X is random,
    fail.
  set_random(_).

  shuffle1([], A, A).
  shuffle1(Tin, A, Tout) :-
    length(Tin, L),
    N is 1 + integer( random * L ),
    deleteN(N, Elem, Tin, Tx),
    shuffle1(Tx, [Elem|A], Tout).
    
  deleteN(1, H, [H|Z], Z).
  deleteN(_, _, [], []) :- !, fail.
  deleteN(N, H, [X|Z], [X|Z2]) :-
    NN is N - 1,
    deleteN(NN, H, Z, Z2).

/* translate schedule list into separate assertions
   that are easier to pick up by a host language
   program */

assert_sched(S) :-
  retractall(round(_,_,_)),
  assert(final_schedule(S)),
  asrt_sched(S).

  asrt_sched([]).
  asrt_sched([round(N, Games)|X]) :-
    as_sch(N, Games),
    asrt_sched(X).

    as_sch(_, []).
    as_sch(N, [A-H|X]) :-
      team(A, Away),
      team(H, Home),
      round(N, Round),
      assert(round(Round, Away, Home)),
      as_sch(N, X).

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av免费网站| 五月综合激情日本mⅴ| 91欧美一区二区| 精品国产成人在线影院| 亚洲色欲色欲www在线观看| 91在线免费播放| 性久久久久久久| 国产精品每日更新| 成人免费三级在线| 精品1区2区在线观看| 国产99久久久久久免费看农村| 粉嫩绯色av一区二区在线观看| 欧美高清在线视频| 欧美探花视频资源| 久久精品99国产国产精| 欧美大片拔萝卜| 不卡av在线免费观看| 亚洲欧美视频一区| av男人天堂一区| 偷偷要91色婷婷| 国产欧美久久久精品影院| 91香蕉视频在线| 国产精品色一区二区三区| 欧美伊人久久久久久久久影院| 日韩免费在线观看| 在线看日本不卡| 精品亚洲porn| 国产精品色一区二区三区| 在线综合视频播放| 99久久国产综合精品色伊| 一区在线中文字幕| 中文字幕一区二区视频| 7777精品久久久大香线蕉| 不卡一区二区在线| 国产a区久久久| 免费观看在线色综合| 亚洲精品美国一| 日韩免费观看2025年上映的电影 | 懂色av中文字幕一区二区三区 | 亚洲四区在线观看| 欧美一区二区三区在线电影| 一级日本不卡的影视| 亚洲一区二区偷拍精品| 国产欧美日韩在线| 日韩一区二区三区观看| 欧美一级xxx| 在线观看区一区二| 成人在线视频首页| 99麻豆久久久国产精品免费优播| 蜜臂av日日欢夜夜爽一区| 亚洲一区二区精品视频| 欧美激情一区二区三区不卡| 欧美一区永久视频免费观看| 在线亚洲免费视频| 麻豆91免费观看| 国产盗摄视频一区二区三区| 免费三级欧美电影| 亚洲男女一区二区三区| 亚洲综合视频在线观看| 国产精品福利在线播放| 国产清纯白嫩初高生在线观看91 | 国产黄色成人av| 日本欧美大码aⅴ在线播放| 亚洲精品国产无天堂网2021| 精品国产一区二区三区不卡| 中文字幕国产一区二区| 久久久一区二区三区| 精品va天堂亚洲国产| 国产亲近乱来精品视频| 中文字幕高清一区| 国产精品久久久久久久久免费丝袜 | 欧美一区二区精美| 欧美日本一区二区| 欧美日韩免费观看一区三区| 精品蜜桃在线看| 欧美videos大乳护士334| 欧美大片在线观看| 综合久久给合久久狠狠狠97色| 国产欧美久久久精品影院| 国产日韩欧美亚洲| 91精品欧美久久久久久动漫| 国产亚洲欧洲997久久综合 | av动漫一区二区| 91在线播放网址| 日本大香伊一区二区三区| 欧美一级黄色大片| 精品免费日韩av| 久久尤物电影视频在线观看| 国产精品福利av| 国产嫩草影院久久久久| 国产欧美一区二区精品性色超碰| 色婷婷av一区二区三区之一色屋| 欧美日免费三级在线| 欧美日本韩国一区| 日韩欧美国产小视频| 一区二区在线电影| 日韩国产精品久久久| 激情五月婷婷综合网| 在线观看一区不卡| 精品日韩成人av| 欧美国产精品中文字幕| 久久久久国产精品人| 香蕉久久一区二区不卡无毒影院| 免费观看日韩电影| 国产成人av影院| 日韩精品中文字幕一区| 日本一区二区三区四区 | 26uuu色噜噜精品一区二区| 亚洲精品福利视频网站| 日韩国产精品久久| 成人av中文字幕| 国产精品123| av一区二区三区四区| 久久久国产午夜精品| 亚洲精品伦理在线| 日韩黄色在线观看| 精品视频在线免费看| 精品99久久久久久| 亚洲小说欧美激情另类| 一本一本大道香蕉久在线精品| 日韩午夜在线观看视频| 亚洲免费在线电影| 色婷婷av一区二区三区之一色屋| 日韩欧美专区在线| 怡红院av一区二区三区| 波多野结衣精品在线| 日韩欧美国产高清| 夜夜揉揉日日人人青青一国产精品| www.色精品| 日韩精品中文字幕一区二区三区| 国产精品欧美综合在线| 亚洲欧洲精品一区二区三区不卡| 日韩电影一区二区三区| 成人av网站在线| 在线观看91视频| 亚洲成av人片在线| 国产mv日韩mv欧美| 色综合久久久久综合体桃花网| 亚洲精品一区二区三区蜜桃下载| 日韩欧美成人一区二区| 亚州成人在线电影| av网站一区二区三区| 亚洲女人小视频在线观看| 日韩精品影音先锋| 性久久久久久久久| 韩国精品在线观看| 欧美日韩国产大片| 亚洲欧美日韩国产另类专区| 91麻豆精品秘密| 中文字幕精品综合| 国产成人综合网| 中文字幕亚洲一区二区av在线| 久久99国产精品麻豆| 欧美美女喷水视频| 久久99国产精品久久| 欧美精品一二三| 亚洲午夜久久久久| 日韩欧美一区在线| 蜜臀av一区二区在线免费观看| 欧美图片一区二区三区| 久国产精品韩国三级视频| 在线不卡欧美精品一区二区三区| 亚洲免费观看视频| 91精品国产欧美一区二区成人| 香蕉久久夜色精品国产使用方法| 色综合咪咪久久| 蜜桃视频免费观看一区| 777xxx欧美| 蜜桃av一区二区| 香蕉影视欧美成人| 欧美中文字幕一区二区三区| 自拍偷拍欧美激情| 欧美一区二区在线视频| 免费在线看成人av| 日韩精品一区二区三区swag| 九色porny丨国产精品| 欧美日韩一级黄| 国产精品影视天天线| 国产日韩高清在线| 免费成人av在线播放| 中文字幕五月欧美| 99麻豆久久久国产精品免费优播| 国产日韩成人精品| 这里只有精品电影| 毛片一区二区三区| 91精品国产一区二区三区蜜臀| 国产一区视频在线看| 国产片一区二区| 处破女av一区二区| 蜜臀av性久久久久蜜臀aⅴ四虎 | 欧美成人a∨高清免费观看| 五月婷婷色综合| 精品奇米国产一区二区三区| 久久99精品久久久久久国产越南 | 亚洲va欧美va人人爽| 国产欧美日韩另类视频免费观看| av网站一区二区三区| 国产日韩欧美麻豆| 日韩欧美aaaaaa| 成人动漫一区二区三区|