Skip to content

Commit

Permalink
#18
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn authored Jun 15, 2020
1 parent 392e413 commit 2e72697
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Applets/games-codecombat-dungeon-master-of-names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# https://codecombat.com/play/level/master-of-names?

# Your hero doesn't know the names of these enemies!
# Use the findNearestEnemy method on your new glasses.

# Assign the result of hero.findNearestEnemy() to the variable enemy1:
enemy1 = hero.findNearestEnemy()
# enemy1 now refers to the nearest enemy. Use the variable to attack!
hero.attack(enemy1)
hero.attack(enemy1)

# Now that enemy1 is defeated, calling hero.findNearestEnemy() again will result in finding the new nearest enemy.
enemy2 = hero.findNearestEnemy()
hero.attack(enemy2)
hero.attack(enemy2)

# Assign the result of hero.findNearestEnemy() to the variable enemy3:
enemy3 = hero.findNearestEnemy()

# Now attack using the enemy3 variable:
hero.attack(enemy3)
hero.attack(enemy3)

1 comment on commit 2e72697

@Gizmotronn
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS is quite a lot like Python in terms of operators (see commit linked)

Please sign in to comment.