This file contains hidden or 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
| #!/usr/bin/ruby | |
| red = [4,4,4,4,4,9] | |
| blue = [2,2,2,7,7,7] | |
| olive = [0,5,5,5,5,5] | |
| yellow = [3,3,3,3,8,8] | |
| magenta = [1,1,6,6,6,6] | |
| def compete(x, y, n) | |
| x_wins = y_wins = 0 |
This file contains hidden or 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
| #!/usr/bin/ruby -w | |
| if ARGV.length == 0 | |
| puts "Usage: Enter the number of prime numbers to generate." | |
| exit 0 | |
| end | |
| ceiling = ARGV[0].to_i | |
| # Populate an array called primes with all integers from 2 to ceiling. |