xclite's Profile User Rating: -----

Reputation: 956 Master
Group:
Moderators
Active Posts:
3,355 (1.52 per day)
Joined:
12-May 09
Profile Views:
66,595
Last Active:
User is online 3 minutes ago
Currently:
Viewing Topic: I am getting an error message wh...

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
50
Expert In:
Ruby, Java

Latest Visitors

Icon   xclite has set their status.

Posts I've Made

  1. In Topic: I am getting an error message when I try to run Spring Project

    Posted 26 May 2015

    Do you by any chance have the source code that is literally referred to by the stack trace?
    ie/cit/caf/GroupProjectApplication.java
  2. In Topic: I am having trouble trying to download ffmpeg?

    Posted 24 May 2015

    Please don't open multiple threads on the same topic.

    Discussion should take place here: http://www.dreaminco...k-it-up-to-php/
  3. In Topic: Mastermind Program Errors

    Posted 24 May 2015

    Right. So does this experiment tell you more about what you need to do? You need to put more logic around how you calculate these two counts.

    Why do you try to do this in two different loops? You could get more accurate by doing it in one:

    0.upto(guess.length) do |index|
      if answer[index] == guess[index]
        positionCorrect++
      else if answer.contains(guess[index])
        colorCorrect++
      end
    end
    
    


    Takes care of the fact that the variables aren't wholly independent, for example.
  4. In Topic: Mastermind Program Errors

    Posted 24 May 2015

    That's not what I meant.

    For #1, I mean after the loop, adjust your correctColor value by subtracting the correctPosition value from it.
  5. In Topic: Mastermind Program Errors

    Posted 24 May 2015

    Thanks, that sample output is immensely helpful.

    So I think you've actually encoded your partial guesses differently than you specified it. Here, you say that the second number should be the number of partial guesses.

    Your code, however, calculates for the number the number of characters which appear in both the guess and the answer, regardless of position and separate from the number that are totally correct.

    I could see two approaches working out here:

    1) You could probably subtract the number of items that were totally correct from the number that were partially correct to get the actual number that were partially correct.
    2) You could also condense your for loops into one, and do a more elaborate if statement to decide which number to increment.

My Information

Member Title:
I wrote you an code
Age:
26 years old
Birthday:
June 23, 1988
Gender:
Location:
Boston, MA
Forum Leader:
Ruby
Years Programming:
11
Programming Languages:
Known: Ruby, Java, Javascript
Learning: Clojure
Professionally interested in: Elm, Scala|OCaml|Haskell, Rust, Ceylon
Academically interested in: Prolog, Erlang, Forth, Idris, Smalltalk
Abandoned: C, C++, Pascal, BASIC

Contact Information

E-mail:
Click here to e-mail me
Facebook:
http://facebook.com/brian.fults
Twitter:
xclite

Comments

Page 1 of 1
  1. Photo

    jon.kiparsky Icon

    28 Jan 2013 - 08:10
    http://www.anythingcomic.com/comics/1662781/clingy/
  2. Photo

    gabehabe Icon

    05 Dec 2012 - 16:46
    LUBE IS GOOD, OTHERWISE YOUR BUM WOULD BE SORE FOR WEEKS <3
  3. Photo

    gabehabe Icon

    03 Dec 2012 - 02:55
    YOU HAVE BEER?! I'M ON MY WAY!
  4. Photo

    gabehabe Icon

    20 Dec 2011 - 09:05
    don't forget the fondue!
  5. Photo

    gabehabe Icon

    20 Dec 2011 - 09:02
    my wanting to be in you goes without saying, i just want to be on top.
  6. Photo

    gabehabe Icon

    20 Dec 2011 - 08:29
    i... i want to be on you
  7. Photo

    hulla Icon

    02 Sep 2011 - 07:37
    Dammit I was planning on using "Like A Boss" for my member title before I saw your avatar :s
  8. Photo

    ishkabible Icon

    12 Apr 2011 - 08:41
    its actually Yiddish, my grandfather called my dad a 'ishkabible' every time he did some stupid, now my dad calls me the same thing. supposedly it means confused.
  9. Photo

    ishkabible Icon

    11 Apr 2011 - 20:15
    your name always makes me think of x-lax when i read it. not the most pleasant thing to think about :(
  10. Photo

    Raynes Icon

    01 Apr 2011 - 08:35
    At some point, sure. At this point, I don't have enough time to do much of anything except for Clojure.
  11. Photo

    gabehabe Icon

    08 Dec 2010 - 14:26
    SECKS TIEM! <3
  12. Photo

    gabehabe Icon

    17 Jun 2010 - 07:33
    U WANT 2 SECKS?
  13. Photo

    gabehabe Icon

    17 Jun 2010 - 06:44
    I WONDERED IF YOU WERE HORNY.
  14. Photo

    gabehabe Icon

    01 Jun 2010 - 11:56
    It's going well, m'luvly. How's life? xx
  15. Photo

    gabehabe Icon

    01 Jun 2010 - 11:30
    Hey schmecksy.
Page 1 of 1