JSFiddle - React, Tailwind, and code Playground
by rexonms
JavaScript
console.clear()
const matchResults = [];
const signInToICloud = ({ player }) => {
console.log(`${player.email} is logge in`)
return true;
}
const signInToGameCenter = ({ player }) => {
console.log(`${player.email} signInToGameCenter `)
return true;
}
const launcGameKitTester = ({ player }) => {
console.log(`${player.email} launcGameKitTester `)
return true;
}
const autoMatches = [];
const createAutoMatch = ({ player, minPlayerRequiredToPlay, maxPlayerThatCanPlay }) => {
console.log(`${player.email} createAutoMatch`)
autoMatches.push(player.email);
return true;
}
const messageMatches = [];
const createMessageMatch = ({ player, minPlayerRequiredToPlay, maxPlayerThatCanPlay }) => {
console.log(`${player.email} createAutoMatch`)
messageMatches.push(player.email);
return true;
}
const pushMatches = [];
const createPushMatch = ({ player, minPlayerRequiredToPlay, maxPlayerThatCanPlay }) => {
console.log(`${player.email} createAutoMatch`)
pushMatches.push(player.email);
return true;
}
const minPlayerRequiredToPlay = 2;
const maxPlayerThatCanPlay = 5;
// List of players
const players = [
{ email: '[email protected]', pass: 'pass' },
{ email: '[email protected]', pass: 'pass' },
{ email: '[email protected]', pass: 'pass' },
{ email: '[email protected]', pass: 'pass' },
{ email: '[email protected]', pass: 'pass' },
]
const playersB = [
{ email: '[email protected]', pass: 'pass' },
{ email: '[email protected]', pass: 'pass' },
]
const playerSignInSteps = [
{ name: 'singInToIcloud', action: signInToICloud },
{ name: 'signInToGameCenter', action: signInToGameCenter },
{ name: 'launcGameKitTester', action: launcGameKitTester },
{ name: 'createAutoMatch', action: createAutoMatch },
{ name: 'createMessageMatch', action: createMessageMatch },
{ name: 'createPushMatch', action: createPushMatch },
];
const plotData = ({ matchType, data }) =>...