본문 바로가기

분류 전체보기176

[프로그래밍언어론] 과제 3 : 함수형 프로그래밍 (Functional Programming) 문제 이미 제출한 대다수의 학생이 Functional Programming의 원칙(No variables and assignments, No statements, No side-effects, Referential transparency)을 준수하지 않는 답안을 제출하였습니다. Functional Programming을 제대로 구사하려면 식과 값만 사용하여 프로그래밍 해야합니다. 이런 사고에 익숙해져야 다른 언어를 사용하더라도 함수형 프로그래밍의 장점을 살릴 수 있습니다. 앞에서도 언급했지만 이번에 과제로 나간 문제들은fold(reduce, foldr, foldl)를 사용하여 하나의 식으로 풀 수 있는 문제들입니다. 현재까지 단 한명의 학생만이 이런 취지에 매우 근접한 해답을 제출하였습니다. Code t.. 2020. 12. 20.
[프로그래밍언어론] 과제 2 : OOP 특성을 가진 언어로 구현하기 (Go 사용) 문제 Write a corresponding program for the given example below (in C++, Java and Python) using ONE of the other languages that have different OOP traits such as separation of types from their implementations (e.g. Go), multimethods (e.g. Julia), implementation-only inheritance thru mixin (e.g. Scala, Crystal), prototypes and delegation (e.g. Lua, Io), etc. You will be given better score if you can.. 2020. 12. 20.
[프로그래밍언어론] 과제 1 : 이터레이터 생성자 (Iterator Generator) 만들기 문제 Develop a program per each of the examples of the Python iterator generator for “sort”(quicksort) and “flatten” in ANY language of choice with the following constraints: You MUST NOT use any constructs that are similar or equivalent to the iterator generator of Python (such as “yield”). You have only to use ordinary control structures (if, while, ...) and/or procedure calls. You CAN utilize o.. 2020. 12. 20.
[C 프로그래밍 실습] 함수 1 (Lab 05) Program 1 : mypow( ) 함수 구현 Program 2 : 화씨-섭씨 변환 함수 구현 Program 3 : 최댓값 반환 함수 구현, 삼항연산자 Program 4 : 원 둘레와 넓이 반환 함수 구현 Program 5 : 단리와 복리 계산 함수 구현 Program 1 임의의 실수와 정수, m 과 n을 입력 받아 다음과 같은 mypow() 함수를 작성하여 mn의 결과를 출력하는 프로그램을 작성하시오. (한번만 호출하여 수행하면 됨) 함수 mypow(double m, int n)의 결과는 m^n #include 에 정의된 pow() 함수 와 mypow() 함수 결과를 모두 출력 #include #include double mypow(double m, int n) { if (n == 1) return .. 2020. 11. 21.
[Tensorflow] 이미지/CNN/회귀 - 무작위로 렌더링한 구의 속성 학습하기 visualization lab에서의 첫번째 deep learning (딥러닝) 프로젝트를 소개합니다. 우선 이 프로젝트가 어떤 프로젝트인지부터 간략하게 설명하겠습니다. 1. openGL을 활용하여 구(sphere)를 20,000개 렌더링한다. 2. 렌더링에서 무작위로 설정하는 속성 parameter 5개는 순서대로 R(red), G(green), B(blue), metallic(금속재질), roughness(표면의 거친 정도)를 나타내며, 이를 label로 저장한다. 3. 위에서 만든 구 이미지와 label(parameter 값)을 train set으로 저장한다. 4. test set에 해당하는 1,000개의 구와 1,000쌍(5개씩)의 label을 렌더링-저장한다. 5. 20,000개의 구를 tens.. 2020. 11. 18.
[Maya] 파이썬으로 모델링하기 (애니메이션 : 키프레임 설정, 숨 쉬는 트리) Modeling with Python (Animation : Setting Keyframe and Giving Breath) 2019. 3. 13. 10:39 일단 pymel 코드를 cmds로 변환시켰다. (애니메이션을 설정하기 편리하기 때문이었던 것 같다.) First, I converted pymel code to cmds. import maya.cmds as cmds import random myPyramids = [] #make pyramids for n in range (2872): myPyramids.append(cmds.polyPyramid()) count = 0 for x in range (20): yran = 20 - x for y in range (yran): zran = 20 - y for z in range (zran): cmds.select(myPyramids[count]) cmds.move(0.05*x.. 2020. 11. 7.
[Maya] 파이썬으로 모델링하기 (미러링된 트리) Modeling with Python (Mirrored Tree) 2019. 3. 13. 10:39 드디어, 어떻게 미러링하는지를 알게 되었다. I finally got how to mirror. 잎의 수를 늘리고, 더 큰 별을 달아주었다. more and tinier leaves, a big star import pymel.core as pm import random myPyramids = [] #make pyramids for n in range (2872): myPyramids.append(pm.polyPyramid()) count = 0 for x in range (20): yran = 20 - x for y in range (yran): zran = 20 - y for z in range (zran): pm.select(myPyramids[count]) pm... 2020. 11. 7.
[Maya] 파이썬으로 모델링하기 (크리스마스 트리 1/4) Modeling with Python (Quarter of a Christmas Tree) 2019. 3. 11. 22:08 지금까지 배운 것을 복습하기 위해 크리스마스 트리를 만들어보기로 했다. 빨강-초록 계열의 랜덤한 값을 가진 색상의 잎과, 맨 위에 노란 별을 가진 트리를 만들어보았다. I decided to make a Christmas tree which has green-red randomized-colored leaves and a yellow star on it. import pymel.core as pm import random myPyramids = [] #make pyramids for n in range (386): myPyramids.append(pm.polyPyramid()) count = 0 for x in range (10): yran = 10 - x for y i.. 2020. 11. 7.
[Maya] 파이썬으로 모델링하기 (크기, 회전, 색) Modeling with Python (Scale, Rotate, Color) 2019. 3. 11. 21:56 import pymel.core as pm myCubes = [] for n in range (1000): myCubes.append(pm.polyCube()) count = 0 for x in range (10): for y in range (10): for z in range (10): pm.select(myCubes[count]) pm.move(x, y, z) pm.scale(x/10.0, y/10.0, z/10.0) pm.rotate(x*10.0, y*10.0, z*10.0) pm.polyColorPerVertex(colorRGB=[1-x/10.0, 1-y/10.0, 1-z/10.0], colorDisplayOption=True) count = count +1 이.. 2020. 11. 7.