| 689 | } |
| 690 | |
| 691 | void PCfrSolver::findGameSpecificIsomorphisms() { |
| 692 | // hand isomorphisms |
| 693 | vector<Card> board_cards = Card::long2boardCards(this->initial_board_long); |
| 694 | for(int i = 0;i <= 1;i ++){ |
| 695 | vector<PrivateCards>& range = i == 0?this->range1:this->range2; |
| 696 | for(int i_range = 0;i_range < range.size();i_range ++) { |
| 697 | PrivateCards one_range = range[i_range]; |
| 698 | uint32_t range_hash[4]; // four colors, hash of the isomorphisms range + hand combos |
| 699 | for(int i = 0;i < 4;i ++)range_hash[i] = 0; |
| 700 | for (int color = 0; color < 4; color++) { |
| 701 | for (Card one_card:board_cards) { |
| 702 | if (one_card.getCardInt() % 4 == color) { |
| 703 | range_hash[color] = range_hash[color] | (1 << (one_card.getCardInt() / 4)); |
| 704 | } |
| 705 | } |
| 706 | } |
| 707 | for (int color = 0; color < 4; color++) { |
| 708 | for (int one_card_int:{one_range.card1,one_range.card2}) { |
| 709 | if (one_card_int % 4 == color) { |
| 710 | range_hash[color] = range_hash[color] | (1 << (one_card_int / 4 + 16)); |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | // TODO check whethe hash is equal with others |
| 715 | } |
| 716 | } |
| 717 | |
| 718 | // chance node isomorphisms |
| 719 | uint16_t color_hash[4]; |
| 720 | for(int i = 0;i < 4;i ++)color_hash[i] = 0; |
| 721 | for (Card one_card:board_cards) { |
| 722 | int rankind = one_card.getCardInt() % 4; |
| 723 | int suitind = one_card.getCardInt() / 4; |
| 724 | color_hash[rankind] = color_hash[rankind] | (1 << suitind); |
| 725 | } |
| 726 | for(int i = 0;i < 4;i ++){ |
| 727 | this->color_iso_offset[0][i] = 0; |
| 728 | for(int j = 0;j < i;j ++){ |
| 729 | if(color_hash[i] == color_hash[j]){ |
| 730 | this->color_iso_offset[0][i] = j - i; |
| 731 | continue; |
| 732 | } |
| 733 | } |
| 734 | } |
| 735 | for(int deal = 0;deal < this->deck.getCards().size();deal ++) { |
| 736 | uint16_t color_hash[4]; |
| 737 | for(int i = 0;i < 4;i ++)color_hash[i] = 0; |
| 738 | // chance node isomorphisms |
| 739 | for (Card one_card:board_cards) { |
| 740 | int rankind = one_card.getCardInt() % 4; |
| 741 | int suitind = one_card.getCardInt() / 4; |
| 742 | color_hash[rankind] = color_hash[rankind] | (1 << suitind); |
| 743 | } |
| 744 | Card one_card = this->deck.getCards()[deal]; |
| 745 | int rankind = one_card.getCardInt() % 4; |
| 746 | int suitind = one_card.getCardInt() / 4; |
| 747 | color_hash[rankind] = color_hash[rankind] | (1 << suitind); |
| 748 | for (int i = 0; i < 4; i++) { |
no test coverage detected