Skip to content
This repository was archived by the owner on Sep 13, 2022. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/client-docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: urturn/client
---

## High level Description

The `@urturn/client` provides a basic abstraction of communicating your frontend to the backend with a simple interface.

## Exported Methods

There are 3 main exported methods avaiable for frontend use:

- `getBoardGame`
- `makeMove`
- `getLocalPlayer`

## Example of use
Before getting into an example, it is critical to note the importance of the `makeMove` method. You can think of the method as a bridge between two states of your game, from a frontend perspective. This makes it easier to imagine the game in terms of discrete states when it comes to development work.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow +++++


`old state -> makeMove -> new state`

In the `checkers` repo, there exists [use](https://github.com/turnbasedgames/tictactoe/blob/e36ab75d5e9c9a4165b17070971b79dae93585b2/frontend/src/App.jsx#L87) of the `makeMove` method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the name

Suggested change
In the `checkers` repo, there exists [use](https://github.com/turnbasedgames/tictactoe/blob/e36ab75d5e9c9a4165b17070971b79dae93585b2/frontend/src/App.jsx#L87) of the `makeMove` method.
In the `tictactoe` repo, there exists [use](https://github.com/turnbasedgames/tictactoe/blob/e36ab75d5e9c9a4165b17070971b79dae93585b2/frontend/src/App.jsx#L87) of the `makeMove` method.


The `getBoardGame` method is used to get the initial state of the game upon start up. It is up to you to perform updates to the game (via `makeMove`).
9 changes: 9 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ const config = {
},
],
},
{
title: 'Client',
items: [
{
label: '@urturn/client',
to: '/docs/client-docs',
},
],
},
{
title: 'More',
items: [
Expand Down