nozama and many others are using Hackety Hack to learn how to code.

Hackety Hack is a free program for Windows, Mac OS X and Linux that can teach you how to make games, applications and more and share those programs with your friends. You can ask other budding programmers questions and follow them to see what code they're working on through the Hackety Hack website.

Sign up Learn More

rps_method by nozama

#this is a rock paper scissors mechanic for a simple roguelike I want to program.
# 0 == rock 1 == paper 2 == scissors.
#this is not really made for shoes tho'. I wrote it in text mate and I ran it in the terminal

#this is the method. 
def hero_rps
	num = rand(3)
	if num == 0
		puts 'rock'
	elsif num == 1
		puts 'paper'
	elsif num == 2
		puts 'scissors'
	end
end
	#this is the iterator. iterator start with 'do' and ends with 'end'	
	
66.times do
hero_rps
end


# of course you need a monster RPS to compare the two numbers.
# Then I think there need to be modifiers.
# For different weapons and such. 
#But the RPS is the random thing.
#the weapons would affect damage. armor should reduce damage.