Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3681452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:41:25+00:00 2026-05-19T03:41:25+00:00

How would I go about pseudocoding the algorithm for a method that: Rolls a

  • 0

How would I go about pseudocoding the algorithm for a method that:

  • Rolls a type of Die – 4 , 6 , 8 , 10 , or 12 sided

  • Can roll up to ten of this type of Die

  • If more than half of the die are 1’s, print them a message that they bust and end the program

  • If any of the die are equal to the type of die rolled, take the highest value from the group. As well as re-roll the die that equaled the value of the type of die rolled.

    ^^^^I.E. – Let’s say you have 3 six sided die, you roll them and you get a 4, 2 and 6. You take the value of 6, since it is the highest. Then you re-roll the die that was a six. If you get a six you add that six to the previous six AND re-roll. If not you just add the highest die there to the previous value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T03:41:26+00:00Added an answer on May 19, 2026 at 3:41 am

    I think your question points to the reason you are finding this difficult. You are trying to solve too much in one place and that becomes overwhelming. You don’t want to create a single method to do that. You will want to create several. Start by decomposing the problem into it’s constituent parts.

    Note: I’m not approaching this in an OO fashion to make the answer a bit easier to parse. I would encourage you to think about the design in more detail.

    Requirement 1: Rolls a type of Die – 4 , 6 , 8 , 10 , or 12 sided

    Ok – so we need some method similar to:

    int Roll(int sides);

    Basically Roll just returns a random value between 1 and sides (inclusive).

    Requirement 2: Can roll up to ten of this type of Die

    This would likely be a for loop.

    Requirement 3: If more than half of the die are 1’s, print them a message that they bust and end the program

    This requirement implies that you are storing the results of each call to Roll in a collection – e.g., a List or an int[] (array of integers).

    Next it says that you are iterating over that collection and counting the number of rolls that are “1”. If count is greater than half the total number of rolls than you end the program. Counting is easy (for loop or foreach would probably be your best bet) and you know how many rolls were made (both by the number of items in the collection and because you had a counter on your for loop when the rolls were made … so divide and compare.

    Requirement 4: If any of the die are equal to the type of die rolled, take the highest value from the group. As well as re-roll the die that equaled the value of the type of die rolled.

    Again – you need to iterate over the result set and perform the operation request. I would not attempt to “optimize” your solution by combining this rule with the previous rule – it will just convolute the solution for no real benefit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just wondering how people would go about this. Say I have one class that
How would you go about proving that two queries are functionally equivalent, eg they
Generally I would go about this by placing something(s) unique and random in the
Any ideas how I would go about writing a javascript method to insert an
Just a quick question about how you would go about implementing this. I want
I would like to know how I would go about altering the HTML that
I was just wondering how someone would go about finding all the applications that
I'm wonder how you would go about and create a shape similar to this
How would go about writing proper unit testing (and integration testing for that matter)
I just wondering if anyone can explain to me how I would go about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.