Sort by

recency

|

89 Discussions

|

  • + 0 comments

    I implemented a solution using a more intuitive and naive way for me where i explicitly coded both player logic which player1 always choose the wining position and player2 always choose the losing position. It's kinda mind blowing to me you can completly hide player2's logic by defining it to be player1 always force the next state to lose state after reading editorial. Just going to share my code here:

    '''
    1 = win, 0 = lose
    p0 = player 1 choose any win state 
    p1 = player 2 choose any lose state
    '''
    def is_inbound(x, y):
        n = 15
        if x > n or y > n or x < 1 or y < 1:
            return False
        return True
    
    hm = {}
    def helper(x, y, p):        
        nxt_p = not p
        delta = [(-2, 1), (-2, -1), (1, -2), (-1, -2)]
        states = []
        nxt_pos = []
        res = 0
        # check next possible moves
        for d in delta:
            xd, yd = x+d[0], y+d[1]
            if is_inbound(xd, yd):
                nxt_pos.append((xd, yd))
        # no possible move
        if not nxt_pos:
            if p:
                return 1
            else:
                return 0 
        # recurse every valid move with memo
        for pos in nxt_pos:
            cur = (pos[0],pos[1],nxt_p)
            if cur in hm:
                state = hm[cur]
            else:
                state = helper(*cur)
                hm[cur] = state
            states.append(state)
        # logic of optimal play
        res = all(states) if p else any(states)
        return res
    
    def chessboardGame(x, y):
        # Write your code here
        res = helper(x,y, 0)
        return  'First' if res else 'Second'
    
  • + 0 comments

    niceA Chessboard Game is a great logic game that successfully combines classic chess mechanics with modern game design. The simple but addictive gameplay perfectly trains strategic thinking https://trinityrental.com/rent-lamborghini and concentration, reminiscent of a real chess game.

  • + 2 comments

    If you're into video games and movies, you have to check this out! I just read an article about upcoming game-to-movie adaptations and it got me genuinely excited. Some of my favorite titles are getting their own films soon! Whether you're a gamer or a movie buff (or both), you'll love it. Dive in here: https://filmik.blog/upcoming-adaptations-which-games-are-soon-to-become-movies/

  • + 0 comments

    As you can see, in this game, two players take turns moving a coin on a chessboard. The coin can move in four specific directions, but it must stay within the bounds of the board. Player one goes first, and the game ends when a player can't make a valid move — that player loses. To solve this, you should use dynamic programming to figure out whether a given position is a winning or losing one. The key idea is to check all possible moves from each position and mark whether they will lead to a win or a loss. By filling out a 9x9 grid, we can quickly determine the winner for any starting position, making the solution efficient even with multiple test cases. This approach ensures both players play optimally. Anyway, why not play something to unload the mind from stress? At least now? I was under a lot of stress. And that's how I had been before seeing https://basantclubb.com/ in the search engine one day. Their bright design and new games brought me back to my usual me. If you want to brighten your day even more, use my invitation code.

  • + 0 comments

    Hey everyone, just wanted to share a great find for those who enjoy entertainment and skill-based activities. I came across https://bcgames-india.com/ , a platform with an impressive variety of options, from interactive games to a broad selection of sports events to explore. What’s notable is that BC Game India is fully licensed under international standards, ensuring a safe and reliable experience. They offer excellent support for users and have tailored programs and rewards for both newcomers and regular visitors. Plus, the regular events and challenges make it an engaging place to spend time!