• Sign Up
    Time to claim your honor
  • Training
  • Practice
    Complete challenging Kata to earn honor and ranks. Re-train to hone technique
  • Freestyle Sparring
    Take turns remixing and refactoring others code through Kumite
  • Community
  • Leaderboards
    Achieve honor and move up the global leaderboards
  • Chat
    Join our Discord server and chat with your fellow code warriors
  • Discussions
    View our Github Discussions board to discuss general Codewars topics
  • About
  • Docs
    Learn about all of the different aspects of Codewars
  • Blog
    Read the latest news from Codewars and the community
  • Log In
  • Sign Up
markbrew3 Avatar
Name:Mark Brewer
Clan:Nashville software school
Member Since:Aug 2022
Last Seen:May 2025
Profiles:
Following:6
Followers:6
Allies:6
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (14)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • focusthenflex
    • commented on "Find the unique number" javascript solution
    • 2 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • ali007km
    • commented on "Two fighters, one winner." kata
    • 2 years ago

    It's used to refer to objects that are specific to that method. Since different classes can override methods, the use of "this" basically eleminated confusion between classes that have the same parameter.
    So for example, two methods may both have int x but using "this.x", you can specify that it's this x for this specific method.

    If you have a good understanding of method overriding then this would be more understandable. I hope I cleared up some confusion ;)

  • Custom User Avatar
    • Madjosz
    • commented on "Find the unique number" javascript solution
    • 3 years ago

    Maybe because it's bad in terms of complexity and it mutates the input.

  • Custom User Avatar
    • markbrew3
    • commented on "Find the unique number" javascript solution
    • 3 years ago

    how did i dont think of this. smh

  • Custom User Avatar
    • markbrew3
    • commented on "Unique In Order" javascript solution
    • 3 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • Karaf
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • karakarasuuuu
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    Very interesting. There are (at least) 3 ways to solve it and one of them can be implemented by two similar ideas.

  • Custom User Avatar
    • Chrono79
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    Print the input of the tests your code fails, try your code here: https://pythontutor.com/visualize.html#mode=edit

  • Custom User Avatar
    • Karaf
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    Direct my attention to a problem in my code, please.

  • Custom User Avatar
    • karakarasuuuu
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    Yeah but some careless ppl like me will not notice that until try to solve it and get error. xd
    Thanks anyway.

  • Custom User Avatar
    • Chrono79
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    The function's name should be declareWinner not declare_winner.

  • Custom User Avatar
    • eurydice5717
    • created a suggestion for "Two fighters, one winner." kata
    • 3 years ago

    Sorry... but in C++ the kata has to be redesigned, as is it is a sound example of BAD C translation to C++
    I don't raise an issue but...

    Codewars is a learning platform

    a) use std::unique_ptr if you want to use pointers..
    b) but could be better to use refs (Fighter &fighter1) in the call to 'declare_winner' . This would allow to use exactely the kind of prototype stated in the details:

    declare_winner(Fighter("Lew", 10, 2), Fighter("Harry", 5, 4), "Lew")
    

    instead of using naked pointers..
    c) all pseudo "hidden" parms of Fighter class have setters and getters which is (generally) a bad practice in C++.
    d) setHealth() ? should be transformed in "receiveDamage()" returning bool (true) if the fighter is still alive.

  • Custom User Avatar
    • DaliNet
    • commented on "Two fighters, one winner." kata
    • 3 years ago

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar
    • markbrew3
    • created a question for "Two fighters, one winner." kata
    • 3 years ago

    sorry if this question is dumb but ive been trying to search for what the 'this.variable' in the object does/ means. in this case its this.name, this.health ect.. but im having a hard time finding an answer i understand well. can anyone explain it at all?

  • © 2025 Codewars
  • About
  • API
  • Blog
  • Privacy
  • Terms
  • Code of Conduct
  • Contact

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...