# Questions about referee

**URL:** <https://discourse.codecombat.com/t/questions-about-referee/15627>\
**Category:** Artisan\
**Created:** [August 16, 2018, 10:30pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627 "2018-08-16T22:30:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [August 16, 2018, 10:30pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/1 "2018-08-16T22:30:14Z")

</div>

Those of you guys who need more info and questions about the referee feel free to ask here! But before you do that, please review [this topic](https://discourse.codecombat.com/t/wiki-the-basics-of-the-referee/15597/) before asking questions. And if the system is broken, it is recommended to contact the staff, as they know more about handling system issues about referees. Enjoy!

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/2X/b/b9f51baf688d77c13d4c4c8a437a5d81e5d584c9.png)

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [August 16, 2018, 10:30pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/2 "2018-08-16T22:30:23Z")

</div>



---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 18, 2018, 7:51pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/3 "2018-08-18T19:51:24Z")

</div>

Can someone teach me how to use for loops in coffee script? Because whenever I try to do a for loop in coffee script it says “Unhandled Error: Type Error: Cannot read property “length” of undefined” when I try to run the following referee code:

```python
{
  setUpLevel: ->
    @wizard = @world.getThangByID("Wizard")
    @hero.maxSpeed = 100
  summonMeteorShower: ->
    @XList = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
    @YList = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
    @radiusList = [5, 6, 7, 8, 9, 10]
    @world.rand.shuffle(@XList)
    @world.rand.shuffle(@Ylist)
    @world.rand.shuffle(@radiusList)
    @Iterate = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
    targetx = @XList[0]
    targety = @Ylist[0]
    radius = @radiusList[0]
    for x in @Iterate
      for y in @Iterate
        posx = 4*x
        posy = 4*y
        if ((posx-targetx)^2 + (posy-targety)^2) > (radius)^2
          b = @instabuild("boulder", posx, posy)
          b.pos.z = 100
          b.velocity.z = -50
          b.keepTrackedProperty("pos")
          b.keepTrackedProperty("velocity")
          b.shooter = @wizard
          b.launchType = "attack"
  onFirstFrame: ->
    @Cooldown5 = 0
    @Cooldown4 = 1
    @Cooldown3 = 2
    @Cooldown2 = 3
    @Cooldown1 = 4
    @Launch = 5
  chooseAction: ->
    if @world.age > @Cooldown5
      @wizard.say(@icontext.five)
      @Cooldown5 += 7
    if @world.age > @Cooldown4
      @wizard.say(@icontext.four)
      @Cooldown4 += 7
    if @world.age > @Cooldown3
      @wizard.say(@icontext.three)
      @Cooldown3 += 7
    if @world.age > @Cooldown2
      @wizard.say(@icontext.two)
      @Cooldown2 += 7
    if @world.age > @Cooldown1
      @wizard.say(@icontext.one)
      @Cooldown1 += 7
    if @world.age > @Launch
      @wizard.say(@icontext.launch)
      @summonMeteorShower()
      @Launch += 7
}

```

---

<div class="post-metadata">

**Author:** ![Deadpool198](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/deadpool198/32/16753_2.png) [@Deadpool198](https://discourse.codecombat.com/u/Deadpool198)\
**Post date:** [August 19, 2018, 10:01am UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/4 "2018-08-19T10:01:34Z")

</div>

Oh…My…Gosh, that looks extremely confusing. I’m afraid I can’t help, at all. 😮

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 19, 2018, 12:32pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/7 "2018-08-19T12:32:58Z")

</div>

`@world.rand.shuffle(@Ylist)`  
Here is your problem. `@Ylist` is `undefined` because the right name is `@YList`

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 19, 2018, 3:16pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/8 "2018-08-19T15:16:38Z")

</div>

@Bryukh yeah that’s definitely a problem. However, it seems like it’s not my only problem 😭 it still doesn’t work… ☹  
Here’s my code now: (it’s under a tab so my posts aren’t too long

> **My Code**
>
> ```python
> {
> setUpLevel: ->
> @wizard = @world.getThangByID("Wizard")
> @hero.maxSpeed = 100
> summonMeteorShower: ->
> @XList = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
> @YList = [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]
> @radiusList = [5, 6, 7, 8, 9, 10]
> @world.rand.shuffle(@XList)
> @world.rand.shuffle(@YList)
> @world.rand.shuffle(@radiusList)
> @Iterate = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]
> targetx = @XList[0]
> targety = @YList[0]
> radius = @radiusList[0]
> for x in @Iterate
> for y in @Iterate
> posx = 4*x
> posy = 4*y
> if ((posx-targetx)^2 + (posy-targety)^2) > (radius)^2
> b = @instabuild("boulder", posx, posy)
> b.pos.z = 100
> b.velocity.z = -50
> b.keepTrackedProperty("pos")
> b.keepTrackedProperty("velocity")
> b.shooter = @wizard
> b.launchType = "attack"
> onFirstFrame: ->
> @Cooldown5 = 0
> @Cooldown4 = 1
> @Cooldown3 = 2
> @Cooldown2 = 3
> @Cooldown1 = 4
> @Launch = 5
> chooseAction: ->
> if @world.age > @Cooldown5
> @wizard.say(@icontext.five)
> @Cooldown5 += 7
> if @world.age > @Cooldown4
> @wizard.say(@icontext.four)
> @Cooldown4 += 7
> if @world.age > @Cooldown3
> @wizard.say(@icontext.three)
> @Cooldown3 += 7
> if @world.age > @Cooldown2
> @wizard.say(@icontext.two)
> @Cooldown2 += 7
> if @world.age > @Cooldown1
> @wizard.say(@icontext.one)
> @Cooldown1 += 7
> if @world.age > @Launch
> @wizard.say(@icontext.launch)
> @summonMeteorShower()
> @Launch += 7
> }
> 
> ```

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 19, 2018, 3:32pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/9 "2018-08-19T15:32:41Z")

</div>

The code isn’t enough to answer your question. What do you mean “doesn’t work”? Some error or something else?

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 19, 2018, 3:32pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/10 "2018-08-19T15:32:59Z")

</div>

Unable to load level… I don’t know what doesn’t work.

Edit: Nevermind. I opened the developer console and it says @instabuild needs object, but got string instead, then I realized I need to have boulder in my buildables, so I added that and the level finally loaded 😃

The problem is: There’s suppose to be a “safety circle”. The boulders are supposed to fall everywhere except for within the safety circle.

```python
for x in @Iterate
      for y in @Iterate
        posx = 4*x
        posy = 4*y
        if ((posx-targetx)^2 + (posy-targety)^2) > (radius)^2
          b = @instabuild("boulder", posx, posy)
          b.pos.z = 100
          b.velocity.z = -50
          b.keepTrackedProperty("pos")
          b.keepTrackedProperty("velocity")
          b.shooter = @wizard
          b.launchType = "attack"

```

This part of the code controls the launching of the boulders.

Isn’t `if ((posx-targetx)^2 + (posy-targety)^2) > (radius)^2` supposed to make boulders only spawn outside of the circle?

Also, the boulders do no damage for some reason. The wizard has infinite attack damage. It’s supposed to kill the hero…

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [August 19, 2018, 7:04pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/11 "2018-08-19T19:04:06Z")

</div>

The boulder doesn’t have any, the wizard does because the boulder is completely different and doesn’t have any connection with the wizard since the game itself is shooting them

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 19, 2018, 7:47pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/12 "2018-08-19T19:47:27Z")

</div>

@Chaboi_3000 but I said b.shooter = @wizard

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [August 19, 2018, 8:08pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/13 "2018-08-19T20:08:40Z")

</div>

But you didn’t say what it does when it touches a target

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 19, 2018, 8:19pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/14 "2018-08-19T20:19:46Z")

</div>

The wizard’s attack damage is 9001. I said b.launchtype = “attack”. Shouldn’t that define what happens when it hits a target?

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [August 19, 2018, 8:32pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/15 "2018-08-19T20:32:05Z")

</div>

Try asking @Bryukh, he’s better at this than me.

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 19, 2018, 10:40pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/16 "2018-08-19T22:40:48Z")

</div>

Bryukh is currently offline, it seems like…

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [August 19, 2018, 10:41pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/17 "2018-08-19T22:41:19Z")

</div>

Yeah, it’s 1:41 AM at his timezone

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 19, 2018, 10:43pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/18 "2018-08-19T22:43:34Z")

</div>

Oh I just noticed the huge time gap between the posts

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 20, 2018, 4:40am UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/19 "2018-08-20T04:40:57Z")

</div>

Try to check the referee in the level `blind-distance`. Or save your level and let me check it. There could be several possible issues, It’s hard to say without additional info.

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 20, 2018, 4:42am UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/20 "2018-08-20T04:42:23Z")

</div>

> [@SuperSmacker](#):
>
> Also, the boulders do no damage for some reason. The wizard has infinite attack damage. It’s supposed to kill the hero…

Boulders aren’t missiles so they don’t use their shooter attackDamage. Add `Shell` component to the boulder template.

---

<div class="post-metadata">

**Author:** ![SuperSmacker](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/supersmacker/32/8385_2.png) [@SuperSmacker](https://discourse.codecombat.com/u/SuperSmacker)\
**Post date:** [August 20, 2018, 7:56pm UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/21 "2018-08-20T19:56:16Z")

</div>

@Bryukh okay I’ve saved the level. I added the thangTemplate: “Shell” to the boulder in the existence.Builds part of the referee. I’m not sure if that’s what you meant by adding the Shell component to the boulder template…

Anyway, it seems like the boulders still aren’t doing any damage… You can take a look and see if anything’s wrong via the link: [https://codecombat.com/editor/level/meteor-strike](https://codecombat.com/editor/level/meteor-strike)

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [August 21, 2018, 4:54am UTC](https://discourse.codecombat.com/t/questions-about-referee/15627/22 "2018-08-21T04:54:30Z")

</div>

If you are using a template for `buildables` then you need a thang which will be a template. I’ve added `Boulder` and set `friendlyFire` true for this. Check version history for my last changes.

[Next page](https://discourse.codecombat.com/t/questions-about-referee/15627.md?page=2)
