Question: In this task you will be writing a function validate _ comprpg _ actions ( game , actions, player _ id ) . game is
In this task you will be writing a function validatecomprpgactionsgame actions, playerid
game is the Game object that stores the state of the game
actions is a list of actions representing the chosen action for each active character from a single player
playerid is the int of the current player
Your function should return a bool indicating whether the actions are valid in the context of the current game. That is it should return True if all requirements for being a valid action are met and False if there is a requirement that has not been met.
Your function should validate that:
When the turn is greater than :
actions is a list.
actions has an appropriate number of actions not exceeding the number of the player's active characters, can be fewer
Each action is a tuple, with a valid action type and is of the appropriate length for that action type.
Each action is of the correct format including types, length, and values see Action Format
Each action follows the rules for actions of that type see What make an action valid
That the combination of those actions is valid eg not using the same item twice when the player only has one of that item, not attempting to have both active characters swap to the same character
Each action is performed by one of the characters who is active at the start of the turn, and at most one action may be performed by each character.
The total cost of electricity for the actions must be less than or equal to the players available electricity.
You may assume your validation function will be only tested on turns greater than
game GamePlayername: 'Java Judger', 'health': 'defence': 'effects': 'defeated': Falsename: 'Python Pal', 'health': 'defence': 'effects': 'defeated': Truename: 'Haskell Heroine', 'health': 'defence': 'effects': 'defeated': Falsename: 'Binary Bot', 'health': 'defence': 'effects': 'defeated': Falsename: HTML Hero', 'health': 'defence': 'effects': 'defeated': FalseJava Judger' Playername: 'Python Pal', 'health': 'defence': 'effects': 'defeated': Falsename: C Charmer', 'health': 'defence': 'effects': 'defeated': Falsename: 'Linux Legend', 'health': 'defence': 'effects': 'defeated': Falsename: 'Binary Bot', 'health': 'defence': 'effects': 'defeated': Falsename: 'Network Ninja', 'health': 'defence': 'effects': 'defeated': TruePython Pal'Haskell Heroine', 'defend', 'Recursion Rebuff', Python Pal', 'item', 'Screen Repair Kit'Linux Legend', 'attack', 'Root Reckoning', Haskell Heroine', 'Python Pal'Binary Bot', 'item', 'Debugging Tool'Haskell Heroine', 'attack', 'Lambda Lunge', Linux Legend'Python Pal', 'item', 'RAM Boost'Linux Legend', 'attack', 'Kernel Kick', Python Pal'Binary Bot', 'swap', 'Network Ninja'Haskell Heroine', 'swap', 'Java Judger'Linux Legend', 'defend', 'Firewall', Network Ninja', 'attack', 'DDoS', Python Pal'Java Judger', 'swap', HTML Hero'Linux Legend', 'defend', 'Firewall', Network Ninja', 'attack', 'DDoS', HTML Hero'HTML Hero', 'attack', CSS Crusade', Linux Legend'Python Pal', 'attack', 'Indentation Impact', Network Ninja'Linux Legend', 'defend', 'Firewall', Network Ninja', 'attack', 'DDoS', Python Pal'HTML Hero', 'attack', 'Entity Eruption', Linux Legend', 'Network Ninja'Python Pal', 'swap', 'Java Judger'Linux Legend', 'defend', 'Firewall', Network Ninja', 'attack', 'Packet Sniffer', HTML Hero', 'Java Judger'HTML Hero', 'attack', 'Entity Eruption', Linux Legend', 'Network Ninja'Java Judger', 'swap', 'Binary Bot'Linux Legend', 'swap', 'Python Pal'HTML Hero', 'attack', CSS Crusade', Network Ninja'Binary Bot', 'swap', 'Python Pal'Python Pal', 'defend', 'Tryexcept Tactics', Network Ninja', 'attack', 'Code Injection', Python Pal'HTML Hero', 'swap', 'Java Judger'Python Pal', 'attack', 'Syntax Strike', Python Pal'Network Ninja', 'swap', C Charmer'Java Judger', 'swap', 'Haskell Heroine'Python Pal', 'defend', 'Tryexcept Tactics', C Charmer', 'attack', 'Pointer Pinch', Haskell Heroine', 'Python Pal'Haskell Heroine', 'swap', HTML Hero'Python Pal', 'attack', 'Syntax Strike', HTML Hero'C Charmer', 'swap', 'Linux Legend'HTML Hero', 'defend', 'Firewall', Python Pal', 'defen
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
