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 8230111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:01:55+00:00 2026-06-07T17:01:55+00:00

I am building a Rock Paper Scissors game and I am trying to implement

  • 0

I am building a Rock Paper Scissors game and I am trying to implement a system where there will never be a tie. My current system is

if (userSelection == 0)
    computerPick =[self computerGenerateResponce];
    if (computerPick == 0)
        while (computerPick == 0)
            computerPick = [self computerGenerateResponce];

Is there a better way to implement this system? This works, but seems a little bit clunky.

  • 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-06-07T17:01:56+00:00Added an answer on June 7, 2026 at 5:01 pm

    At a minimum, you can eliminate the if(computerPick == 0) level, since that is the first thing that while(computerPick == 0) does. This will not affect your algorithm at all. Then, you can probably consolidate the call into the condition check, and further, you can just use implicit boolean casting:

    if (!userSelection)
        while(! (computerPick = [self computerGenerateResponce]))
    

    This will essentially just keep assigning a new pick to computerPick until it is not zero.

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

Sidebar

Related Questions

I'm building a small game - rock paper scissors. I have a prototype -
Building an inventory system. I have lots of products and each product has three
Building an iPhone OS application that will allow users to anonymously post information to
Im building a ruby on rails aplication, and trying to get my TDD on.
I am trying to integrate pages from a site I am building into the
I am building a batch processing system. Batches of Units come in quantities from
Building a rails B2B application that will have various users. I'm pretty clear on
Building on this question , is there a simple solution for having a multi-key
Building an ASP.NET MVC3 application at work and I'm trying to use a program
Building a GUI system and I have a few classes for different GUI components

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.