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
# Usage: `ruby calculate_cpf_digits.rb "123456789"` | |
cpf = ARGV[0] | |
cpf_array = cpf.split("").map(&:to_i) | |
def calculate_digit(base_array:) | |
# Constants | |
divisor = 11 # Constant, fixed number | |
weighted_array = [10, 9, 8, 7, 6, 5, 4, 3, 2] # Digits, starts with 10 and decrements by 1 | |
# Algorithm |
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
package a20; | |
import robocode.*; | |
import java.awt.Color; | |
/** | |
* DefMode - A Robocode robot | |
* @author: Roger Oba | |
* @date: September 2014 | |
* | |
* This robot won 2nd place in an internal Robocode tournament. The 1st place had a complex algorithm with over 1k LOC, and most other participants had over 600 LOC ;) |
OlderNewer