Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #include <iostream>
  2. #include "poker.h"
  3.  
  4.  
  5. PokerHand::PokerHand(std::string pHand) : hand(pHand) {}
  6.  
  7. int PokerHand::compareWith(PokerHand &pOpponent) {
  8. // code
  9.  
  10. return 0;
  11. }
  12.  
  13. ```c
  14. PokerHand hand("KS 2H 5C JD TD");
  15. ```
  16.  
  17. ```c
  18. int PokerHand::compareWith(PokerHand &pOpponent) {
  19. //code
  20.  
  21. return 0;
  22. }
  23. ```
  24.  
  25. The characteristics of the string of cards are:
  26. * A space is used as card seperator
  27. * Each card consists of two characters
  28. * The first character is the value of the card, valid characters are: `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `T`(en), `J`(ack), `Q`(ueen), `K`(ing), `A`(ce)
  29. * The second character represents the suit, valid characters are: `S`(pades), `H`(earts), `D`(iamonds), `C`(lubs)
  30.  
  31. The result of your poker hand compare can be one of the 3 options:
  32. * 0 for a TIE
  33. * 1 for a WIN
  34. * 2 for a LOSS
  35.  
  36.  
  37. //Tests.cpp
  38. #include <cassert>
  39. #include <iostream>
  40.  
  41. #include "poker.h"
  42.  
  43. void testCaseOne() {
  44. PokerHand hand("TD 9S QS QH TH");
  45. PokerHand opponent("5D 5S QC 9H QH");
  46. assert(hand.compareWith(opponent)==1);
  47. }
  48.  
  49. int main (int argc, char *argv[]) {
  50.  
  51. testCaseOne();
  52.  
  53. std::cout << "All tests passed" << std::endl;
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement