This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def rand7(): | |
return random.randrange(1,8) | |
def rand5_mod(): | |
return rand7() % 5 + 1 | |
def rand5_recursive(): | |
roll = rand7() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'terminal-table/import' | |
class SubsetSumMatrix | |
class << self | |
def create_empty_for(array) | |
matrix = [] | |
header = [nil] + build_header_from(array) | |
matrix << header | |
array.each_with_index do |element,i| | |
row = header.collect{|value| 'F'} |