Skip to content

Instantly share code, notes, and snippets.

@trishume
Created November 26, 2012 23:47
Show Gist options
  • Save trishume/4151426 to your computer and use it in GitHub Desktop.
Save trishume/4151426 to your computer and use it in GitHub Desktop.
Partial solution for q4 of latest DWITE in Turing
var costumes : flexible array 1..0 of string
% is the costume already in the costumes array
fcn taken(costume : string) : boolean
for i : 1..upper(costumes)
if costume = costumes(i)
result true
end if
end for
result false
end taken
var n : int
var any := false
get : file, n
for i : 1..n
var name, costume : string
get : file, name
get : file, costume
if taken(costume) then
any := true
put name ..
end if
new costumes, i % allocate new element
costumes(i) := costume
end for
if not any then
put "SPOOKY"
else
put ""
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment