Skip to content

Instantly share code, notes, and snippets.

View chemineer's full-sized avatar

SS Huh chemineer

  • South Korea
View GitHub Profile
#simple baduk board on python3.8x
#achievement so far
#-draw board, lines, star points (GUI by tkinter)
#-play game manually and save game record in sgf format
#
#todo lists
#-realize 'clear board' and 'exit'
#-remove 'captured stone' from the board automtically
app_name='MyBaduk'
def solution(num):
if num == 1 :
return 0
for i in range(500) :
num = num / 2 if num % 2 == 0 else num*3 + 1
if num == 1 :
return i+1 # i는 0부터 시작하니까
Collatz <- function(n) { # 함수정의
counter <- 0 # 반복횟수 계산을 위한 Counter 정의
while(n != 1){ # n이 1이 아닌 경우 계속 반복
if (n %% 2 == 0) { # n이 짝수일 경우 처리 정의
n <- n/2
print(n)
counter <- counter + 1
} else { # n이 홀수일 경우 처리 정의
n <- 3*n + 1
print(n)
# Python program to display all the prime numbers within an interval
lower = 2
upper = 50
print("Prime numbers under", upper, "are:")
for num in range(2, upper + 1):
# all prime numbers are greater than 1
if num > 1:
prime_numbers <- function(n) {
if (n >= 2) {
x = seq(2, n)
prime_nums = c()
for (i in seq(2, n)) {
if (any(x == i)) {
prime_nums = c(prime_nums, i)
x = c(x[(x %% i) != 0], i)
}
}
library(utils)
library(dplyr)
library(ggplot2)
data <- read.csv("https://opendata.ecdc.europa.eu/covid19/casedistribution/csv", na.strings = "", fileEncoding = "UTF-8-BOM")
COVID_KR = data %>% filter(geoId =="KR") #한국
COVID_JP = data %>% filter(geoId =="JP") #일본
COVID_CN = data %>% filter(geoId =="CN") #중국
COVID_US = data %>% filter(geoId =="US") #미국
library(sp)
library(RColorBrewer)
gadm <- readRDS(file = "gadm36_KOR_1_sp.rds")
population <- read.csv("pop_S.csv",header=T)
population_sort <- population[order(population$Code),]
interval <- c(50,40,30,20,10,0)
population_cut <- cut(population_sort$Y2040,breaks=interval)
gadm$population <- as.factor(population_cut)