First draft of RPS JS code