Ask coding questions

← Back to all posts
How can I improve this code?
CapnDom

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..

Voters
CapnDom
Comments
hotnewtop
Spacecraft
CapnDom

@Spacecraft Thanks man, I think I have to look at for loops again, I didn't see that and didn't quite understand how they work. That's why I tried to work around it and artificaly made it harder than it should be.

That's helping a lot.