Under construction

Still being built. Things may change

Heroes of Velmar

Time limit1sMemory limit1024 MB

Summary
Given the final cards each player played at three locations, determine whether Player 1, Player 2, or neither wins the battle.
Level

Medium4 of 10

Topics
Implementation, Simulation, Hash map
Solved
No attempts yet

Problem

Welcome to the world of Heroes of Velmar, the critically acclaimed trading card game developed by Sidney Games. After the success of the physical card game, Sidney Games decided to turn it into an immersive video game. For this video game project, Sidney Games is looking for skilled developers like you.

Your task is to write the algorithm that determines the winner of a virtual battle between two players. The video game must keep the core mechanics of the original card game. Players compete over three locations across six turns, and abilities and power levels decide the outcome.

The full rules are listed below. You are given the state of the locations after Setup and Gameplay have finished and the End of the Game has been reached. Your job is to implement the Location Resolution rules, including the application of Special Abilities, to determine the winner.

Input

The input has six lines describing the state of three locations after six turns. There are at most 24 cards in total.

The left location comes first, then the center location, then the right location. Each location is described by two lines. The first line is the cards of player 1, and the second line is the cards of player 2. Each line gives the number of cards, followed by the names of the cards that player played, separated by spaces. Each line has at most four cards.

A player may leave a location empty. Each input is guaranteed to be a valid reachable final game state under the game rules.

Output

Print "Player 1" if player 1 won, "Player 2" if player 2 won, or "Tie" if there was no winner.

Examples3

  1. Example 1

    Input
    3 Shadow Seraphina Ironwood
    2 Voidclaw Voidclaw
    1 Vexia
    0
    1 Ranger
    0
    
    Expected output
    Player 1
    
  2. Example 2

    Input
    1 Guardian
    1 Anvil
    2 Seraphina Seraphina
    1 Ranger
    2 Ironwood Ranger
    1 Guardian
    
    Expected output
    Tie
    
  3. Example 3

    Input
    1 Guardian
    1 Anvil
    2 Seraphina Seraphina
    1 Ranger
    1 Ironwood
    1 Guardian
    
    Expected output
    Player 2