Skip to content

Commit

Permalink
fix redacted move example
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolodavis committed Feb 14, 2020
1 parent 4a468ab commit 7c65046
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 1 addition & 3 deletions examples/react-web/src/redacted-move/board.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ const Board = ({ G, ctx, moves, playerID, log }) => (
<pre>{JSON.stringify(log, null, 2)}</pre>
{playerID && (
<button
onClick={() =>
moves.clickCell({ secret: G.players[ctx.currentPlayer] })
}
onClick={() => moves.clickCell({ secret: G.players[playerID] })}
>
Click Cell
</button>
Expand Down
12 changes: 5 additions & 7 deletions examples/react-web/src/redacted-move/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,29 @@
* https://opensource.org/licenses/MIT.
*/

import { PlayerView, TurnOrder } from 'boardgame.io/core';
import { PlayerView, ActivePlayers } from 'boardgame.io/core';

const RedactedMoves = {
name: 'secret-state',

setup: () => ({
other: {},
players: {
0: 'player 0 state',
1: 'player 1 state',
'0': 'player 0 state',
'1': 'player 1 state',
},
}),

moves: {
clickCell: {
/* eslint-disable no-unused-vars */
impl: (G, ctx, secretstuff) => {
return { ...G };
},
move: (G, ctx, secretstuff) => {},
/* eslint-enable no-unused-vars */
redact: true,
},
},

turn: { order: TurnOrder.ANY },
turn: { activePlayers: ActivePlayers.ALL },

playerView: PlayerView.STRIP_SECRETS,
};
Expand Down

0 comments on commit 7c65046

Please sign in to comment.