Search:

Type: Posts; User: pjharris

Search: Search took 0.00 seconds.

  1. Replies
    3
    Views
    1,255

    see thats what I thought. But then I did this in...

    see thats what I thought. But then I did this in the public function bet_or_pass() in the class Player before I posted:

    high_bidder = this;

    and got this compile error:

    game.cpp: In member...
  2. Replies
    3
    Views
    1,255

    Class question

    This is a call I have to a function in a class. Where player[0] is an instance of that class and bet_or_pass() is a public function in that class.

    players[0].bet_or_pass();

    So how would I set...
  3. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    I tried something exactly like that example that...

    I tried something exactly like that example that Salem had me try and it worked fine.
  4. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Yeah but thats what I did I the code that I...

    Yeah but thats what I did I the code that I posted and it doesnt work.
  5. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Thats what the sleep does. Sleep 2 says wait two...

    Thats what the sleep does. Sleep 2 says wait two seconds then run it again And it's not the case about timing, because I ran it 10, 30, 60 mins after and I still got the same. I've been getting...
  6. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    #include #include ...

    #include <iostream>
    #include <algorithm> //random_shuffle()
    #include <ctime> //time()
    #include <cstdlib> //srand()
    using namespace std;

    int main() {
    srand(time(0));
    int arr[] =...
  7. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Salem your example works fine for me. It must be...

    Salem your example works fine for me. It must be random_shuffle() then.
  8. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    I don't know whats going on, I'm sure the example...

    I don't know whats going on, I'm sure the example works as it's suppose to. time() is working fine. I even tried it on another machine. It seems to me that srand() is not working seeing as I get...
  9. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    How would you like me to do that? Copy and paste?...

    How would you like me to do that? Copy and paste? But then you could just say I copied it twice.

    Salem:
    I will investigate it to see if thats the case.
  10. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Don't try and insult me by saying I can't read. ...

    Don't try and insult me by saying I can't read. Granted I didn't type it correctly in my previous post, but in the code its right. I copied it straight from what he put.
  11. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    well with the way he uses srand(0) what part of...

    well with the way he uses srand(0) what part of time is being used?. And the way I did it was:
    $./a.out
    $./a.out

    and I did that 10 times and it was the same set of numbers. And I just did it...
  12. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    That is all good and dandy. But I just ran your...

    That is all good and dandy. But I just ran your example and I got the same set of numbers each time a ran it, which was like 10 times. So, that basically convinced me not to use it unless someone...
  13. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    This is true laserlight. I have learn the...

    This is true laserlight. I have learn the valuable lesson of keeping things in the smallest scope possible and when I do loops make sure I reset things that need to be reset.
  14. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Yeah I think I'll give it a try but I am still...

    Yeah I think I'll give it a try but I am still undecided about which I want to use. I might use random_shuffle, but it's so hard to just throw away that code I worked on for hours.
  15. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Yeah I was thinking about going with...

    Yeah I was thinking about going with random_shuffle when I found out about it, even tried to use it as you saw in my code(all the other code was commented out when I tried), but that seemed harder...
  16. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    I do allow for the variance in my code. Look at...

    I do allow for the variance in my code. Look at my explination of what I wanted it to do when i first posted. Then look at the code. I use rand() to get a number between 1-4, then use that number...
  17. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    How would a dynamic array or vector be better for...

    How would a dynamic array or vector be better for what I am doing? I guess because it isn't legal in C++ and I am using g++ as my compiler. So, I guess I don't understand the reason given. So,...
  18. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    I get it. But like I said with the shuffle that...

    I get it. But like I said with the shuffle that I saw, and for the type of game that I am making it for(not poker or blackjack or any other casino card game game) the shuffle seemed a little off. I...
  19. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Thank you Daved, my shuffle works now. It was...

    Thank you Daved, my shuffle works now. It was all about the indices to my arrays and resetting j in the loop. Your help is much appreciated.
  20. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Simmer down there buddy. I was wrong. It does...

    Simmer down there buddy. I was wrong. It does shuffle. I just didn't see it because of the way it was written with everything on three lines.
  21. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    I dont want to have to deal with getting...

    I dont want to have to deal with getting duplicate cards in the deck. And I am trying to get a more realistic type of shuffle, seeing as I have seen some programs deal really weird when it comes to...
  22. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    The random_shuffle was an attempt to do the...

    The random_shuffle was an attempt to do the shuffling a different way. But that didn't work because the array I pass isnt of type RandomAccessIterator or something. So just disregard that.

    The...
  23. Thread: Deck Shuffle

    by pjharris
    Replies
    51
    Views
    8,701

    Deck Shuffle

    What I want to do is shuffle the cards like a person does. Split the deck roughly in half, then shuffle the two halves together from the bottom up by alternating between the havles and placing 1-4...
Results 1 to 23 of 23