Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question
100%

Write a python code of this problem

  • Problem Statement

Assume that there are two teams and they are team attacker and team defender.  Therefore, at a state of the game one agent in  each team is left alive respectively. Here, the defender is given a lifeline called HP which will be assigned randomly. Furthermore, the attacker agent  will try to give maximum negative HP to the defender agent to decrease his(d) chances of survival in the game. On the other hand, the defender agent will try to protect himself by receiving the lowest negative HP possible from the attacker agent. Furthermore, the attacker can have a choice from a number of bullets from his gun and the optimal moves will cost a certain maximum negative HP (chosen from randomly assigned values within the range of minimum and maximum negative HP). Here, are the following things you need to do using Alpha-Beta Pruning algorithm:

  • Sample Input 1:
  1. Enter your student id:

 

17301106

 

  1. Minimum and Maximum value for the range of negative HP:

 

1 30

 

Note: Here, the second input is a space separated single line input string.

 

  • Sample Input 1 Explanation:

Ex. 1 (17301106)

(Use 1st digit of your bracu student id)

# Number of turns for the attacker agent

[Assume that both of them will get equal number of chances]

Ex. 60 (17301106)

(Use last 2 digits of your bracu student id in reverse)

# Initial lifeline (HP) for the defender at initial state of the game

Ex. 3 (17301106)

(Use semester code-3rd digit of your bracu student id)

# Number of bullets from which the final choice has to be made by the attacker.

Ex. 1 (1 30)

# Minimum value for the range of negative HP values

Ex. 30 (1 30)

# Maximum value for the range of negative HP values

 

  • Sample Output 1:
  1. Depth and Branches ratio is 2:3
  2. Terminal States (leaf node values) are 19,22,9,2,26,16,16,27,16.
  3. Left life(HP) of the defender after maximum damage caused by the attacker is 44
  4. After Alpha-Beta Pruning Leaf Node Comparisons 7

 

 

  • Sample Output 1 Explanation:

(Application of Alpha-Beta Pruning Algorithm)

MAX            - Level 0                Attacker’s Turn / Initial Start                     MAX utility/Best Choice

 

MIN             - Level 1                   Defender’s Turn                                        3 branches

 

Leaf Nodes  - Level 2                         Terminal state                                       3^2=9 Leaf Nodes(Random States)

                                                               [19, 22, 9, 2, 26, 16, 16, 27, 16]

 

(Left lifeline/HP)

Left Life = (60 - 16) = 44

So, Left life(HP) of the defender after maximum damage caused by the attacker is 44

 

Hint:

  1. Apply Alpha-Beta Pruning algorithm for sample output line 3 and line 4
  2. Formula: Left life HP=Initial life HP-MAX negative HP

Note: 

Terminal nodes are randomly generated values within the given range of negative HP (sample output line 2).

 

  • Sample Input 2:
  1. Enter your student id:

 

20201003

 

  1. Minimum and Maximum value for the range of negative HP:

 

5 20

 

  • Sample Output 2:
  1. Depth and Branches ratio is 4:2
  2. Terminal States(Leaf Nodes) are 18,13,5,12,10,5,13,7,17,8,6,8,5,11,13,18.
  3. Left life(HP) of the defender after maximum damage caused by the attacker is 22
  4. After Alpha-Beta Pruning Leaf Node Comparisons 13

 

 

 
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY