Bit of Help please :X

Hey ppl doing controlled assesment Computing got this task where I have to do this but the problem is actually storing it how will I do it ,I know f.write(..."r+") but I am not sure it what way i need to store strength,luck,agility,skill THX (copy+paste python)

Thanks Alot

Thanks for helping me but can you just put it with my whole code so it flow nicly and it will be easier because I don't where to put it and how and it need to flow in a loop unless you don't want to continue.

Comments on this post

2 major issues with your code

There's the problem of your question. How do I store the character's "stats"? The related questions, of which you don't seem aware, may be important too. "Why would I want to store the `stats'?", "How can I recover them?". My class constructor addresses this issue. If the character file doesn't exist, it calls your repeat function to generate initial values and interact with the player. And then it writes the data to the file. If the character file does exist the constructor loads the data.

The other egregious problem of your 4 times duplicated code should earn you a C on the exercise*. I wrote a replacement function of two arguments to handle each case independently. I didn't bother to post it because well, when you don't have something nice to say, say nothing.

* The grade is C. Cannot fail because the program (as I recall) worked. Cannot give D because there might be non-working programs with some good features. We need room for these cases. Cannot go higher than C.

Had you written a function for your copy and pasted long expression then you would need to change your program in only one place upon discovering you'd put the closing parenthesis to "trunc" in the wrong place.

Thanks Alot still got lots of work to do

Ok I start from the beginning Hello,my name is Mirko I am doing a GCSE computing task there is task 1,2 and 3 here are the specification.I will update my work on as I get it finished and if you will be kind(you don't have to)you can help me to imporve it P.S This must be dead easy stuff for you.

TASK 1

A game uses dice with 4, 6 and 12 sides to determine various outcomes.
Design, code and test a program that will simulate throwing dice with these numbers of sides.
The user should be able to input which dice is being thrown, eg 4, 6 or 12.
The program should output the dice chosen and the score, for example ‘6 sided dice thrown, score 4’
The user should be able to repeat this process as many times as required.

TASK 2
When determining certain characteristics of a game character the numbers on a combination of dice are used to calculate certain attributes.
Two of these attributes are strength and skill.
At the start of the game, when the characters are created, a 4 sided dice and a 12 sided dice are thrown to determine values for each of these attributes using the following method for each character:
• Each attribute is initially set to 10.
• The score on the 12 sided dice is divided by the score on the 4 sided dice and rounded down.
• This value is added to the initial value.
This process is repeated for each attribute for each character.
Describe this process using a suitable algorithm.
Write and test the code to determine these two attributes for a character and store the sample data for two characters, including suitable names, in a file.

TASK 3
Two of these attributes are strength and skill.
At the start of the game, when the characters are created, a 4 sided dice and a 12 sided dice are thrown to determine values for each of these attributes using the following method for each character:
• Each attribute is initially set to 10.
• The score on the 12 sided dice is divided by the score on the 4 sided dice and rounded down.
• This value is added to the initial value.
This process is repeated for each attribute for each character.
Describe this process using a suitable algorithm.
Write and test the code to determine these two attributes for a character and store the sample data for two characters, including suitable names, in a file.

I am really woried about task 2 and 3 loosing mark on efficient section.If help me you will change MY LIFE CAUSE Depent of this.I am not asking you but I would really apriciate if you refine section 2 and 3 so good so its a decent grade you help me a lot anyway sorry about being so anoying THANK YOU FOR EVERYTHING COMING STRAINGHT FROM MY HEART

Hey bit of help(lol,not again)

B-

I can't grade your program lower than C. It works, mostly. Spelling errors include:
gratest, reconised, apointed.
Many global variables, no use of argument passing through function interfaces.
Because it's written recursively I can make it crash by feeding it enough lines containing x

Code:

$ yes x | python mirko.py
Hello and welcome to Mirko's Gladiatoral arena fight
There was once a legendary Fighter He was summoned to Mirko's Great arena.
He was about to prove himself by to be the gratest of all.
Please enter the name of your legendary fighter:Please enter the strength of x(must 1M or below):Fighter strength must be a whole number.
Please enter the strength of x(must 1M or below):Fighter strength must be a whole number.
Please enter the strength of x(must 1M or below):Fighter strength must be a whole number.
Please enter the strength of x(must 1M or below):Fighter strength must be a whole number.
Please enter the strength of x(must 1M or below):Fighter strength must be a whole number.
...
RuntimeError: maximum recursion depth exceeded
yes: standard output: Broken pipe
yes: write error

Still, I or others anyway can imagine other "working programs" that are much worse. I'll start with B-, thinking that you're likely to move to a higher grade based on the performance of the rest of the class.

As a new member, you probably missed part of the Forum Introduction and Rules, so I'll explain something important to you. For future note, what you need to do in order to get the code to remain formatted correctly is to put the code samples in [CODE] or [highlight] tags, like so:

[code]
this is an example
of indented code.
[/code]

Which will render like this:

Code:

this is an example
of indented code.

You can use the '#' or highlight marker buttons at the top of the editing window to automatically insert the code into the text for you.

A favour?

You got any email I just send you my code I don't want people to copy mine .I am nearly done just need some few guidance to top the grade.I am very gratefull of your help and a apriciate it a lot even if it just look like some text.it won't let me private message you.I am forever grateful for that. I will always remember everything you told me. It helped me a lot.