-
Notifications
You must be signed in to change notification settings - Fork 795
Document Random and Context #1189
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
LionC
wants to merge
17
commits into
boardgameio:main
Choose a base branch
from
info-hsaka:docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
56d32dc
Start Simplifying the turortial
reckter e821328
Update tut for our bg.io template
reckter ffff409
Add wording to incorportate finished rendering
reckter f821918
:pencil2:
reckter 2ee5552
Create static.yml
reckter a8ca03a
Merge remote-tracking branch 'origin/main' into new-tutortial
reckter fa44dea
Merge pull request #1 from info-hsaka/new-tutortial
reckter 99cd42e
Update CNAME
reckter cba183b
Link to prior tutorials / use vscode run button
reckter 3acb8d8
Delete CNAME
mhlz 91a6c92
Create CNAME
mhlz 84b18e3
Update Tutorial
mhlz c53adc6
Remove snippet
mhlz 496a384
Add ID explainer
mhlz f9b16d2
Fix bot enumarate error
reckter a9882e8
Fix enumarate function arguments
reckter 0994b22
Document Random API and Context
LionC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # Simple workflow for deploying static content to GitHub Pages | ||
| name: Deploy static content to Pages | ||
|
|
||
| on: | ||
| # Runs on pushes targeting the default branch | ||
| push: | ||
| branches: ["main"] | ||
|
|
||
| # Allows you to run this workflow manually from the Actions tab | ||
| workflow_dispatch: | ||
|
|
||
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| # Single deploy job since we're just deploying | ||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v5 | ||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| # Upload entire repository | ||
| path: './docs' | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| boardgame.io | ||
| bg.oc.is | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # Context | ||
|
|
||
| Here are some examples on what the `ctx` Context parameter contains: | ||
|
|
||
| ## Simple Beginning Game | ||
|
|
||
| This would be the context of a simple two player game without phases or stages that has just started: | ||
|
|
||
| ```js | ||
| { | ||
| /** Number of players in the game */ | ||
| numPlayers: 2, | ||
| /** List of player IDs in play order */ | ||
| playOrder: ["A", "B"], | ||
| /** Current position in the play order */ | ||
| playOrderPos: 0, | ||
| /** | ||
| * If there are stages, this is an Object containing all currently active players with their playerIds as fields and the stage they are in as content. | ||
| * | ||
| * Will be `null` if there are no stages. | ||
| * */ | ||
| activePlayers: null, | ||
| /** playerID of the player that is acting right now */ | ||
| currentPlayer: "A", | ||
| /** Number of moves that have been taken in the game already */ | ||
| numMoves: 0, | ||
| /** Turn number of the current turn */ | ||
| turn: 0, | ||
| /** | ||
| * Contains the return value of the `endIf` function in the `Game` object if the game is over. | ||
| * | ||
| * Is empty if the game is not over. | ||
| */ | ||
| phase: null, | ||
| } | ||
| ``` | ||
|
|
||
| ## Simple In Progress Game | ||
|
|
||
| This would be the context of the same game after it has just ended | ||
|
|
||
| ```js | ||
| { | ||
| /** Number of players in the game */ | ||
| numPlayers: 2, | ||
| /** List of player IDs in play order */ | ||
| playOrder: ["A", "B"], | ||
| /** Current position in the play order */ | ||
| playOrderPos: 1, | ||
| /** | ||
| * If there are stages, this is an Object containing all currently active players with their playerIds as fields and the stage they are in as content. | ||
| * | ||
| * Will be `null` if there are no stages. | ||
| * */ | ||
| activePlayers: null, | ||
| /** playerID of the player that is acting right now */ | ||
| currentPlayer: "B", | ||
| /** Number of moves that have been taken in the game already */ | ||
| numMoves: 6, | ||
| /** Turn number of the current turn */ | ||
| turn: 6, | ||
| /** Active phase of the game or `null` if there are no phases */ | ||
| phase: null, | ||
| /** | ||
| * Contains the return value of the `endIf` function in the `Game` object if the game is over. | ||
| * | ||
| * Is empty if the game is not over. | ||
| */ | ||
| gameOver: { | ||
| winner: "B", | ||
| }, | ||
| } | ||
| ``` | ||
|
|
||
| ## Game with Phases and Stages | ||
|
|
||
| This would be the context of a more complex game with phases and stages: | ||
|
|
||
| ```js | ||
| { | ||
| /** Number of players in the game */ | ||
| numPlayers: 4, | ||
| /** List of player IDs in play order */ | ||
| playOrder: ["A", "B", "C", "D"], | ||
| /** Current position in the play order */ | ||
| playOrderPos: 1, | ||
| /** | ||
| * If there are stages, this is an Object containing all currently active players with their playerIds as fields and the stage they are in as content. | ||
| * | ||
| * Will be `null` if there are no stages. | ||
| * */ | ||
| activePlayers: { | ||
| A: "Choose Opponent", | ||
| B: "Choose Opponent", | ||
| }, | ||
| /** playerID of the player that is acting right now */ | ||
| currentPlayer: "B", | ||
| /** Number of moves that have been taken in the game already */ | ||
| numMoves: 4, | ||
| /** Turn number of the current turn */ | ||
| turn: 2, | ||
| /** Active phase of the game or `null` if there are no phases */ | ||
| phase: "Building", | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this changed?