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
// Jere Suikkila kehittänyt metodit: | |
// elossaOleviaNaapureita ja kehity | |
import java.util.Random; | |
public class GameOfLife { | |
private int[][] taulukko; | |
public GameOfLife(int leveys, int korkeus) { |
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
# Solution to [2016-10-31] Challenge #290 [Easy] Kaprekar Numbers | |
# found at https://www.reddit.com/r/dailyprogrammer/comments/5aemnn/20161031_challenge_290_easy_kaprekar_numbers/ | |
def isKaprekar(number): | |
''' | |
Tests every number in range for being a Kaprekar number as defined at | |
https://en.wikipedia.org/wiki/Kaprekar_number | |
''' | |
squared = number ** 2 | |
str_squared = str(squared) |
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
def train_test_split(total_set, test_set_size = 0.25) | |
if test_set_size > 1.0 | |
test_set_size = 1.0 | |
elsif test_set_size < 0 | |
test_set_size = 0.0 | |
end | |
test_set_count = (total_set.length * test_set_size).floor |