Question: write a function called calculate _ comprpg _ stats ( history , filename ) that takes the history and a string filename and calculates some
write a function called calculatecomprpgstatshistory filename that takes the history and a string filename and calculates some statistics on the actions played in the game.
Your function should calculate the number of attacks, defends, items, swaps, attempted damage, attempted protection, electricity used, and turns taken for each player based on game history and save this in csv format to the specified file name.
You may assume that the actions are formatted correctly and are the correct length for their action type.
Example :
history 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'
calculatecomprpgstatshistory "examplegamestats.csv
Should produce the file:
player,attacks,defends,items,swaps,attempted damage,attempted protection,electricity used,turns taken
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
