This file contains 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
function speak(text) { | |
const utterance = new SpeechSynthesisUtterance(text); | |
speechSynthesis.speak(utterance); | |
} | |
const letters = ["A", "B", "C", "D","E", "F", "G", "H", "J", "K", "L","M","N","O","P","Q","R","S", "T"] | |
socket.onAny((message,data)=>{ | |
var isMove = message.split('/')[2] === "move" | |
var color = (data.move_number % 2) == 0 ? "White to " : "Black to " | |
if(isMove){ |
This file contains 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
const quickSort = (array, left = 0, right)=>{ | |
if(right === undefined){ | |
right = array.length -1; | |
} | |
if(left >= right){ | |
return; | |
} | |
moveMedian(array, left, right); | |
let wall = left; | |
const pivot = right; |
This file contains 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
/* | |
I made a handful of decisions about this function: | |
1) I know you said array of integers, but I decided to make it a bit more resiliant. | |
2) If you give me a non-array, I will just spit that back at you | |
3) This is a functional thing, so I will return a new array instead of flattening in place | |
4) I did use newer language features, my assumption is that this will run in an environment where that is ok, or it will be transpiled | |
5) Flatten is strictly about arrays, so I don't do anything with objects. | |
*/ | |
const flatten = (toFlattenArr) => { |
This file contains 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
export const listenForPlayerAction = (game: Game): Promise<ActionValue> => { | |
return new Promise((res, rej) => { | |
const { sockets, currentPlayerIndex } = game; | |
const currentSocket = sockets[currentPlayerIndex]; | |
currentSocket.once('action', async (action: ActionTypes, value: number) => { | |
if (!checkIfValidAction(game, action, value)) { | |
rej("Invalid Action"); | |
} else { | |
res({ action, value }); |
This file contains 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
interface Props { | |
card: Card | |
} | |
export default (props: Props)=>{ | |
const { name, optional, requirements, effects } = props.card; | |
return <div class='game-card text-center'> | |
<div class='title'>{name}</div> |
This file contains 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
public class GameManager : MonoBehaviour | |
{ | |
[SerializeField] | |
Player playerPrefab; | |
Timeline timeline; | |
static GameManager t; | |
List<ITimed> timedThings = new List<ITimed>(); | |
IInput currentInput; |
This file contains 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
public class InputPlayer : IInput | |
{ | |
public bool ShouldPlay{get{ | |
return !GameSettings.PauseOnInaction || | |
( | |
Input.GetKey(KeyCode.W) || | |
Input.GetKey(KeyCode.A) || | |
Input.GetKey(KeyCode.S) || | |
Input.GetKey(KeyCode.D) || |
This file contains 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
public interface IInput | |
{ | |
void GetInput(); | |
void EndInput(); | |
void StartInput(); | |
bool ShouldPlay {get;} | |
} | |
public enum InputTypes{ | |
Player, |
This file contains 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
public class Player : MonoBehaviour, ITimed | |
{ | |
[SerializeField] | |
float speed = 1; | |
[SerializeField] | |
bool isStartingPlayer = false; | |
public bool IsStartingPlayer {get{return isStartingPlayer;}} | |
[SerializeField] | |
CollDetector forwardDetector; |
This file contains 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
public class TimedState | |
{ | |
SeriealizedState data; | |
ITimed timed; | |
public ITimed Target { get { return timed; } } | |
public SeriealizedState Data { get { return data; } } | |
public TimedState(ITimed timedObject, SeriealizedState serialized) |
NewerOlder