input: Write a function to simulate a card matching game as described in the code snippet.
  assert len(card_matching_game()) == 8 or len(card_matching_game()) == 0
  assert isinstance(card_matching_game(), set)
output: def card_matching_game():
      import random
      card_deck = list(range(1, 9)) * 2
      random.shuffle(card_deck)
      
      matched_cards = set()
      for i in range(0, len(card_deck), 2):
          if card_deck[i] == card_deck[i+1]:
              matched_cards.add(card_deck[i])
      
      return matched_cards