In post 16, Psyche wrote:oh, so you're not asking for people's code
Asking for code is absurd if the challenge is intended to be code-agnostic.
I think I'd be more interested as a mish mash. It seems like you'd have to be very meticulous about how challenges are assigned (i.e. determine
everything
pregame) to avoid problems with mod intervention, and the game is going to suffer if some players will easily complete all the challenges, while others will complete relatively few.
I will be don't worry. Everything is scripted pre game.
The second thing is why I want people who already have some idea how to code. I would not recommend this game if you're just like "eh, I can probably figure out some code stuff"
In post 23, Psyche wrote:i used a for loop with a nested if/else
unless count runs in less than linear time i think it might have taken half as much time to run as yours
but it didnt fit in one line
I know in f# the compuler/interpreter can convert tail recursion to iteration for the object code
If someone wants to do it as a mish mash game they can feel free. I don't understand why that would have to be an either or proposition. Like, the fact that we have mish mash survivor games does not preclude us from having survivor themed mafia games.
def main(code):
for all element in code:
floor = 0
if element = "(":
floor += 1
elsif element = ")":
floor -= 1
else:
print "Invalid character! \n"
return floor
print main(*)
* indicates where you should copypaste the encoded text.
There's nothing that says that a fake can't beat the real thing.
You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
def main(code):
for all element in code:
floor = 0
if element = "(":
floor += 1
elsif element = ")":
floor -= 1
else:
print "Invalid character! \n"
return floor
print main(*)
* indicates where you should copypaste the encoded text.
Put "floor = 0" outside of the loop. Your use of "=" over "is" is correct here, since "is" is much more likely to introduce a bug later on if you end up building on this code to handle similar problems.
i was going to ask that, too
when i'm coding in python, i've always used == and i thought it was because i had to
similarly, i thought i had to use the form "for <dummyvariable> in <list>", which contrasts with accountant's including "all" in there
but syntax is less important that the algorithm itself
In my defense i wrote the damn thing on mobile while waiting for my lecture to begin.
Kagami is correct, floor = 0 has to be outside the loop. TSQ and FA are correct, it has to be ==.
No idea about is but I prefer ==
There's nothing that says that a fake can't beat the real thing.
You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
Given an array length 1 or more of ints, return the difference between the largest and smallest values in the array.
Bonus points: don't use min() or max()
There's nothing that says that a fake can't beat the real thing.
You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
Clarification: Answer above should be written as a defined function, called using an array length of one or more in its parameters.
There's nothing that says that a fake can't beat the real thing.
You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.
def find_diff(array)
>largest = 0
>smallest = 0
>>for x in array:
>>>if x > largest:
>>>>largest = x
>>>elseif x < smallest:
>>>>smallest = x
>>>else:
>>>>print "You fucked up! Try again!"
>return largest - smallest
Another attempt at coding on mobile. Using > because tapping space four times messes with my head.
There's nothing that says that a fake can't beat the real thing.
You must not imagine that for beings like you and us there can be laughter. The low men laugh, and we envy them. But for us, the higher ones, there is no laughter, only an unending vigil, purely serious, stretching on into the night.