Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Rot-13/Prolog/rot-13-1.pro
Normal file
22
Task/Rot-13/Prolog/rot-13-1.pro
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
:- use_module(library(ctypes)).
|
||||
|
||||
runtime_entry(start) :-
|
||||
prompt(_, ''),
|
||||
rot13.
|
||||
|
||||
rot13 :-
|
||||
get0(Ch),
|
||||
( is_endfile(Ch) ->
|
||||
true
|
||||
; rot13_char(Ch, Rot),
|
||||
put(Rot),
|
||||
rot13
|
||||
).
|
||||
|
||||
rot13_char(Ch, Rot) :-
|
||||
( is_alpha(Ch) ->
|
||||
to_upper(Ch, Up),
|
||||
Letter is Up - 0'A,
|
||||
Rot is Ch + ((Letter + 13) mod 26) - Letter
|
||||
; Rot = Ch
|
||||
).
|
||||
7
Task/Rot-13/Prolog/rot-13-2.pro
Normal file
7
Task/Rot-13/Prolog/rot-13-2.pro
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
rot13(Str, SR) :-
|
||||
maplist(rot, Str, Str1),
|
||||
string_to_list(SR, Str1).
|
||||
|
||||
rot(C, C1) :-
|
||||
( member(C, "abcdefghijklmABCDEFGHIJKLM") -> C1 is C+13;
|
||||
( member(C, "nopqrstuvwxyzNOPQRSTUVWXYZ") -> C1 is C-13; C1 = C)).
|
||||
2
Task/Rot-13/Prolog/rot-13-3.pro
Normal file
2
Task/Rot-13/Prolog/rot-13-3.pro
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
?- rot13("The Quick Brown Fox Jumped Over The Lazy Dog!", SR).
|
||||
SR = "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt!".
|
||||
Loading…
Add table
Add a link
Reference in a new issue