How can I improve this code?
I think it could be a lot shorter, I just don't see how. It works and does what it should, but that doesn't satisfy me.
I'm open for advice.
PS: I forgot that I have the choices() parameter in there, I tried it out earlier but it doesn't work for me. I don't quite understand the parameters, especially the K parameter and the weight parameter. What exactly do they do? I googled but it won't sink in..