Rock, Paper, Scissors, lizard, spock

Rock Paper Scissors Lizard Spock Graph Gist

“Rock, Paper, Scissors, Lizard, Spock” is a variation of the children’s 3-way lock hand game called Rock Paper Scissors (or ‘Roshambo’). The ‘Lizard Spock’ version of the game has been made popular by the television show “Big Bang Theory.”

 

Getting Started

Use the statement below to populate the graph with the objects and relationships.

CREATE p=(paper:object {name:"paper"})-[:covers]->(rock:object {name:"rock"})-[:crushes]->(scissors:object {name:"scissors"})-[:decapitates]->(lizard:animal {name:"lizard"})-[:poisons]->(spock:vulcan:person {name:"spock"})-[:vaporizes]->(rock)-[:crushes]->(lizard)-[:eats]->(paper)-[:disproves]->(spock)-[:smashes]->(scissors)-[:cuts]->(paper)

Wipe the database

Use the code below at any time to wipe the database and start over…​

MATCH (n)
DETACH DELETE (n)

Find all Objects

match (n:object) return n

Find all non-objects

match n where NOT (n:object) return n

Find all vulcans

match (n:vulcan) return n

What are the actions for Rock?

MATCH (n:object{name:"rock"})-[rel]->x
return n,r,x

What are the actions for Paper?

MATCH (n:object{name:"paper"})-[rel]->x
return n,r,x

What are the actions for Scissors?

MATCH (n:object{name:"scissors"})-[rel]->x
return n,r,x

What are the actions for Lizard?

MATCH (n:object{name:"rock"})-[rel]->x
return n,r,x

What are the actions for Spock?

MATCH (n:vulcan{name:"Spock"})-[r]->x
return n,r,x