Skip to content

Instantly share code, notes, and snippets.

View smosab's full-sized avatar

Mosab Sasi smosab

  • Denver, Colorado
View GitHub Profile
@smosab
smosab / rpssl.rb
Created December 20, 2015 23:53
Rock paper scissors spock lizard
# Rock Paper Scissors Spock Lizard
# require 'pry'
VALID_CHOICES = %w(rock paper scissors spock lizard)
def win?(first, second)
(first == 'scissors' && second == 'paper') ||
(first == 'paper' && second == 'rock') ||
(first == 'rock' && second == 'lizard') ||
(first == 'lizard' && second == 'spock') ||
@smosab
smosab / oo_ttt_final.rb
Last active May 11, 2016 03:02
OO TTT with bonus features
class Board
WINNING_LINES = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] + # rows
[[1, 4, 7], [2, 5, 8], [3, 6, 9]] + # cols
[[1, 5, 9], [3, 5, 7]] # diagonals
def initialize
@squares = {}
@human_marker = nil
@computer_marker = nil
reset