On Mon, 22 Mar 2010 22:31:58 +0000 laura castañeda <laura_cast...@hotmail.com> wrote:
> > Hi my name is Laura and im currently trying to solve one of the > challenges in the book: "Python Programming, second edition" by Michael > Dawson... I'm stuck in the 5 chapter because of this challenge, im the > kinda person who dont give up so i have to solve this challenge or else > i cant move on its just getting really frustrating and i was wondering > if u can help me with it. Right now im trying to teach my self > programming and i found the book really useful but this challenge is > messing with me haha well is the second challenge at the end of the 5 > chapter i hope its not to much problem for u and i'd really appreciated if u > help me. > > The challenge: "Write a character creator program for a role-playing game. > the player should be given a pool of 30 point to spend on four attributes: > Strength, wisdom, health and Dexterity. The > player should be able to spend points from the pool on any attribute and > should also be able to take points from an attribute and put them back into > the pool." > Thank you so much and please please help me.. this is what im thinking to do > so far maybe we can work with it > > in the interface i want to print "Welcome to C.C." > so print character, be able to change the name, change the strength > (something like Strength:___ would you like to add/sub [+/-]), change health, > change wisdom, change dex, and points remaining...... and in the code i was > thinking to start with a "while loop" .....this is what i have so far and > honestly im stuck i dont now how to start please help me thank you. > > Laura I would just have a dict with entries for each trait. And a func changePointDispatch(trait, number, sign) Sign is here a flag saying more/less. If more, check there is enough in pool, else send error message, remove it and add to the trait. If less,... The loop, as you say, just repetitively asks for a command and calls the func, until a code saying bastà! Maybe you have better ideas. Object-orientation would be nice but seems a bit overkill here (just an opinion). The design side of the problem is to get a practicle & friendly interface to the user. Denis ________________________________ vit esse estrany ☣ spir.wikidot.com _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor