# Enhancing BullsEye

**URL:** <https://forums.kodeco.com/t/enhancing-bullseye/112255>\
**Category:** iOS Apprentice\
**Created:** [June 16, 2020, 7:28am UTC](https://forums.kodeco.com/t/enhancing-bullseye/112255 "2020-06-16T07:28:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rexorioko](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/rexorioko/32/81494_2.png) [@rexorioko](https://forums.kodeco.com/u/rexorioko)\
**Post date:** [June 16, 2020, 7:28am UTC](https://forums.kodeco.com/t/enhancing-bullseye/112255/1 "2020-06-16T07:28:17Z")

</div>

Hi there,

I’m thinking of adding a small feature to challenge myself. I want to start a new game after n number of rounds, for this I thought of doing the below:

1. capture the value of specific UILabel
2. Check if it’s greater than n number
3. If true start a new game, else keep playing.

I was able to do number 1, which came back as an optional(String), is it safe to change it’s type back to an int so I can compare? If no how do I check this, if yes, the new game button listens for an event of click i think, how can I do this automatically based on number of rounds, is this even possible?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![davejewell](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/davejewell/32/108889_2.png) [@davejewell](https://forums.kodeco.com/u/davejewell)\
**Post date:** [June 20, 2020, 4:09pm UTC](https://forums.kodeco.com/t/enhancing-bullseye/112255/2 "2020-06-20T16:09:25Z")

</div>

Hi rexorioko. Rather than trying to get the round number back from the Text item, why not just look at is as you’re about to increment it? Inside the dismiss button handler, there’s a chunk of code that looks like this:

self.score = self.score + self.pointsForCurrentRound()  
self.target = Int.random(in: 1…100)  
self.round = self.round + 1

So, at the point where self.round is incremented, try replacing that last statement with something like this:

if self.round \< self.limit { self.round = self.round + 1) } else { self. startNewGame() }

In the above, I’m using “self.limit” as what you refer to as “n” in your question.

Dave

---

<div class="post-metadata">

**Author:** ![system](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@system](https://forums.kodeco.com/u/system)\
**Post date:** [November 29, 2020, 11:28pm UTC](https://forums.kodeco.com/t/enhancing-bullseye/112255/3 "2020-11-29T23:28:21Z")

</div>

Closed on November 29, 2020, 11:28pm UTC

This topic was automatically closed after 166 days. New replies are no longer allowed.
