Skip to content

Instantly share code, notes, and snippets.

Avatar

Mosab Sasi smosab

  • Denver, Colorado
View GitHub Profile
@smosab
smosab / oo_ttt_final.rb
Last active May 11, 2016
OO TTT with bonus features
View oo_ttt_final.rb
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
@smosab
smosab / rpssl.rb
Created Dec 20, 2015
Rock paper scissors spock lizard
View rpssl.rb
# 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') ||