:Namespace Contest2014
AboutMe←'' ⍝ Tell us a bit about you, your major, other languages you know, etc.
⍝ AboutMe,←'' ⍝ copy and uncomment as many additional lines as you need
Reaction←'' ⍝ Share your thoughts about the competition... Did you enjoy it? How can we improve future competitions?
⍝ Reaction,←'' ⍝ copy and uncomment as many additional lines as you need
:Namespace Problems
⍝ define variables for Recreation and Games Problem 1 - Task 1
puzzle←10 10⍴'TREDUCEMOPIRUKIWORPENXADMNPOEUWAANAPNTRDHYCDSRFAAIDIISIPDTTSDCFSJVOEOEETUMMOCSRRNFDARTCMEBTJLYYOFAZX'
words←'COMMUTE' 'DFN' 'DYADIC' 'MONADIC' 'OPERATOR' 'REDUCE' 'RESIDUE' 'ROTATE' 'SCAN' 'TRADFN' 'TRANSPOSE'
(⎕IO ⎕ML ⎕WX)←1 0 3
∇ msg←text BookDecrypt enc
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 1 - Task 2
⍝ Modified Book Cipher Decryption
⍝ text: character vector representing normalised book text to use as the cipher key
⍝ enc: character vector representing the encrypted message
⍝ msg: character vector representing the original message
∇
∇ enc←text BookEncrypt msg
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 2 - Task 2
⍝ Modified Book Cipher Encryption
⍝ text: character vector representing normalised book text to use as the cipher key
⍝ msg: character vector representing the original message
⍝ enc: character vector representing the encrypted message
∇
∇ dictionary←BuildDictionary folder
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 2 - Task 1
⍝ build dictionary
⍝ folder: character vector representing the folder where the dictionary files are located puzzle
⍝ dictionary: vector of vector characters of the words read from the dictionary files
∇
∇ n←string Count kmer
⍝ 2014 APL Problem Solving Competition stub function for Bioinformatics Problem 1 - Task 1
⍝ kmer counting
⍝ string: character vector genome
⍝ kmer: character vector kmer to look for
⍝ n: integer count of the number of times kmer was found in string
∇
∇ hands←DealHands
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 3 - Task 1
⍝ lets make a deal
⍝ hands: array representing 13 cards dealt to each of 4 players
∇
∇ ed←s EditDistance t
⍝ 2014 APL Problem Solving Competition stub function for Bioinformatics Problem 3 - Task 4
⍝ edit distance
⍝ s: character vector
⍝ t: character vector
⍝ ed: "edit distance" to transform s into t
∇
∇ kmers←genome FindClumps(k L t)
⍝ 2014 APL Problem Solving Competition stub function for Bioinformatics Problem 2 - Task 1
⍝ clump finding
⍝ genome: character vector genome
⍝ k: length of the pattern to look for
⍝ L: interval within genome to search
⍝ t: the number of times the pattern needs to occur within the interval
⍝ kmers: vector of character vectors of the kmers found
∇
∇ lss←text1 LongestShared text2
⍝ 2014 APL Problem Solving Competition stub function for Bioinformatics Problem 3 - Task 2
⍝ longest shared substring
⍝ text1: character vector
⍝ text2: character vector
⍝ lss: character vector of the longest shared substring in text1 and text2
∇
∇ result←dictionary MaxWord tiles
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 2 - Task 2
⍝ word search
⍝ dictionary: vector of character vectors representing the words in the dictionary built in Task 1 list character matrix representing the word search puzzle
⍝ tiles: character vector representing the letters on Scrabble tiles
⍝ result: 2 element vector representing information about the maximum scoring word
⍝ element 1: character vector representing the word
⍝ element 2: integer representing the score for the word
∇
∇ kmers←string MostFrequent k
⍝ 2014 APL Problem Solving Competition stub function for Bioinformatics Problem 1 - Task 2
⍝ most frequent kmers
⍝ string: character vector genome
⍝ k: length of kmer to look for
⍝ kmers: vector of character vectors of the most frequent kmers in string
∇
∇ text←Normalise filename
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 2 - Task 1
⍝ Normalize
⍝ filename: character vector representing the name of the file to read
⍝ text: character vector representing the normalised text
∇
∇ msg←square PlayfairDecrypt enc
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 3 - Task 3
⍝ Playfair Decryption
⍝ square: character matrix representing Playfair square to use as the cipher key
⍝ enc: character vector representing the encrypted message
⍝ msg: character vector representing the original message
∇
∇ enc←square PlayfairEncrypt msg
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 3 - Task 2
⍝ Playfair Encryption
⍝ square: character matrix representing Playfair square to use as the cipher key
⍝ msg: character vector representing the original message
⍝ enc: character vector representing the encrypted message
∇
∇ square←{method}PlayfairSquare key
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 3 - Task 1
⍝ Playfair Square
⍝ key: character vector representing the cipher key
⍝ method: {optional} fill technique indicator
⍝ square: character matrix Playfair Square constructed from the key
∇
∇ sns←text1 ShortestNonShared text2
⍝ 2014 APL Problem Solving Competition stub function for Bioinformatics Problem 3 - Task 3
⍝ shortest non-shared substring
⍝ text1: character vector
⍝ text2: character vector
⍝ sns: character vector of the shortest non-shared substring in text1 and text2
∇
∇ display←ShowHand hand
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 3 - Task 2
⍝ what's in you hand
⍝ hand: array representing 13 cards dealt to a player
⍝ display: 2 column matrix containing
⍝ column 1: suit indicator
⍝ column 2: a character vector representing the card ranks found in that suit
∇
∇ statistics←Simulate deals
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 3 - Task 4
⍝ simulation stimulation
⍝ scenarios: an integer representing the number of deals to simulate
⍝ statistics: a 2 element vector
⍝ element 1: a 3 column matrix where
⍝ column 1 contains the high card point values from 0 through 37
⍝ column 2 contains the number of hands that had the corresponding point value
⍝ column 3 contains the percent (expressed as a number between 0 and 1) of the total hands that had the corresponding point value.
⍝ element 2: a 2 element vector where
⍝ element 1: the number of deals where either partnership (North-South or East-West) totaled 37 or more combined points
⍝ element 2: the percentage of hands where this occurred
∇
∇ value←ValueHand hand
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 3 - Task 3
⍝ value hand
⍝ hand: array representing 13 cards dealt to a player
⍝ value: a 3 element integer vector containing
⍝ element 1: total high card points
⍝ element 2: total distribution points
⍝ element 3: total point corrections
∇
∇ msg←key VigDecrypt enc
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 1 - Task 2
⍝ Vigenère Cipher Decryption
⍝ key: character vector representing the key to use
⍝ enc: character vector representing the encrypted message
⍝ msg: character vector representing the original message
∇
∇ enc←key VigEncrypt msg
⍝ 2014 APL Problem Solving Competition stub function for Encryption Problem 1 - Task 1
⍝ Vigenère Cipher Encryption
⍝ key: character vector representing the key to use
⍝ msg: character vector representing the original message
⍝ enc: character vector representing the encrypted message
∇
∇ result←puzzle WordSearch words
⍝ 2014 APL Problem Solving Competition stub function for Recreation and Games Problem 1 - Task 1
⍝ word search
⍝ puzzle: character matrix representing the word search puzzle
⍝ words: vector of character vectors representing the words to find in the puzzle
⍝ result: matrix representing information about the words found in the puzzle (one row per word)
⍝ column 1: character vector representing the word found
⍝ column 2: 2 element integer vector representing the row and column of the first letter of the word
⍝ column 3: character vector representing the "compass direction" in which the word is read
∇
∇ offsets←text(d ApproxMatch)pattern
⍝ 2014 APL Problem Solving Competition stub operator for Bioinformatics Problem 2 - Task 2
⍝ approximate pattern matching
⍝ d: maximum allowed mismatches
⍝ k: length of the pattern to look for
⍝ text: interval within genome to search
⍝ pattern: interval within genome to search
⍝ offsets: vector of offsets representing start positions where pattern is matched
∇
∇ offsets←genome1(k SharedKmers)genome2
⍝ 2014 APL Problem Solving Competition stub operator for Bioinformatics Problem 3 - Task 1
⍝ shared kmers
⍝ genome1: character vector genome
⍝ genome2: character vector genome
⍝ k: length of the pattern to compare between genome1 and genome2
⍝ offsets: vector of 2-element vectors in genome1 and genome2 where shared kmers are found
∇
:EndNamespace
:EndNamespace