코뚫하 :: 2021 동계 모각코 6회차 결과

문다연·2021년 1월 20일
0
post-thumbnail

21.01.20. (수) 20시 ~ 23시

문다연
결과
https://datascienceschool.net/01%20python/04.01%20판다스%20패키지의%20소개.html
위 사이트를 참고하여 학습했다. 판다스는 데이터를 다룰때 유용할 것 같아서 기초적인 자료형, 입출력에 대해서만 알아보았고, 이후에는 필요시 데이터프레임에 대해 학습할 예정이다.

문혜림

박형기

private boolean[] highrank_list = new boolean[6];
	private boolean[] lowrank_list = new boolean[7];
	public void ranking(int[] list) {
		System.out.println("ranking => ");
		// 인덱스 1~6 사용 각 인덱스 번호당 갯수 저장 예) 22335 가 나올 경우 count[2] = 2, count[3] = 1, count[5] = 1
		
		int[] count = new int[7];
		int total_Dice = 0;
		
		boolean three_of_a_kind = false;
		boolean four_of_a_kind = false;
		boolean full_house = false;
		boolean small_straight = false;
		boolean large_straight = false;
		boolean yacht = false;
		boolean choice = true; // 찬스는 항상 사용 가능
		
		for (int i = 0; i < list.length; i++) {
			total_Dice += list[i];
			int number = list[i];
			count[number]++;
		}
		
		three_of_a_kind = three_of_a_kind_check(list, count);
		four_of_a_kind  = four_of_a_kind_check(list, count);
		full_house = full_house_check(list, count);
		small_straight = small_straight_check(list,count);
		large_straight = large_straight_check(list,count);
		yacht = yacht_check(list, count);
		
		if(highrank_list[0] == false) {
			p1_aces_button.setDisable(false);
			p1_aces_button.setText(Integer.toString(1*count[1]));
		} else {
			p1_aces_button.setDisable(true);
		}
		
		if(highrank_list[1] == false) {
			p1_deuces_button.setDisable(false);
			p1_deuces_button.setText(Integer.toString(2*count[2]));
		} else {
			p1_deuces_button.setDisable(true);
		}
		
		if(highrank_list[2] == false) {
			p1_threes_button.setDisable(false);
			p1_threes_button.setText(Integer.toString(3*count[3]));
		} else {
			p1_threes_button.setDisable(true);
		}
		
		if(highrank_list[3] == false) {
			p1_fours_button.setDisable(false);
			p1_fours_button.setText(Integer.toString(4*count[4]));
		} else {
			p1_fours_button.setDisable(true);
		}
		
		if(highrank_list[4] == false) {
			p1_fives_button.setDisable(false);
			p1_fives_button.setText(Integer.toString(5*count[5]));
		} else {
			p1_fives_button.setDisable(true);
		}
		
		if(highrank_list[5] == false) {
			p1_sixes_button.setDisable(false);
			p1_sixes_button.setText(Integer.toString(6*count[6]));
		} else {
			p1_sixes_button.setDisable(true);
		}
		
		if(choice == true && lowrank_list[0] == false) {
			p1_choice_button.setDisable(false);
			p1_choice_button.setText(Integer.toString(total_Dice));
		} else {
			p1_choice_button.setDisable(true);
		}
		
		if(lowrank_list[1] == false) {
			p1_3kind_button.setDisable(false);
			if(three_of_a_kind) {
				p1_3kind_button.setText(Integer.toString(total_Dice));
			}
		} else {
			p1_3kind_button.setDisable(true);
		}
		
		if(lowrank_list[2] == false) {
			p1_4kind_button.setDisable(false);
			if(four_of_a_kind) {
			p1_4kind_button.setText(Integer.toString(total_Dice));
			}
		} else {
			p1_4kind_button.setDisable(true);
		}
		
		if(lowrank_list[3] == false) {
			p1_fh_button.setDisable(false);
			if(full_house) {
			p1_fh_button.setText(Integer.toString(25));
			}
		} else {
			p1_fh_button.setDisable(true);
		}
		
		if(lowrank_list[4] == false) {
			p1_ss_button.setDisable(false);
			if(small_straight) {
			p1_ss_button.setText(Integer.toString(30));
			}
		} else {
			p1_ss_button.setDisable(true);
		}
		
		if(lowrank_list[5] == false) {
			p1_ls_button.setDisable(false);
			if(large_straight) {
			p1_ls_button.setText(Integer.toString(40));
			}
		} else {
			p1_ls_button.setDisable(true);
		}
		
		if(lowrank_list[6] == false) {
			p1_yacht_button.setDisable(false);
			if(yacht) {
			p1_yacht_button.setText(Integer.toString(50));
			}
		} else {
			p1_yacht_button.setDisable(true);
		}
}

주사위 굴리는 제한을 두었으며 결과에 따라 점수판이 변동되도록 만들었다.
점수판에 있는 점수를 누를경우 획득할수 있도록 만들었다.

유정균
백준 1181 단어 정렬 (정렬)

이문제는 단어들이 주어지면 특정기준으로 단어들을 정렬해주어야하는문제이다
그기준은 다음과같다 길이가 짧으면 짧은순 길이가같으면 사전순

정렬을 잘모를때는 이것을 어떻게 구현하지를 생각해보았지만
이제는 comparable to를 구현해주면 쉽게할수있는걸 알게됬다

우선 단어들을 담을 자료구조를 선언했다 그런다음 단어를 차례대로 추가해주었다
그리고 단어들의 정렬 기준을 compareto 를 override 해서 기준을 정해주었다
위의 방법대로 문자열의 길이 함수를 호출해서 비교해주었고
그다음에도같다면 문자열순서대로 문자의 아스키값을 비교해주었다
또한 출력은 StringBuilder를 써서 시간을 아끼게되었다.

ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
자바잡기술++
comparable 의구현

문다연 https://github.com/dayo2n/2021-winterMGC/projects/1#card-53191919
문혜림
박형기 https://blog.naver.com/qkrgudrl0324/222214303777
유정균 https://blog.naver.com/kyun1229/222214297919

profile
ios-moon.tistory.com 이전했어요 🚛

0개의 댓글