09/07/02 09:21:08
>>319
% せっかくだからN回切るのをやってみよう。
% Prolog
t319_cut(N,L) :-
t319_3(L1),
t319_cut(N,L1,L).
t319_cut(0,L,L) :- !.
t319_cut(N,L,X) :-
M1 is (random mod 52) + 1,
M2 is (random mod 52) + 1,
swap_nth(M1,M2,L,L1),
N2 is N - 1,
t319_cut(N2,L1,X).
swap_nth(M,N,L1,L2) :-
list_nth(M,L1,A),
list_nth(N,L1,B),
swap(A,B,L1,L2).