��������� ������ ��������� ��� ��������� ��������� 했���, ������ ��������� ��������� ������������, ������ ������������ ����������������� 했������, ������ ��������� ��������� 했���������? ������ ���패했������ ��������� 했��� ��� ����� 하��� ��������� ��� ��� ��������� ���패��� ��������������������� ��������� 하���������?
������ ������������ ��� ������ ���������, ��� ������ ��������� ��������� 해���한 ��������� ���������, ��� ��������� 함��� PairProgramming (����� NetMeeting ������ ������, VirtualPairProgramming)��� 해��� ��� ��������� 함��� ������ ��������������. ��������� ��������� ���������������? ��� ��������� ������ ������������ �������������� ���������(correctness)��� 확���합������? ��� ��������� ������������ ��������� 합������(����� ������������ ������ �����하��� ������ ������������ ������������)? ��� ��������� ������ ��������� ��������� ������해 ���������? ��� ��������� ������ ��������������� ��������� ������화 합������? ��� ���험��� ��������� ����������������� ��������� ������ ���화��� ��������� ��������� ������합������?
������ ������������������ ��������������� ���패한���.. (7������������ ���������.. ������������ ������ ���������) ������ ��������������� ������ ���������������.
���������.. ������ ������ ������������ ��������������� ���패한��� (������ 7��������� ���������.. ������������ ������ ���������.) ������ ��������������� ���������������.
���������������.. ���������������. ������ 한������ 한������ ������ ��������������� ������ ������하��� ������ ������ ������하������... ���효��������������� 확���한 ������ㅡㅡ;
-- ���호
- Facts - ������������:
��� ������������ 해��� ������판��� ���한 ������한 ��������� 하��� ��� ������ ������해 ������������. 판��� ������ ������ ��� ������ ������.
~cpp def testBoardEmpty (self): self.assertEquals (self.bd.GetData (2,2), 0) def testSetQueen (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.GetData (2,2) ,1) def testPrintBoard (self): self.bd.SetQueen (1,1) self.bd.SetQueen (2,2) self.bd.SetQueen (7,7) self.assertEquals (self.bd.PrintBoard (), '''00000000\n01000000\n00100000\n00000000\n00000000\n00000000\n00000000\n00000001\n''')
��� ������������ '������ ������ ��� ������ ��������� ������한 ���������?' 하��� ������ ���해 ������. ������ SelftyZone ������ ���했���. ������ ���크하��� ���해������ ������/������/������������향��� ������ ���크해��� 하������ ������ 4������ ������ ��������� ���������������. ������ ��������� ���크��� ������ ������ ��������� ������할 ��������� ������하��� ���한 ��������� 하��� ��� ������하��� ���������.
~cpp def testIsSelftyZone (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.IsSelftyZone (3,3), 0) self.assertEquals (self.bd.IsSelftyZone (1,5), 1) def testFindQueenInSameVertical (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.FindQueenInSameVertical (2), 1) self.assertEquals (self.bd.FindQueenInSameVertical (3), 0) def testFindQueenInSameHorizonal (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.FindQueenInSameHorizonal (2), 1) self.assertEquals (self.bd.FindQueenInSameHorizonal (3), 0) def testFindQueenInSameCrossLeftTopToRightBottom (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.FindQueenInSameCrossLeftTopToRightBottom (3,3), 1) self.assertEquals (self.bd.FindQueenInSameCrossLeftTopToRightBottom (1,1), 1) self.assertEquals (self.bd.FindQueenInSameCrossLeftTopToRightBottom (4,1), 0) def testFindQueenInSameCrossLeftBottomToRightTop (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.FindQueenInSameCrossLeftBottomToRightTop (3,3), 0) self.assertEquals (self.bd.FindQueenInSameCrossLeftBottomToRightTop (3,1), 1) self.assertEquals (self.bd.FindQueenInSameCrossLeftBottomToRightTop (1,3), 1)
~cpp def testGetFirstCornerInCrossLeftTopToRightBottom (self): self.assertEquals (self.bd.GetFirstCornerInCrossLeftTopToRightBottom (3,3), (0,0)) self.assertEquals (self.bd.GetFirstCornerInCrossLeftTopToRightBottom (4,3), (1,0)) self.assertEquals (self.bd.GetFirstCornerInCrossLeftTopToRightBottom (1,5), (0,4)) self.assertEquals (self.bd.GetFirstCornerInCrossLeftTopToRightBottom (0,0), (0,0)) def testGetFirstCornerInCrossLeftBottomToRightTop (self): self.assertEquals (self.bd.GetFirstCornerInCrossLeftBottomToRightTop (2,2), (0,4)) self.assertEquals (self.bd.GetFirstCornerInCrossLeftBottomToRightTop (3,5), (1,7)) self.assertEquals (self.bd.GetFirstCornerInCrossLeftBottomToRightTop (7,7), (7,7))
해��� ��������� ��������� ������. ������ ������ ������할 ��� ������ ��������� ���해 ������������ ���한 ��������� ���해 ������했���.
~cpp def testIsAttackableOthers (self): self.bd.SetQueen (2,2) self.assertEquals (self.bd.IsAttackableOthers (3,3),1) self.bd.SetQueen (7,1) self.assertEquals (self.bd.IsAttackableOthers (7,1),0) self.assertEquals (self.bd.IsAttackableOthers (4,4),1)
해��� level (0���������~7���������) ��� ���해��� ���������하��� ������ ��������� ������������ ���한 ������트 (���확히��� 튜플)��� ������������ ������.
~cpp def testGetUnAttackablePositon (self): self.bd.SetQueen (0,0) self.assertEquals (self.bd.GetUnAttackablePosition (1), ((2,1),(3,1),(4,1),(5,1),(6,1),(7,1))) self.assertEquals (self.bd.GetUnAttackablePosition (2), ((1,2),(3,2),(4,2),(5,2),(6,2),(7,2)))
해��� ��������������� �����하��� ���한 ��������� ������ ���크 ������ ��������� ���해 (������������) ��������������� 52������������������ ���������. 하������, ������ Queen ��� ������하��� ��������������� ������해��������� 3������ ��������� ���������. --;
- Feelings - ���������: ��������� ��� ��������������� 한편��������� ���팔������ 하���. -_-; ���.. ������������ ��������� ���해��� ������ ��������� ������ ���������. ��� ������������ ������하������.. ������ ����� ������������������ ������ ������������ ��������������� ��������� 한���. (��� ��������� ���해������ stack��� ������ recursive ��� ������할��� ������������������������������) ������ ��������� ���해������ ��������� test������한 ������������ ������해��������� ���������.
���������������.
������������ 항��� "What is the simplest thing that could possibly work?"������ ��������� 하������ TestDrivenDevelopment��� 했������? 테���트/������ ������클��� ���행하������ ���텝��� ������ 하������ ������했������? ��������� ��������� ������ ������ ������, ������ ��������� ���했������? ��� ��� 테���트 ������클��� ���텝��� ��� ������하������ 했������? ������ ������ ������ ��������� ������ �������� ������ ��������� 테���트��� 하��� ���������? (������ ������ 한��� ������ ������하��� ������ ������ ������) ��� ������ ������������ ���해 ��������� ��������������� ������ ���������������? 테���트 ��������� ������한 ������ ��� �������������� ��������� ������������? TestDrivenDevelopment��� 해������������ ����� 패���하������ 하��� 테���트 ��������������� ��������� ������������? ���트������ ���하��� ��������� ��������� ��������� ������ ������������? ��������� ������ EightQueenProblem��� 파������������ ��� 30��� ������ ��������� 50 ������ ���������(테���트 ������ ������) ��������������. TestDrivenDevelopment������. --���������
.
������ ������ ������ ������하��� ������ ���해������ ��������������� ��������� 힘������ ���������. (��� ������ ������������ ������������ ������ 훈��������� ������������ ������ ������ ������) ������ ������했������ ������������ ���������, ������ ������하��� ������ ������������ ��������� ���해 TestDrivenDevelopment ��� ���키��� ���했������ ���������. (������������ ������ ������함��� 호��� ������ ����� ������������������ ������ ���������������. )
������������ ������ ��������� ���해������ 80/20 ��������� 통���������������.
3��������� ������ ��������� ������ ������ ���������������������.
.png)
~cpp def DefineQueen (self, Level): if Level == 8: self.Count = self.Count + 1 print "%d. level : %d \n" % (self.Count, Level) print self.PrintBoard () return 0 PositionList = self.GetUnAttackablePosition (Level) for position in PositionList: self.SetQueen (position[0], position[1]) Ret = self.DefineQueen (Level + 1) if not Ret: self.SetData (position[0],position[1], 0)���, ������ Queen��� ������������ ������하��� ������호��� ���������������. ��� ��������� ���한 TestCase ��� ��������������� ��������� 판��� ���해 ��������� Queen��� ������������ 확���하��� ��������� ��������� ������. ������������ ������ ��������������� ������������ 했���������, ������������ ��������������������� 확������ ������ ���했���. 확������ ���해������ 테���트��������� ��������� ��� ��������� 할텐���, ������������ ��� ��������� ���해��� 테���트��������� ���������������.
��������������� 'Level 8������ ������ 판��� ������ ������, ��� ���황��� ��������������������� ��������� ������해��� ��������� ������������ ������트��� 하��� ��� ���������, ��� ������������ ���해 ��������� ��������� 했������ 테���트하��� ��������� ��������� ��� ���������' ������ ��������������� ������������ 하������. (��������������� 100��������� ������������ ������ 하������. ^^;)
��������� ��������������� ������������ TFP ��� ��� ������했������, ������하��� ������하������ ���������������. (������ Queen��� ������ ��������� ���한 ������호������������������ ���������함) 테���트������������/������������������ ������ ���한 ��������� 하��� ���������������. (��� ��������� ���해������ ���������. ^^;) 흠.. ��������� 'The Simplest Thing'��� ������������������ ���������, ������ 해��� ��������� ���해��� ��������������� ������하���, 해��� ��������� ���해 Top-Down 형태��� ��������� ������������ ��������� ���해 테���트��� ������������������ ��������� ���������. --������
������������ ������ C++, Python, Java ��� OOPL��� ������했������ ��� ��� OOP��� �� ��������� ��������� ��������� -- class 키��������� ��������� OOP������ 하��� 힘���������. ��������� ��������� ���하������ ��������� ��������� 평��� ������한 ��������� ���탈���티��� ��������������� 하���. ��������� OOP��� 편하��� ������하������ ��������� ��������� ��������� ������������ ��������� ���������������. ������ ������ ��������� 푸������ OOP��� ��������� ������������ 하������ ������ ���������������. --���������
������ ���호������ �������������� ���������..
Eight Queens program written by Marcel van Kervinck
~cpp /* Marcel van Kervinck <xxxxxxx@xxxxx.xxx.xxx.xx> */ t(a,b,c){int d=0,e=a&~b&~c,f=1;if(a)for(f=0;d=(e-=d)&-e;f+=t(a-d,(b+d)*2,( c+d)/2));return f;}main(q){scanf("%d",&q);printf("%d\n",t(~(~0<<q),0,0));}
When the program is run, one has to give a number n (smaller than 32), and the program will return in how many ways n Queens can be put on a n by n board in such a way that they cannot beat each other.
Note that the d=(e-=d)&-e; statement can be compiled wrong on certain compilers. The inner assignment should be executed first. Otherwise replace it with e-=d,d=e&-e;.
Note that the d=(e-=d)&-e; statement can be compiled wrong on certain compilers. The inner assignment should be executed first. Otherwise replace it with e-=d,d=e&-e;.
���패한 ������
- ������ ������ ������, ����� ���획 ������. ������������������ ������한 ���������, 크���큰 ��������� ��������� ������하������. ������ ������ ��� ���������. TT
- ������ ���한 ��������� ������판������ ��������� 하������. (������ ������ �����히한 ������ TT)
- TFD��� ������하���������. test��� code��� ��������� ��������� ���하������. ���, test��������� ������히 ������������ ���한 ��� ������.
ThreeFs
������한��� PairProgramming��� 하��� ��������� ��������������. TDD��� 하��� ������ 30������ ������했��� ��������� 1������30������ TDD��� 했���������.
������한��� PairProgramming��� 하��� ��������� ��������������. TDD��� 하��� ������ 30������ ������했��� ��������� 1������30������ TDD��� 했���������.
������한 ��������������� ��������� ������ ���해 헤��������� ���������������. ������ TDD��� ���하��� 파트������������ 테���트��� ������ ���해할 ��� ��������� 한 ������ 페��� ��������� ��������� ������������������. ��������� ��������� 파트������ ���������, 파트������ ��������������� 하��� ��������� ���������������. ������하��� ���해 ������ ������ ��������� ������하��� ��������� ��������� �����������������.
������한 ��������������� ������하��� ��������� ������������, ������������ ��� �����하������ ��������� ���������. --Leonardong