Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "poker.h"
- PokerHand::PokerHand(std::string pHand) : hand(pHand) {}
- int PokerHand::compareWith(PokerHand &pOpponent) {
- // code
- return 0;
- }
- ```c
- PokerHand hand("KS 2H 5C JD TD");
- ```
- ```c
- int PokerHand::compareWith(PokerHand &pOpponent) {
- //code
- return 0;
- }
- ```
- The characteristics of the string of cards are:
- * A space is used as card seperator
- * Each card consists of two characters
- * 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)
- * The second character represents the suit, valid characters are: `S`(pades), `H`(earts), `D`(iamonds), `C`(lubs)
- The result of your poker hand compare can be one of the 3 options:
- * 0 for a TIE
- * 1 for a WIN
- * 2 for a LOSS
- //Tests.cpp
- #include <cassert>
- #include <iostream>
- #include "poker.h"
- void testCaseOne() {
- PokerHand hand("TD 9S QS QH TH");
- PokerHand opponent("5D 5S QC 9H QH");
- assert(hand.compareWith(opponent)==1);
- }
- int main (int argc, char *argv[]) {
- testCaseOne();
- std::cout << "All tests passed" << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement