podondra/wator

Feedback

Closed this issue ยท 2 comments

Hi @hroncok and @MarekSuchanek.

I've just finished the WaTor assigment and add tag v0.1 to the right commit. Therefore, I would like to ask for feedback please.

Thanks.

  • ๐Ÿ‘Œ test all pass for me
  • ๐ŸŽฉ flake8 is silent

The rest are nitpicks. Giving 5 points.

  • ๐Ÿ˜• when raising exceptions, you rise the exception class (raise(ValueError))
    • there's no information for the user, instead raise an instance with a message, such as:
      raise ValueError('cannot use energies and energy_initial together')
    • ๐Ÿฅ‡ I didn't even know raising classes is possible
    • ๐Ÿ‘๏ธ this will also make your code more readbale (i.e. I don't have to decrypt: why is this exception here?)
  • ๐Ÿ’ฏ I like the way you did the random creatures setup
  • ๐Ÿ‘Ž but on the other hand, your __init__ is rather long and if I didn't know what is supposed to happen, I would have to decipher it to understand it, breaking it to smaller methods with descriptive names would make it more readable (i.e. __init__ calls something like self._random_creatures(...))
  • ๐Ÿ generate_move is very Pythonistic using generators, which is good, but it will kick you a bit when we iterate to Cython - so prepare for more fun ๐Ÿ‘ฟ
  • 2๏ธโƒฃ you copy creatures twice per chronon, which might not be very effective

Thanks for the feedback ๐Ÿ‘ I've tried to fix all the issues in commits form 3014e3a to 045e805 ๐Ÿ”จ Because their were only minor issues closing.