8000 start position json · Issue #5 · nielslange/react-backgammon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

start position json #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
amlwwalker opened this issue Sep 6, 2024 · 1 comment
Open

start position json #5

amlwwalker opened this issue Sep 6, 2024 · 1 comment

Comments

@amlwwalker
Copy link

Hey Niels,
Dunno if you saw email, but thought i'd put this here.

If we can agree to the following structure for board layout and moves

{
  "args": {
    "board": {
      "o": {
        "6": 5,
        "8": 3,
        "13": 5,
        "24": 2
      },
      "x": {
        "5": 1,
        "6": 5,
        "8": 3,
        "13": 4,
        "24": 2
      }
    },
    "dice": [
      6,
      4
    ],
    "player": "o"
  },
    "move": {
    "play": [
      {
        "from": "24",
        "to": "20"
      },
      {
        "from": "20",
        "to": "14"
      }
    ]
  }
}

then it will be incredibly straight forward to link our work together.
The above is the board that the move will be applied to. My backend code can then verify the move is indeed legal before allowing the player to continue from the resulting position.

@amlwwalker
Copy link
Author
amlwwalker commented Sep 6, 2024

and just to be exhaustive, this is how off and bar would work in the above:

{
  "args": {
    "board": {
      "x": {
        "1": 1,
        "2": 1,
        "3": 1,
        "bar": 0
      },
      "o": {
        "6": 5,
        "8": 3,
        "13": 5,
        "24": 2
      }
    },
    "dice": [
      2,
      1
    ],
    "player": "x"
  },
  "move": {
    "play": [
      {
        "from": "1",
        "to": "off"
      },
      {
        "from": "2",
        "to": "off"
      }
    ]
  }
}

when a piece is off then it just doesn't appear in the board structure (i.e there is no need for "off": 3 ) - we can add it for the frontend if you want, but i believe the backend will just ignore it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0