NNimClover
AI coding workspace

Normal-play Nim moves

NimClover is a Windows AI coding client for exploring impartial-game code. Bring your pile representation into the project conversation and review how a suggested move changes its xor balance. The example uses the normal rule in which taking the last object wins.

● ● ●NimClover●
A concrete starting point · Normal-play Nim moves ×
def nim_move(piles):
    if type(piles) not in (list, tuple) or len(piles) > 128 or any(type(v) is not int or not 0 <= v <= 10**9 for v in piles):
        raise ValueError("nim.piles")
    balance = 0
    for pile in piles:
        balance ^= pile
    if balance == 0:
        return None
    for index, pile in enumerate(piles):
        reduced = pile ^ balance
        if reduced < pile:
            return index, reduced
✳Choose a winning reduction for normal-play Nim from at most 128 piles of zero through one billion objects.
✓ ChangesReview before applying ↗
Illustrative workspace
  1. Project

    Test all-zero and losing positions, returning no move when the xor is zero and rejecting negative or Boolean pile sizes.

  2. Review before applying

    Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

  3. Connection

    Base URL, credentials and a reachable server.

Workflows

Normal-play Nim moves

Workflows ↗
A concrete starting point
def nim_move(piles):
    if type(piles) not in (list, tuple) or len(piles) > 128 or any(type(v) is not int or not 0 <= v <= 10**9 for v in piles):
        raise ValueError("nim.piles")
    balance = 0
    for pile in piles:
        balance ^= pile
    if balance == 0:
        return None
    for index, pile in enumerate(piles):
        reduced = pile ^ balance
        if reduced < pile:
            return index, reduced
AI coding workspace

Carry a rule change through to the application that uses it

NimClover is a Windows AI coding workspace for developing software with explicit rules and decisions. Choose the project folder and describe the rule you need to implement or repair. The connected assistant can inspect the relevant source and discuss a proposal, while the conversation keeps accepted inputs and observable outcomes available for your review.

The nim.py example can ground a task about selecting a move under normal-play rules. Ask how the application represents a move, what it does when the helper returns no selection and whether the active rule set matches the function's assumptions. Use those questions to inspect your own project. They turn a small illustrative function into a software integration task rather than a claim that a game engine comes with the workspace.

For unrestricted AI model choice, connect an available model through a supported OpenAI-compatible or Anthropic endpoint. Supply credentials when required and check its actual capabilities. After reviewing proposed edits, test both a returned move and the no-selection path through their callers. Verify that state changes agree with the returned representation. The useful result is a coherent feature in your application, supported by checks, rather than an isolated algorithm that never reaches the interface correctly.

Questions for integrating rule-based decisions

Does no selected move mean there are no legal moves?

Not necessarily. Interpret the helper's return value according to its contract and the game's current state. Ask how the caller distinguishes strategy from legality before mapping a missing selection to a message or ending the interaction.

What should I specify about the rule set?

State the winning condition and any variant rules that affect valid decisions. The example assumes normal play. A different final-move rule needs separate reasoning and checks rather than an unchanged helper with a new label in the interface.

How should I test a returned move?

Check that the indicated entry exists, the new value is permitted and the caller applies it as intended. Include the resulting application state. A valid pair from the helper does not establish that the interface updates the correct entry.

Can this workflow expand to a complete game?

You can develop further project features through additional scoped tasks. Define rendering, input handling and state transitions separately, then test their integration. The coding workspace and a strategy example do not establish those features as already implemented.

Get the Windows app ↗

NimClover · Updated 2026-10-25