### 주제 + 실전 프로그래밍 연습 ### 목표 + 프로그래밍을 통한 실전적 문제 해결능력 배양 + 객체지향적 분석 및 설계 능력 향상 ### 커리큘럼 1. 기본문법 2. 메소드와 조건문 3. 반복문과 배열 4. 클래스와 객체 5. 상속 6. 인터페이스 ### 대상 + 자바 입문 단계를 넘어 초급 단계 진입을 희망하는 학생 또는 신입 개발자 ### 시간 및 장소 + 협의 ### 연락처 + 카톡: chaesam + 이멜: [email protected]
# 소개 및 테스트 ## 목차 + 자기소개 + 레벨 테스트 + 피드백 ## 자기소개 이름, 비전, 수업을 통해 얻고자 하는 것, 성격, ... + 박세홍: 스피치 능력 향상 + 전경희: - 자바의 전반적인 이해 for 자기주도 학습이 가능했으면 함. ## 레벨 테스트 현재 어느정도 프로그래밍이 가능한지 ## 피드백 수업을 통해 얻고자 하는 것: 스스로 학습할 수 있는 능력 배양 레벨 테스트 결과 1. 기본적인 프로그램의 알고리즘적 사고 2. 자바라는 언어에대한 문법요소 연습이 필요. 3. 객체지향 개념관련해서 처음부터 차근차근히 진행
# 수업 과제 ## 해당 링크 하단의 연습문제를 제출해 주세요. 1. 기본문법 (http://cloudstudying.kr/lectures/52) 2. 메소드(http://cloudstudying.kr/lectures/173) 3. 조건문(http://cloudstudying.kr/lectures/175) 4. 반복문과 배열 I (http://cloudstudying.kr/lectures/193) 5. 반복문과 배열 II (http://cloudstudying.kr/lectures/194) ## PS 오늘 수업 즐거웠습니다! 그럼 다음주에 또 뵐게요~
# 객체지향 프로그래밍 ## 리뷰 + 제출 코드 리뷰 ## 개념 및 실습 + 클래스와 객체 (http://cloudstudying.kr/lectures/195) + 객체의 생성과 사용 (http://cloudstudying.kr/lectures/196) + 객체와 생성자 (http://cloudstudying.kr/lectures/197) + 레퍼런스 변수 (http://cloudstudying.kr/lectures/198) + static 키워드 (http://cloudstudying.kr/lectures/199) + 연습문제 (http://cloudstudying.kr/lectures/200) ## 미니프로젝트 + 오목 게임
# 수업 과제 ## 해당 링크 하단의 연습문제를 풀어주세요 + 객체지향 연습문제 (http://cloudstudying.kr/lectures/200)
# 오목 게임 만들기 ## Steps 1. 오목 판 출력 2. 좌표 출력 3. 사용자 입력 받기 4. 입력 좌표를 오목판에.. 5. 반복문을 통한 확장.. 6. O -> X -> O -> X 7. 사용자 -> 컴퓨터 -> ... 8. 이미 놓인 돌에 대한 처리 ## 최종코드 Omok.java ``` public class Omok { public static void main(String[] args) { Board board = new Board(19); Player user = new Player("사용자", "O", board); Player computer = new Player("컴퓨터", "X", board); play(board, user, computer); } private static void play(Board board, Player user, Player computer) { Player currentPlayer = user; int count = 0; while(true) { board.print(); currentPlayer = (count % 2 == 0) ? user : computer; try { currentPlayer.putStone(); } catch (Exception e) { continue; } count++; } } } ``` Board.java ``` public class Board { int size; String[][] map; Board(int size) { this.size = size; map = new String[size][size]; for (int row = 0; row < size; row++) { for (int col = 0; col < size; col++) { map[row][col] = "."; } } } public void print() { for (int row = 0; row < size; row++) { // 0, 1, 2, 3, ..., 18 System.out.printf("%2d", row); // ".", "O", "X" for (int col = 0; col < size; col++) { System.out.print(" " + map[row][col]); } System.out.println(); } // A, B, ... , S System.out.printf(" "); for (int col = 0; col < size; col++) { System.out.print(" " + (char)('A' + col)); } System.out.println(); } public void insertStone(String str, String stone) throws Exception { String[] locations = str.split(" "); // 'J' - 'A' -> 9 int row = locations[0].toUpperCase().charAt(0) - 'A'; int col = Integer.parseInt(locations[1]); // 돌이 있다면?? if (map[row][col] != ".") { System.out.println("돌이 놓여 있습니다."); throw new Exception("이미 돌이 놓여 있습니다."); } // 돌을 놓음! map[row][col] = stone; // 5목이라면? } } ``` Player.java ``` import java.util.Scanner; public class Player { String name; String stone; Board board; Player(String name, String stone, Board board) { this.name = name; this.stone = stone; this.board = board; } public void putStone() throws Exception { Scanner input = new Scanner(System.in); System.out.printf("%s> ", name); String str = input.nextLine(); board.insertStone(str, stone); } } ```