• 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
WeaponMan Avatar
Name:Ondřej Kotora
Clan:Unknown
Member Since:Sep 2017
Last Seen:Apr 2025
Profiles:
Following:1
Followers:2
Allies:1
View Profile Badges
  • Stats
  • Kata
  • Collections
  • Kumite
  • Social
  • Discourse
  • Conversations (15)
  • Replies
  • Authored
  • Needs Resolution
  • Custom User Avatar
    • onedragon424
    • commented on "Opposite number" rust solution
    • 2 years ago

    I guess it's the overflow considerations?

  • Custom User Avatar
    • Sadra Moh
    • commented on "Opposite number" rust solution
    • 2 years ago

    what is meant with the "worst case" ?

  • Custom User Avatar
    • salsadipomodoro
    • commented on "Opposite number" rust solution
    • 3 years ago

    If the goal is to pass the test, that's fine. But this code cannot be considered best practice because it does not consider the worst case.

  • Custom User Avatar
    • ejini战神
    • resolved a suggestion on "Esolang Interpreters #3 - Custom Paintf**k Interpreter" kata
    • 4 years ago

    Approved some time ago

  • Custom User Avatar
    • darkwiiplayer
    • commented on "Numbers in strings" lua solution
    • 6 years ago

    A sturdier initial value for max could be -math.huge, which is -inf when Lua was compiled with floating-point numbers.

  • Custom User Avatar
    • WeaponMan
    • created a suggestion for "Esolang Interpreters #2 - Custom Smallfuck Interpreter" kata
    • 7 years ago

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

  • Custom User Avatar
    • WeaponMan
    • created a suggestion for "Esolang Interpreters #1 - Introduction to Esolangs and My First Interpreter (MiniStringFuck)" kata
    • 8 years ago

    Prepared Erlang translation:
    https://www.codewars.com/kumite/5a4bc2118803859bed00012c

    Please review.

  • Custom User Avatar
    • donaldsebleung
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago

    Many thanks for your contribution; reviewed and approved :D

  • Custom User Avatar
    • WeaponMan
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago

    No problem.

    1-2) Added

  • Custom User Avatar
    • donaldsebleung
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago

    All looks great to me by eye but would you mind making the following minor modifications before I approve it?

    1. Seed the random number generator with the current time using math.randomseed(os.time()) before executing the random tests. IIRC Lua uses a fixed default seed for math.random() which means that the sequence of "random" numbers generated will be identical in each program run unless it is explicitly seeded (with the current time).
    2. Place the random test in a for loop so that it gets executed at least 10 times (and ideally about 100 times if possible), like such:
    -- Don't forget to seed math.random ;)
    math.randomseed(os.time())
    
    -- Execute random tests in a loop
    for i = 1, 10, 1
    do
      randomInput = math.random() -- or some other randomly generated input
      -- as deemed appropriate for the Kata
      assert.are.same(referenceSolution(randomInput --[[ or inputs --]]), userSolution(randomInput))
    end
    

    Cheers :)

  • Custom User Avatar
    • WeaponMan
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago

    Thank you for your answer.
    I was hoping for better solution than copy over final solution to test cases.
    Random part in test cases is uncommented and final solution is copied over.

  • Custom User Avatar
    • donaldsebleung
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago

    I don't know how to require the "reference" function into test case. If you do please tell me.

    To compare the user solution against a reference solution, you have to define the reference solution in the Test Cases section itself. For example:

    -- Reference Solution (do NOT include in Sample Test Cases!!!)
    local function solution(a, b)
      -- Simply copy and paste the function body of your working "Final Solution"
      -- into that of the reference solution.  Note however that
      -- (1) you should also define your set of helper functions in the Submit Tests
      -- (and copy them over) if you used any in your "Final Solution" and
      -- (2) take care to ensure that the reference solution calls **itself**
      -- and NOT the user solution if there are any recursive cases
      return a * b
    end
    
    -- Submit Tests
    describe('The multiply function', function ()
      it('should work for some fixed tests', function ()
        assert.are.same(15, multiply(3, 5))
        assert.are.same(24, multiply(4, 6))
        assert.are.same(81, multiply(9, 9))
        assert.are.same(180, multiply(15, 12))
      end)
      it('should work for some random tests', function ()
        -- Seed the random number generator with the current time
        math.randomseed(os.time())
        -- Execute 100 random tests
        for i = 1, 100, 1
        do
          a = math.random(12)
          b = math.random(12)
          assert.are.same(solution(a, b), multiply(a, b))
        end
      end)
    end)
    

    Since I don't actually know Lua, I can't guarantee that the code example I provided above would compile (I haven't tested it on an online compiler) but hopefully you get the idea :)

  • Custom User Avatar
    • WeaponMan
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago

    Thank you for feedback.

    1. renamed
    2. I don't know how to require the "reference" function into test case. If you do please tell me.
    3. Fixed

    I am doing translation for the first time, so I don't know the in and outs yet.

  • Custom User Avatar
    • donaldsebleung
    • commented on ""Esolang Interpreters #3 - Custom Paintf**k Interpreter" Lua Translation"
    • 8 years ago
    1. It would be best to adhere to the Kata Description and name the user solution interpreter to ensure consistency between Lua and other language versions.
    2. Why are the random tests currently commented out? ;)
    3. Next time you publish a translation, please ensure that the tab is on "Test Cases" (i.e. the Sumbit tests) and not the "Sample Test Cases" so I can confirm that the "actual" test cases are indeed working as expected, cheers :)
  • Custom User Avatar
    • WeaponMan
    • created a suggestion for "Esolang Interpreters #3 - Custom Paintf**k Interpreter" kata
    • 8 years ago

    Lua translation Kumited!

    https://www.codewars.com/kumite/5a496360b3bfa8aa2900008f/

    Please review and approve!

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

Confirm

  • Cancel
  • Confirm

Collect: undefined

Loading collection data...