Analysis
Try and create 3 or more key success criteria for your program.
Success Criteria:
Replay Ability (Previous scores, reset game)
User-friendly (Clear instructions, functional time pauses)
Authentication (Are they an authorised player?)
Resolving problems (instances of a draw, similar top scores)
Visual aid (Showing player name, score, rolls, score changes)
Limited functions (Only deduct or add points once, don’t let the score go past 0)
Advanced functions (files, randomisation)
Decomposition
Design
You may like to create a flow chart which will show broadly how your program will work. If so include your flow chart in this section.
You must create pseudocode for a part of your program (minimum of 15 lines)
Pseudocode – Main Body of the game (Without SaveScores function)
START
AuthenList = [testplayer1;password1, testplayer2;password2, testplayer3;password3]
INPUT Player1Username
INPUT Player1Password
IF Player1Username AND Player1Password IN Authenlist:
OUTPUT ‘Authenticated Player’
INPUT Player2Username
INPUT Player2Password
IF Player2Username AND Player1Password IN Authenlist:
IF Player2Username NOT Player1Username:
IF Player2Password NOT Player1Password:
OUTPUT ‘Authenticated Player’
INPUT Commence BY player1
IF Commence = ‘START’:
Player1Score = 0
Player2Score = 0
P1GO()
Roll1 = CHOOSE RANDOM 1-6
Roll2 = CHOOSE RANDOM 1-6
OUTPUT Roll1, Roll2
Score = Roll1 + Roll2
IF Score IS EVEN:
Score = Score + 10
ADD TO Player1Score
IF Score IS ODD:
Score = Score – 5
UNLESS Score = 3
THEN Score = 0
P2GO()
Roll1 = CHOOSE RANDOM 1-6
Roll2 = CHOOSE RANDOM 1-6
OUTPUT Roll1, Roll2
Score = Roll1 + Roll2
IF Score IS EVEN:
Score = Score + 10
IF Score IS ODD:
Score = Score – 5
UNLESS Score = 3
THEN Score = 0
LOOP P1GO AND P2GO (4)
IF Player1Score > Player2Score
OUTPUT Player1 ‘IS THE WINNER
IF Player2Score > Player1Score
OUTPUT Player2 ‘IS THE WINNER’
IF Player1Score = Player2Score:
P1 = CHOOSE RANDOM 1-6
P2 = CHOOSE RANDOM 1-6
IF P1 > P2:
OUTPUT Player1 ‘IS THE WINNER’
IF P2 > P1:
OUTPUT Player2 ‘IS THE WINNER
IF P1 = P2:
RETURN TO Line{IF Player1Score = Player2Score:}
Flowchart – SaveScores
SaveScores Function
Test design
Think of tests that you can carry out to see if your system works
Remember to try and use normal, boundary and erroneous tests.
If you wish to, you may add more tests to the table.
My tests:
Test
What am I testing?
What data will I use?
Normal/Boundary/Erroneous?
Expected Result
1
Element In a list
String
Normal
Authenticates the player
2
“”
“”
Boundary
Doesn’t allow entry as the same person
3
“”
Any
Erroneous
Not allowed entry since it isn’t defined
4
Given input
Integer -> String
Normal
Performs option
5
“”
Out of range integer
Boundary
Terminate with error message
6
“”
String
Erroneous
Terminate with error message
My test screenshots:
Testing
Show you have completed the tests you thought of
Identify if you needed to make changes to your program
Include the screenshots of the tests
My tests:
Test
What am I testing?
Expected result
Pass/Fail
Do I need to change my program?If so, how?
1
Whether or not the SaveScores Function truly write each value properly
Leaves a singular line after each one, minus the last one.
Only just a fail, it just adds an extra unneeded empty line at the bottom of code. Also, position 4 didn’t seem to work
There isn’t really anything I can do, since there is no function the does the opposite to (moving a line down)
2
The occurrence of a tie
Go to tiebreaker, roll 2 separate numbers, then announce winner or reset the program.
Pass, but the player and ‘IS’ is joined together, but this is an easy fix
I need to recheck my string concatenation and make sure there are gaps when needed
3
If my program prints the top 5
Prints the top 5, then returns to selection
Partial fail, it does print out the code
I could use a function, a while or for loop, or, though documented as risky or prone to breaking, execfile()
4
If they give a value option of something that isn’t 1-2
Prints an error message to tell the user to stay within parameters
Pass, and it is useful here since it is only at the start of the coding.
I don’t really need to change this since this is the main starting point, and it functions in a way that works, but may not be the most efficient.
5
If all the colour shortcuts work
Changing the colour of the text
Generally a pass, but the background plays up on the first one
I don’t need to change anything, but I may debug it a little to try to get the background to work.
My test screenshots:
Evaluation
Evaluate how successful your program was. You may find it useful to refer back to your tests
You should reflect on any new skills you have developed
How successful was my program?
My program was relatively successful, however it did have a few flaws, some I could fix, some that I couldn’t work out how to fix. The gameplay is quite user-friendly with visual aids and simplistic controls, and resolves any ties or mistakes, either in a good or a bad way, unfortunately. I can admit it could be more robust and compact within my coding, considering the fact that my defined function ‘SaveScores()’ is around 188 lines long, due to the fact that the pre-defined functions didn’t function how I wanted them to. The main requisites for the game (5 rounds, saved scores, tie-breaker, etc.) have all been met to the best of my current standards, with some alternatives used. All in all, I think my work has the functionality and the basic look of the expected game, but in hindsight could be more compact, especially if I had some better knowledge of more advanced functions (e.g. arrays, 3D lists, importable functions, etc.). Another flaw with my coding is the viewing of the top 5 scores, since the program terminates after showing the scores, and I would put it into the while loop, but that would mean I would have to move all 405 lines over. In this case, I have instead put a warning on the choice, saying that the program will terminate if option 2 is selected as the pathway.
What new skills have I developed?
Apart from these difficulties in how my code needs to function, I have learnt how to manipulate lists using append, sort, reverse, pop, index, and truncate, all within something else I developed an understanding for, that being defining a function. The skills within this that I have made better are random.choice() and arithmetical operations such as and ==. I have also found out how to use colour within my coding to make it look better, and a form of ASCII text
References within My Code
#M, E. and Hall, A. (2018). Finding the index of an item given a list containing it in Python. [online] Stack Overflow. Available at: https://stackoverflow.com/questions/176918/finding-the-index-of-an-item-given-a-list-containing-it-in-python [Accessed 28 Sep. 2018].
#Coleman, J. (2018). Codio – Teach Code. With confidence.. [online] Codio. Available at: https://codio.com/jcoleman1/adventure-game:59afc31bcdcde722208fd273:nToaQAeAGGuj/tree/adventuregame.py [Accessed 28 Sep. 2018]. {previous Controlled Assessment}
#Guru99 (2018). Python File Handling: Create, Open, Append, Read, Write. [online] Guru99.com. Available at: https://www.guru99.com/reading-and-writing-files-in-python.html [Accessed 2 Oct. 2018].
#jozz3 and Gribouillis (2018). Sorting and alligning contents of a text file. [online] DaniWeb. Available at: https://www.daniweb.com/programming/software-development/threads/271141/sorting-and-alligning-contents-of-a-text-file [Accessed 2 Oct. 2018].
#Pocketwarloc, zondo and Seekheart (2018). How do I print certain lines from a text file every time in python. [online] Stack Overflow. Available at: https://stackoverflow.com/questions/35541684/how-do-i-print-certain-lines-from-a-text-file-every-time-in-python [Accessed 3 Oct. 2018].
#Bocui, Salvador Dali, Mezgrman and Avinash Raj (2018). Sorting a text file alphabetically (Python). [online] Stack Overflow. Available at: https://stackoverflow.com/questions/27123125/sorting-a-text-file-alphabetically-python [Accessed 5 Oct. 2018].
#Ctrl S, ondra, Markus and Leeder, D. (2018). How to erase the file contents of text file in Python?. [online] Stack Overflow. Available at: https://stackoverflow.com/questions/2769061/how-to-erase-the-file-contents-of-text-file-in-python [Accessed 19 Oct. 2018]. (Ctrl S et al., 2018) [see attemptatotherroute.py]
#NPE and Community♦ (2018). Fastest way to check if a value exist in a list. [online] Stack Overflow. Available at: https://stackoverflow.com/questions/7571635/fastest-way-to-check-if-a-value-exist-in-a-list [Accessed 19 Oct. 2018]. (NPE and Community♦, 2018) [see attemptatotherroute.py]
#Williams, M. (2015). Add Colour to Text in Python. [online] ozzmaker.com. Available at: http://ozzmaker.com/add-colour-to-text-in-python/ [Accessed 30 Nov. 2018].
#Patorjk.com. (2018). Text to ASCII Art Generator (TAAG). [online] Available at: http://patorjk.com/software/taag/ [Accessed 30 Nov. 2018].
Essay Writing Service Features
Our Experience
No matter how complex your assignment is, we can find the right professional for your specific task. Contact Essay is an essay writing company that hires only the smartest minds to help you with your projects. Our expertise allows us to provide students with high-quality academic writing, editing & proofreading services.Free Features
Free revision policy
$10Free bibliography & reference
$8Free title page
$8Free formatting
$8How Our Essay Writing Service Works
First, you will need to complete an order form. It's not difficult but, in case there is anything you find not to be clear, you may always call us so that we can guide you through it. On the order form, you will need to include some basic information concerning your order: subject, topic, number of pages, etc. We also encourage our clients to upload any relevant information or sources that will help.
Complete the order formOnce we have all the information and instructions that we need, we select the most suitable writer for your assignment. While everything seems to be clear, the writer, who has complete knowledge of the subject, may need clarification from you. It is at that point that you would receive a call or email from us.
Writer’s assignmentAs soon as the writer has finished, it will be delivered both to the website and to your email address so that you will not miss it. If your deadline is close at hand, we will place a call to you to make sure that you receive the paper on time.
Completing the order and download