Java 코드연습

[뉴렉처] 오목판 출력하기

양상추상츄 2021. 10. 17. 11:52

유튜브 뉴렉처 강의 코드문제 연습

		//오목판 출력하기
		for(int y=1; y<13; y++) {
			for(int x=1; x<13; x++) {
				if(x==4 && y==3) {
					System.out.print('●');
				}
				else if(x==1 && y==1){
					System.out.print('┌');
				}
				else if(x==12 && y==1) {
					System.out.print('┐');
				}
				else if(x==1 && y==12) {
					System.out.print('└');
				}
				else if(x==12 && y==12) {
					System.out.print('┘');
				}
				else if((1<x||x<11) && y==1) {
					System.out.print('┬');
				}
				else if((1<x||x<11) && y==12) {
					System.out.print('┴');
				}
				else if(x==1 && (1<y||y<12)) {
					System.out.print('├');
				}
				else if(x==12 && (1<y||y<12)) {
					System.out.print('┤');
				}
				else{
					System.out.print('┼');
				}
			}
			System.out.println();
		}

┌┬┬┬┬┬┬┬┬┬┬┐
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼●┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┤
└┴┴┴┴┴┴┴┴┴┴┘