Skip to content

Instantly share code, notes, and snippets.

View sotoseattle's full-sized avatar

Javier Soto sotoseattle

  • Seattle, WA
View GitHub Profile
@sotoseattle
sotoseattle / gol2.rb
Last active December 24, 2015 20:56
#!/usr/bin/ruby -w
require "graphics"
require "set"
class ZenspiderGol
delta = [-1, 0, 1]
same = [0, 0]
DELTAS = (delta.product(delta) - [same]).sort

Ping Pang Pong!

You are back to the future. It is 1972. You, freshly out of high school and after a whole night of BBS and root beer have had an epiphany, a great idea that will make you rich: a video game console called Ataxy, and a game of tabble tennis you will call Ping Pang Pong! The goal of this exercise is to write the video game's software.

Using the graphics gem create a canvas in which a single ball/point bounces against the walls.

Requirements:

  • Minimum: the ball hits the wall and shows up in the opposite wall (like Asteroids)
  • Intermediate: the ball hits the wall and it deflects with the right angle.
  • Advanced: Add a paddle (a horizontal movable wall) that you can control, and play Ping Pang Pong!!
require 'primo'
ASS = %w(FF Ff ff)
module Probe
def puffreduce(probs, rango)
negos = probs.map{|p| 1-p}
ixes = (0..(probs.size-1)).to_a
sol = 0
rango.each do |i|
@sotoseattle
sotoseattle / keybase.md
Last active January 2, 2021 19:41
Not to be deleted

Keybase proof

I hereby claim:

  • I am sotoseattle on github.
  • I am sotoseattle (https://keybase.io/sotoseattle) on keybase.
  • I have a public key ASAK-TgRq1RpxsIJdy2K0dMLb8jMNFS68AKZgSOCKo0mvwo

To claim this, I am signing this object:

@sotoseattle
sotoseattle / gist:5123da60acda8cb98582
Last active August 29, 2015 14:09
Reverse a Linked List (should be refactored)
class Node
attr_accessor :val, :next
def initialize(val)
@val = val
@next = nil
end
end
class List
attr_accessor :head