Sort by

recency

|

424 Discussions

|

  • + 0 comments

    Lucky 91 offers more than just a counter game — enjoy thrilling gameplay and real cash rewards in Pakistan. Visit this now to experience non-stop winning action!

  • + 0 comments

    "Counter Game" can refer to a few different things: a number-based game where players reduce a number to 1, a type of game played with dice on a store counter, or a commongameplay mechanic in collectible card games. It can also refer to the popular first-person shooter game "Counter-Strike", or various other games with similar themes. The news comes via a report from PlayStation LifeStyle, which excerpts a LinkedIn post from a Jackalyptic Games employee, says that their team and Counterplay were working on a project together, but unfortunately, “CPG was disbanded”.13 Jan 2025

  • + 0 comments

    Not the most efficient, but is readable and works

    def counterGame(n):
        powers2 = []
        x = 2
        while x<=n:
            powers2.append(x)
            x *= 2
    
        louise = True
        while True:
            if n == 1:
                break
            n = n / 2 if n == powers2[-1] else n - powers2[-1]
            powers2 = [x for x in powers2 if x <= n]
            louise = not louise
        return "Richard" if louise else "Louise"
    
  • + 0 comments

    In the game between Louise and Richard, the goal is to reduce a number to 1 through a series of steps, either by dividing by the largest power of 2 or subtracting it. Louise always starts, and the game continues until one of them makes the number 1. For instance, if the number is 6, Louise will subtract 4 (the largest power of 2), and Richard will divide 2 by 2 to win. This game mirrors the strategic moves often discussed in USA News, where analyzing decisions and predicting outcomes are key elements in political, economic, or social contexts.

  • + 0 comments

    easy recursive solution:

    def is_pow2(n):
        return n > 0 and (n & (n-1)) == 0
    
    def helper(n, state):
        nxt_state = (state + 1) % 2
        if n == 1:
            return nxt_state
        if n < 4:
            return state
    
        if is_pow2(n):
            nxt_n = n // 2
            return helper(nxt_n, nxt_state)
        else:
            bn = n.bit_length()
            nxt_n = n ^ (1 << (bn-1))
            return helper(nxt_n, nxt_state)
        
    def counterGame(n):
        # Write your code here
        '''
        1 richard
        2 louise
        3 louise
        4 richard
        
        0-l, 1-r
        '''
        
        return 'Richard' if helper(n, 0) else 'Louise'