Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input){
- let n = input.shift();
- //let command = input.shift();
- let obj = {};
- for (let i = 0; i < n; i++) {
- const line = input[i];
- let arr = line.split(' ');
- let [heroe, hp, mp] = arr;
- obj[heroe] = [hp, mp];
- input.shift();
- }
- //console.log(obj);
- let command = input.shift();
- while(command !== 'End'){
- let arr = command.split(' - ');
- let com = arr[0];
- let heroe = arr[1];
- console.log(obj[heroe]);
- if(com === 'CastSpell'){
- // if(obj[heroe]){
- // }else{
- // }
- }else if(com === 'TakeDamage'){
- }else if(com === 'Recharge'){
- }else if(com === 'Heal'){
- // if(obj[heroe]){
- // }else{
- // }
- }
- //console.log(arr);
- command = input.shift();
- }
- }
- solve([
- '2',
- 'Solmyr 85 120',
- 'Kyrre 99 50',
- 'Heal - Solmyr - 10',
- 'Recharge - Solmyr - 50',
- 'TakeDamage - Kyrre - 66 - Orc',
- 'CastSpell - Kyrre - 15 - ViewEarth',
- 'End'
- ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement