Data update
This commit is contained in:
parent
61b93a2cd1
commit
5af6d93694
858 changed files with 20572 additions and 2082 deletions
7
Task/Permutations/Applesoft-BASIC/permutations.basic
Normal file
7
Task/Permutations/Applesoft-BASIC/permutations.basic
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
10 INPUT "HOW MANY? ";N:J = N - 1
|
||||
20 S$ = " ":M$ = S$ + CHR$ (13):T = 0: DIM A%(J),K%(J),I%(J),R%(J): FOR I = 0 TO J:A%(I) = I + 1: NEXT :K%(S) = N:R = S:R%(R) = 0:S = S + 1
|
||||
30 IF K%(R) < = 1 THEN FOR I = 0 TO N - 1: PRINT MID$ (S$,(I = 0) + 1,1)A%(I);: NEXT I:S$ = M$: GOTO 70
|
||||
40 K%(S) = K%(R) - 1:R%(S) = 0:R = S:S = S + 1: GOTO 30
|
||||
50 J = I%(R) * (1 - (K%(R) - INT (K%(R) / 2) * 2)):T = A%(J):A%(J) = A%(K%(R) - 1):A%(K%(R) - 1) = T:K%(S) = K%(R) - 1:R%(S) = 1:R = S:S = S + 1: GOTO 30
|
||||
60 I%(R) = (I%(R) + 1) * R%(S): IF I%(R) < K%(R) - 1 GOTO 50
|
||||
70 S = S - 1:R = S - 1: IF R > = 0 GOTO 60
|
||||
17
Task/Permutations/FutureBasic/permutations-1.basic
Normal file
17
Task/Permutations/FutureBasic/permutations-1.basic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
void local fn perm( k as Short)
|
||||
static Short w( 4 ), i = -1
|
||||
Short j
|
||||
i ++ : w( k ) = i
|
||||
if i = 4
|
||||
for j = 1 to 4 : print w( j ),
|
||||
next : print
|
||||
else
|
||||
for j = 1 to 4 : if w( j ) = 0 then fn perm( j )
|
||||
next
|
||||
end if
|
||||
i -- : w( k ) = 0
|
||||
end fn
|
||||
|
||||
fn perm(0)
|
||||
|
||||
handleevents
|
||||
12
Task/Permutations/FutureBasic/permutations-2.basic
Normal file
12
Task/Permutations/FutureBasic/permutations-2.basic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
void local fn perm( w as CFStringRef )
|
||||
Short a, b, c, d
|
||||
for a = 0 to 3 : for b = 0 to 3 : for c = 0 to 3 : for d = 0 to 3
|
||||
if a != b and a != c and a != d and b != c and b != d and c != d
|
||||
print mid(w,a,1); mid(w,b,1); mid(w,c,1); mid(w,d,1)
|
||||
end if
|
||||
next : next : next : next
|
||||
end fn
|
||||
|
||||
fn perm (@"abel")
|
||||
|
||||
handleevents
|
||||
Loading…
Add table
Add a link
Reference in a new issue