Mercurial > repo
view interps/c-intercal/pit/sort.i @ 12518:2d8fe55c6e65 draft default tip
<int-e> learn The password of the month is release incident pilot.
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Sun, 03 Nov 2024 00:31:02 +0000 |
parents | 859f9b4339e6 |
children |
line wrap: on
line source
PLEASE NOTE THAT THIS PROGRAM SORTS AN ENTERED LIST OF NUMBERS NUMBERS ARE ENTERED UNTIL A ZERO IS RECEIVED, THEN THE SORTED LIST IS OUTPUT, USING INSERTION SORT ALGORITHM PLEASE NOTE THAT THIS PROGRAM USES COMPUTED ABSTAIN, TRY AGAIN, BUT NO NEXTING, COMING FROM, OR ARRAYS PLEASE NOTE .5 .6 .7 .8 ARE ALL TEMPORARIES PLEASE NOTE .1 AND .4 ARE STASHED TO ACT LIKE ARRAYS (8) DO .1 <- #0 (9) DO STASH .1 (10) DO .2 <- #0 (13) DO .4 <- #0 (14) DO STASH .4 PLEASE NOTE .2 HOLDS CURRENT STATE OF PROGRAM; .2 IS #0 DURING INPUT, #1 WHEN INSERTING A VALUE, #3 WHEN RESETTING THE STASH, #7 WHEN OUTPUTTING THE SORTED VALUES DO REINSTATE (10) DO REINSTATE (13) DO REINSTATE (14) DO REINSTATE (10) DO REINSTATE (13) DO REINSTATE (14) DO ABSTAIN FROM (8) DO ABSTAIN FROM (9) DO ABSTAIN FROM (10) PLEASE DO ABSTAIN FROM (13) DO ABSTAIN FROM (14) PLEASE NOTE THE ABOVE LINES ENSURE 10+13+14 ARE ABSTAINED FROM EXACTLY ONCE PLEASE NOTE WRITING IN AN ELEMENT IFF .2 IS #0 DO ABSTAIN FROM (15) DO ABSTAIN "!2~.2'~#1"$#1 FROM (15) PLEASE NOTE LINE 15 ABSTAINED FROM 2 OR 4 TIMES DO REINSTATE (15) DO REINSTATE (15) (15) DO WRITE IN .3 DO REINSTATE (15) DO REINSTATE (15) PLEASE NOTE SETTING LSB OF .2 DO .2 <- 'V.2$#1'~"#0$#65535" PLEASE NOTE INSERTING .3 INTO OUR STASH IF .2 IS #1 DO .8 <- '?.2$#1'~"#0$#65535" DO .8 <- !8~.8'~#1 DO .8 <- '?.8$#1'~"#0$#65535" DO ABSTAIN FROM (33) DO ABSTAIN .8$#1 FROM (33) DO REINSTATE (33) DO REINSTATE (33) (33) DO ABSTAIN #1 FROM STASHING + RETRIEVING + CALCULATING + ABSTAINING + READING OUT DO REINSTATE (33) DO REINSTATE (33) DO RETRIEVE .1 PLEASE NOTE IF .1 IS LESS THAN OR EQUAL TO .3, WE STASH .3 ON STASH .4 AND SET .2 TO #3 PLEASE NOTE IF .1 IS GREATER THAN .3, WE STASH .1 ON STASH .4 AND LEAVE .2 AS IT IS PLEASE NOTE IF .1 IS #0, THIS NEEDS THE SAME ACTIONS AS IF .1 WAS LOWER PLEASE NOTE ADDING .1 TO THE COMPLEMENT OF .3, STORING THE RESULT IN .8, OVERFLOW IN .7 DO .8 <- '?.3$#65535'~"#0$#65535" DO .5 <- .1 DO .7 <- #0 PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE DO .6<-"&!8$.5'"~'#0$#65535' DO .8<-"?!8$.5'"~'#0$#65535' DO .5<-!6$#0'~"#32767$#1" DO .7<-'V.7$".6~#32768"'~"#0$#65535" PLEASE NOTE THAT IF .1 IS GREATER THAN .3, .7 WILL BE 1; OTHERWISE .7 WILL BE 0 PLEASE NOTE .4 MUST BECOME .1 IF .7 IS 1 OR .3 IF .7 IS 0 DO .7 <- '.7$.7'$".7$.7" DO .7 <- '.7$.7'$".7$.7" PLEASE NOTE .7 IS NOW 65535 OR 0, SO WE WANT .4 <- (.1 & .7)|(.3 & ~.7) DO .5 <- '&.1$.7'~"#0$#65535" PLEASE DO .6 <- '?.7$#65535'~"#0$#65535" DO .6 <- '&.3$.6'~"#0$#65535" DO .4 <- 'V.5$.6'~"#0$#65535" DO STASH .4 PLEASE NOTE SETTING BIT 1 OF .2 IFF .7 IS #0 PLEASE DO .7 <- '?.7$#65535'~"#0$#65535" DO .7 <- '&.7$#2'~"#0$#65535" PLEASE DO .2 <- 'V.2$.7'~"#0$#65535" DO ABSTAIN FROM (1) (1) DO REINSTATE STASHING + RETRIEVING + CALCULATING + ABSTAINING + READING OUT DO REINSTATE (1) PLEASE NOTE END OF CODE FOR .2 = #1 PLEASE NOTE .9 KEEPS TRACK OF WHAT .2 WAS DO .9 <- .2 PLEASE NOTE THAT IF .3 IS #0 AND .2 IS #3 THEN .2 SHOULD BECOME #7 DO .8 <- '?.2$#3'~"#0$#65535" DO .8 <- 'V.3$.8'~"#0$#65535" DO .8 <- ".8~.8"~#1 DO .8 <- '?.8$#1'~"#0$#65535" DO .8 <- .8$!8$.8' DO .2 <- 'V.2$.8'~"#0$#65535" PLEASE NOTE THAT IF .9 != .2 WE MUST POP A #0 OFF .4'S STASH DO .8 <- '?.2$.9'~"#0$#65535" DO .8 <- !8~.8'~#1 DO .8 <- '?.8$#1'~"#0$#65535" DO ABSTAIN FROM (113) DO ABSTAIN .8$#1 FROM (113) DO REINSTATE (113) DO REINSTATE (113) (113) DO RETRIEVE .4 DO REINSTATE (113) DO REINSTATE (113) PLEASE NOTE OUTPUTTING SORTED LIST IF .2 IS #7 DO ABSTAIN FROM (125) DO .8 <- '?.2$#7'~"#0$#65535" DO .8 <- !8~.8'~#1 DO .8 <- '?.8$#1'~"#0$#65535" DO ABSTAIN FROM (54) DO ABSTAIN .8$#1 FROM (54) DO REINSTATE (54) DO REINSTATE (54) (54) DO ABSTAIN #1 FROM CALCULATING + ABSTAINING + READING OUT + RETRIEVING DO REINSTATE (54) DO REINSTATE (54) DO ABSTAIN FROM (60) DO ABSTAIN FROM (133) DO RETRIEVE .4 PLEASE NOTE IF .4 IS #0 THEN END PROGRAM DO .8 <- !4~.4'~#1 DO .8 <- '?.8$#1'~"#0$#65535" DO ABSTAIN .8$#1 FROM (125) (60) PLEASE DO REINSTATE CALCULATING + ABSTAINING + RETRIEVING DO REINSTATE (60) DO REINSTATE (125) DO REINSTATE (125) (125) DO ABSTAIN FROM (999) DO REINSTATE (125) DO REINSTATE (125) (999) DO ABSTAIN FROM RETRIEVING + CALCULATING + ABSTAINING + REINSTATING + TRYING AGAIN + READING OUT DO REINSTATE (999) DO READ OUT .4 (133) DO REINSTATE READING OUT DO REINSTATE (133) PLEASE NOTE END OF CODE FOR .2 = #7 PLEASE NOTE MOVING STASH .4 BACK TO STASH .1 IF .2 IS #3 DO .8 <- '?.2$#3'~"#0$#65535" DO .8 <- !8~.8'~#1 DO .8 <- '?.8$#1'~"#0$#65535" DO ABSTAIN FROM (34) DO ABSTAIN .8$#1 FROM (34) DO REINSTATE (34) DO REINSTATE (34) (34) DO ABSTAIN #1 FROM STASHING + RETRIEVING + CALCULATING + ABSTAINING DO REINSTATE (34) DO REINSTATE (34) PLEASE DO RETRIEVE .4 DO STASH .1 DO .1 <- .4 PLEASE NOTE THAT IF .1 IS NOW #0, WE NEED TO SET .2 BACK TO #0 AND STASH A #0 BACK IN STASH .4 THIS IS ACCOMPLISHED BY ABSTAINING ONCE OR THREE TIMES FROM 10+13+14 PLEASE DO .7 <- !1~.1'~#1 DO ABSTAIN .7$#1 FROM (10) PLEASE DO ABSTAIN .7$#1 FROM (13) DO ABSTAIN .7$#1 FROM (14) DO ABSTAIN FROM (104) PLEASE DO ABSTAIN FROM (110) PLEASE DO ABSTAIN FROM (111) DO ABSTAIN FROM (112) (104) DO REINSTATE STASHING + RETRIEVING + CALCULATING + ABSTAINING DO REINSTATE (104) PLEASE NOTE ABSTAINING #3 FROM 10+13+14 IF .2 != #3 (110) DO ABSTAIN #3 FROM (10) (111) DO ABSTAIN #3 FROM (13) (112) PLEASE DO ABSTAIN #3 FROM (14) DO REINSTATE (110) DO REINSTATE (111) DO REINSTATE (112) PLEASE DO REINSTATE (10) PLEASE DO REINSTATE (13) DO REINSTATE (14) DO REINSTATE (10) DO REINSTATE (13) DO REINSTATE (14) PLEASE NOTE END OF CODE FOR .2 = #3 PLEASE TRY AGAIN