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
class Gladiator | |
attr_accessor :name, :weapon | |
def self.filepath | |
'combat.csv' | |
end | |
def filepath | |
Gladiator.filepath | |
end |
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 './user.rb' | |
def mainmenu | |
puts 'select an option please | |
1.- new user | |
2.- delete user | |
3.- consult user | |
4.- exit | |
type a number: ' |
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
#variables________________________________________________ | |
request=nil | |
#methods__________________________________________________________________ | |
def mainmenu | |
puts 'select an option please | |
1.- new user | |
2.- delete user |
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
#programa que cambia numeros a letras, si le ponen 11 les dira que es teenone u 12 teentwo pero no se fijen xD | |
#variables____________________________________________________________________ | |
number=String.new | |
#methods______________________________________________________________________ | |
def onedigit (number) | |
x = case number |
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
=begin | |
level 1 | |
--------- | |
|@ >| | |
--------- | |
=end | |
class Player |
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
=begin | |
PROBLEM 1 | |
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
Find the sum of all the multiples of 3 or 5 below 1000. | |
=end | |
sum=0 | |
for i in 1...1000 do | |
if ((i.modulo(3).zero?) or (i.modulo(5).zero?)) then | |
sum= sum+i | |
end |
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
=begin | |
Ok, me tome la libertad de llenar este programa de comentarios | |
en virtud de que quede super bien entendido ¿ok?, trataré de | |
comentarlo a nivel noobie. | |
=end | |
headers = nil #aqui almacenaremos los headers (les dije que nivel noobie!) | |
rows = [] #se declara un array que de momento esta vacio, aqui guardaremos las filas | |
File.open(ARGV[0] || 'data.csv', 'r') do |file| |
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
headers = nil | |
rows = [] | |
File.open(ARGV[0] || 'data.csv', 'r') do |file| | |
headers = file.gets.split(',') | |
while(line = file.gets) do | |
cols = line.split(',') | |
rows << cols | |
end |
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
headers = nil | |
rows = [] | |
File.open(ARGV[0] || 'data.csv', 'r') do |file| | |
headers = file.gets.split(',') | |
while(line = file.gets) do | |
cols = line.split(',') | |
rows << cols | |
end |