[Tutor] TypeError: unhashable type: 'pygame.math.Vector2'

Cravan savageapple850 at gmail.com
Fri Jun 26 21:44:26 EDT 2020



> On 27/6/20, 8:13 AM, "Tutor on behalf of dn via Tutor" <tutor-bounces+savageapple850=gmail.com at python.org on behalf of tutor at python.org> wrote:

  	
    > It may be worth taking a step-back - both in terms of the design you are 
    implementing and the questions you are asking of us:-
Sure! I apologise for any inconvenience caused, and really appreciate your efforts to help me    
    > Have looked and looked, and then used 'find', but failed to find the 
    code-line at-error. Why? [help us to help you!]
Essentially right now my dictionary is only churning out values of a current index when printing it out, so e.g.
{((1023, 767), 'U'): 0, ((1023, 767), 'D'): 0, ((1023, 767), 'L'): 0, ((1023, 767), 'R'): 0} when it's supposed to be inclusive of all the coords. in the game (and the possible actions). I can't seem to rectify it(I don't know how).
    
    > Aside from learning Python's idioms, are you using a competent IDE? 
    Could you then use full-names instead of abbreviations, without adding 
    major effort? I think we could guess what a "zomb" is, but would it be 
    better (and kinder) to remove all doubt?
I'm using Atom to do it. An enemy in this case would be a zombie.(zomb) who is seeking to kill the player. The player has a health bar which decreases when the zombie touches it, and my game is a maze game. The zombies can pass through walls to give them an advantage over the player (making it more difficult)
    >  Have comments and "docstrings" (a pythonic idiom) been used to describe 
    what the code/each function is supposed to do, and why?
Well, some (haha). 
    
    > If the game's environment is described as a "grid", why is its width and 
    height described using anything other than int[eger]s?
Width and Height are the actual width and height. Essentially gridwidth and gridheight are the width and height (in tilesize units) e.g. 3 tiles x 4 tiles for example
    > What is the purpose of "state"? Is there a difference between "state" 
    and "position" (or next-/previous-position)?
A state is essentially the current state of the system (i.e. I can set the state as the product of my coordinates, for example but now I'm using it as the coords. for convenience), within a set of states (product of the maximum y-coord and the max. x-coord but it also can be all the coords in my environment(which I am using))
    
    > Have you understood the (animation) concept of collision? (assuming that 
    is part of the intent here) Have you noted various algorithms and 
    approximations which are commonly-used?
Yes, the collision part is fine since I was able to get it to work before the implementation of machine learning
    -- 
    Regards =dn
    _______________________________________________
    Tutor maillist  -  Tutor at python.org
    To unsubscribe or change subscription options:
    https://mail.python.org/mailman/listinfo/tutor
    




More information about the Tutor mailing list