Computer Science Dice Game

 Analysis
Try and create 3 or more key success criteria for your program.
Success Criteria:

Don't use plagiarized sources. Get Your Custom Essay on
Computer Science Dice Game
Just from $13/Page
Order Essay

               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].

 

What Will You Get?

We provide professional writing services to help you score straight A’s by submitting custom written assignments that mirror your guidelines.

Premium Quality

Get result-oriented writing and never worry about grades anymore. We follow the highest quality standards to make sure that you get perfect assignments.

Experienced Writers

Our writers have experience in dealing with papers of every educational level. You can surely rely on the expertise of our qualified professionals.

On-Time Delivery

Your deadline is our threshold for success and we take it very seriously. We make sure you receive your papers before your predefined time.

24/7 Customer Support

Someone from our customer support team is always here to respond to your questions. So, hit us up if you have got any ambiguity or concern.

Complete Confidentiality

Sit back and relax while we help you out with writing your papers. We have an ultimate policy for keeping your personal and order-related details a secret.

Authentic Sources

We assure you that your document will be thoroughly checked for plagiarism and grammatical errors as we use highly authentic and licit sources.

Moneyback Guarantee

Still reluctant about placing an order? Our 100% Moneyback Guarantee backs you up on rare occasions where you aren’t satisfied with the writing.

Order Tracking

You don’t have to wait for an update for hours; you can track the progress of your order any time you want. We share the status after each step.

image

Areas of Expertise

Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.

Areas of Expertise

Although you can leverage our expertise for any writing task, we have a knack for creating flawless papers for the following document types.

image

Trusted Partner of 9650+ Students for Writing

From brainstorming your paper's outline to perfecting its grammar, we perform every step carefully to make your paper worthy of A grade.

Preferred Writer

Hire your preferred writer anytime. Simply specify if you want your preferred expert to write your paper and we’ll make that happen.

Grammar Check Report

Get an elaborate and authentic grammar check report with your work to have the grammar goodness sealed in your document.

One Page Summary

You can purchase this feature if you want our writers to sum up your paper in the form of a concise and well-articulated summary.

Plagiarism Report

You don’t have to worry about plagiarism anymore. Get a plagiarism report to certify the uniqueness of your work.

Free Features $66FREE

  • Most Qualified Writer $10FREE
  • Plagiarism Scan Report $10FREE
  • Unlimited Revisions $08FREE
  • Paper Formatting $05FREE
  • Cover Page $05FREE
  • Referencing & Bibliography $10FREE
  • Dedicated User Area $08FREE
  • 24/7 Order Tracking $05FREE
  • Periodic Email Alerts $05FREE
image

Our Services

Join us for the best experience while seeking writing assistance in your college life. A good grade is all you need to boost up your academic excellence and we are all about it.

  • On-time Delivery
  • 24/7 Order Tracking
  • Access to Authentic Sources
Academic Writing

We create perfect papers according to the guidelines.

Professional Editing

We seamlessly edit out errors from your papers.

Thorough Proofreading

We thoroughly read your final draft to identify errors.

image

Delegate Your Challenging Writing Tasks to Experienced Professionals

Work with ultimate peace of mind because we ensure that your academic work is our responsibility and your grades are a top concern for us!

Check Out Our Sample Work

Dedication. Quality. Commitment. Punctuality

Categories
All samples
Essay (any type)
Essay (any type)
The Value of a Nursing Degree
Undergrad. (yrs 3-4)
Nursing
2
View this sample

It May Not Be Much, but It’s Honest Work!

Here is what we have achieved so far. These numbers are evidence that we go the extra mile to make your college journey successful.

0+

Happy Clients

0+

Words Written This Week

0+

Ongoing Orders

0%

Customer Satisfaction Rate
image

Process as Fine as Brewed Coffee

We have the most intuitive and minimalistic process so that you can easily place an order. Just follow a few steps to unlock success.

See How We Helped 9000+ Students Achieve Success

image

We Analyze Your Problem and Offer Customized Writing

We understand your guidelines first before delivering any writing service. You can discuss your writing needs and we will have them evaluated by our dedicated team.

  • Clear elicitation of your requirements.
  • Customized writing as per your needs.

We Mirror Your Guidelines to Deliver Quality Services

We write your papers in a standardized way. We complete your work in such a way that it turns out to be a perfect description of your guidelines.

  • Proactive analysis of your writing.
  • Active communication to understand requirements.
image
image

We Handle Your Writing Tasks to Ensure Excellent Grades

We promise you excellent grades and academic excellence that you always longed for. Our writers stay in touch with you via email.

  • Thorough research and analysis for every order.
  • Deliverance of reliable writing service to improve your grades.
Place an Order Start Chat Now
image

Order your essay today and save 30% with the discount code Happy