kitsune2.0/0000755000175000017500000000000010650431430012002 5ustar cyrilcyrilkitsune2.0/Changelog.txt0000644000175000017500000000271410625374012014442 0ustar cyrilcyrilChangelog du programme Kitsune ---------------------------------------------------------------------- Ce Changelog indique les modifications principales de chaque version. ------------------- Version 2.0 -- 27 mai 2007 ----------------------- * module de rsolution : possibilit de rentrer ses propres solutions * adaptation du code pour la prise en charge de plusieurs langues * traduction de l'interface en anglais et en japonais * passage au code html dans les fichiers d'aide * rglage de la valeur des plaques et du compte avec la molette de la souris ------------------- Version 1.2 -- 15 octobre 2006-------------------- * amlioration de l'icne pour windows * le style par dfaut est "plastique" * enregistrement des options dans un fichier plac dans le $HOME * modification du comportement des +- pour le compte * possibilit de changer le nombre de plaques, la plage des comptes * possibilit de rgler le temps de rflexion dans le menu options * affichage du tirage avec les solutions ------------------- Version 1.1 -- 9 septembre 2006 ------------------ * correction de deux bugs dans les fonctions de canonisations (1 et 3) * dcompte des 50 secondes rglementaires lors du choix alatoire * calcul en tche de fond (thread Qt) pendant le dcompte * affichage des statistiques dans un fichier * possibilit d'activer/dsactiver certaines canonisations ------------------- Version 1.0 -- 13 aot 2006 ---------------------- * premire version publie de Kitsune kitsune2.0/appliwin.ico0000644000175000017500000003535610552722615014346 0ustar cyrilcyril00 %6  % h6(0` gmhf225'R|   qaPDYvxbWN 444gggooo\\\HHH666)))AAAiiiRRR&&&{,6b/g 555yyyrrrxxxXXXFFF@@@T )Y#tttuuuEEE*,-  !'QZ~ZZZSSS555~~~iii+++49?  Am Fz}:e| 85[*I6&  29@tvx333wwwSSSqsu $7 [j$ 1Ud Ev*@ DJO)))jjjJOS =exh  / T .vy{'-2  N3Reeeaaa (  uu Am$5 "( %8a T kmpAAA > &_}x _>?AWWW uD  $` Fz ?n ] K5\ 7b5 W$ .O1U*J X&B r) [ Jk S.D% 5Y"B^(<j V)'y 2UV O0F&sSz5+J~ W _uF *I  W W Cu| .& /#n6] j L  Oow M /n0S%> i Ar@!%? Hj 8_vnx;f -Nc  -c  Ol)G *J7_( Z  y~ n Ri*3H $< Dv ^_h7^ 'B #`%? &@,La ?nn,M  $. Ex(D -P3 H| #  U Ctmci$=5Z|b<r  c  Gv(OO????( @ pse9 9u### s\M=165 ;x"""$$$:::tttvvveeeccc777???_i^geee񰰰lllwwwuuu]]]XXZ%  ny[ c JQX:::yyy RRRmu|-:Sf 8? zvmM9R!.;cksCCC>JT8Qi H} j5n>[)4>nv}(5AJs6NLSYlllAX xpXTZc 8` oopooo%%%/ 5[ Exg$? Fzj U =i!:  ~$cf%7U~r  k J})Pq ;c =h /v(Fw ^/D N /M8Su W D M:e O 9` 1! zzo!:A ' Ap { 1Ud  r Fyx < ?m 7bW.{! 4V Ms 4W}4Z14X= (A;ZQ{1 5 Yt*I n `eK &;fu+N P{h   2Us-O{ $  O \ q!# k4 ; I|??(  1# \UW333HHH\\\ց}}}kkkddd```ZZZ888&&&'''F,(V-L&9O~?3s=癋et y}>u~,9҈JDw˯.<5W&_Jф \)uuӔS.F~{>~\W[k|SU vVKDvlr'6|UyokBs.:Guvnw2f=QD$x(,[$JAw6q7~#뀨L7,!u1(Q,k^0 ڸqѭ?ZRf pǼ0hRʫY1G~vR⊖?95yb kBv{T z *8P`ĈbY {'9~iZ͓⯷rr F k X.Gdv K~~AUU"J?c"g(+ f@3Ó;Ǥ fȖ}}}}]555%1>,BE~"_\_Q՚T5jEjl;+|DLJ"#Hvh?}իW[EQ4{=`,˦mLQJAd2uB5egTWg~ 6P[F ~ ɐ4MFBXٔSd3 3t]_-wou/L/h#6!ؚj80 1i D9P($1ARvG) F"ȸS>]7%6:NV|D/`:ig3@e 034.%)$8pSWUu( >N2 pEFFSl]ByhR$ɦ)ݖ @@XP@zLyez7Tjy?`4_ L!I28aE1 ,ohh8kmmuve|V- (V?mWfq\տU)=IENDB`kitsune2.0/images/grand_divise.png0000644000175000017500000000047310615612075016426 0ustar cyrilcyrilPNG  IHDRr ߔbKGD pHYs  tIME )y2 tEXtCommentCreated with The GIMPd%nIDATHU cl!lxG+!CPU#|4:B3cÏ7qVwGJyi$AO j6SFD RUE+auϔ4-^,-RLsύ?7l 9IENDB`kitsune2.0/images/grand_egal.png0000644000175000017500000000041410615611771016050 0ustar cyrilcyrilPNG  IHDRr ߔbKGD pHYs  tIME !ytEXtCommentCreated with The GIMPd%npIDATH핱 -Ǡ` cOG)-Bgl!u]vz3 bf֚Z+f&9Pa)sE-PTC9\ZN~\T5CIENDB`kitsune2.0/images/grand_fois.png0000644000175000017500000000054710615613455016110 0ustar cyrilcyrilPNG  IHDRr ߔbKGD pHYs  tIME UtEXtCommentCreated with The GIMPd%nIDATHձ ?@`8Zhr!1 09]2f9 m185,ѕ,ŁXJs۞̦S|T~{+Q VDϞ UU=c¯՘t$Z,,[\{wwǟ915]IENDB`kitsune2.0/images/grand_moins.png0000644000175000017500000000043010615611637016264 0ustar cyrilcyrilPNG  IHDRr ߔbKGD pHYs  tIME t^tEXtCommentCreated with The GIMPd%n|IDATH E[ݏ18t ߓ&"$h@컑P^i>%f]8p-%3WSZ.%!B$"]MfF)uPPU ]:1aB}OpBg~6.P\IENDB`kitsune2.0/images/grand_plus.png0000644000175000017500000000053710615611663016131 0ustar cyrilcyrilPNG  IHDRr ߔbKGD pHYs  tIME n.M#tEXtCommentCreated with The GIMPd%nIDATHV Uق';dc v`F`맕Z%mKH<a:'kl%iRc:Bf'Y*'n^O8PtտeΒPEf&~4Sk2M)!8RJ9%^fSjJɐ(^[W];^2O|Ϗ;<$?uIENDB`kitsune2.0/images/heureux-150x150.png0000644000175000017500000002061610552722613016377 0ustar cyrilcyrilPNG  IHDR<qbKGD pHYs  tIME ) IDATxwxTU?g$$! = -` ! (EbCu(u]emqł"tk$63!$g&;{{PQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQirPNR1 R*I~ D%*J[@nt Sԟ1 _z^w]nk%m[1OYw͔@)WCz_&޲m B_гV@[&O&`5mt{T9al!r& kl:`ClB z-R(AT 5Ьg[Y[5|3&Bԣ{Dڷi"Lo"C$ }3]v ӱjM yCJ{^p B *V@Xt+rEHh|\Uͽ3mtthxdp5POj ^F+ꨬ!{q0?Lz!UVboik ZjުXt1 ,! h VV] r"M tr'UTW)p{6UXuGZ,3dUH3 8]s 'sJz*f:TB79^ 0ߤѭ]k 7v3#M|P bҤgoNzPf>~lxza +<@#.KZ@7JhwMsb8]8#?29.c ZE}9_êI"$Uef3Ɂٺl ,|{ <9^^XfX[ª&.u|`B`0kQ47n-.ɣ{k;KwR9 oIV&{S1\R>v1X_b={m?r}dK>z*ڥ@K[X!t1 i%YQ+Ʒ 15ė1lJvbi\\IU }a%s:Q^5k;nZ.EU a-QGf^ G!ƈ\tY`}H RO߮0sܺ* V-ݍC\،[">krWykH6(k*VR*ZXn؜U[-^V_xP ?qU#zF#`D_I[iUxªjWL0bb4ae_hGPG;OBD.",PN际d8o_+[Viô T-@sı)kb%$|k׷0qmBdov,3s@>`:i4y\Q@EC3A]dG m+XB@vz:t*ZVs!Q|(ϗg`d+YYü8"vX΁?vҲ׹s=d,p, ܵEz37syDsеemV5 0Uq@ff+PG^W3nbYCYCǰ??f~*ak83#,ĶRnkVosUXq/nv|QZ2]LUcIZī~f; bxhn5PUD>#MDxf ׯ{:q5L׾/CN"HZڠT-5]i,kE#-%ABlrª8VOmUt,C |K@?`X+$X1v)λ) .~6;^:ڇMvssH:n pª~BX9$ܜ"#es[!jUX7CKa݃6n1\|UaՈNWYr=& 'rҡ=XF#UN>}K[+Xz[E_AZve q4Lzeܘ7\*K'h׳^;׳)wO7i*XbSVy7UX@< څhz' $o=MZ%4@÷DkFz].W;Gs=v| C6a5 )mYnjpK &+D'3_#s?_iqܒA@ J..UX$`f٢ uԳ5IJ'gSC l1BD3FUR*\LH`8NI !WEU! N%K( Ua%to,gZPTlZ4$JʀŪ*]wﲊ SnV~7ݳ_ӝ>VywԳ+b>-`Ɏry0&ȼQ_5S_]kKC ܈#n:3K9dT9Q D\n`5¥., _"A| eAd97MլC9ԏI{)侥,~vzy.kcEG1<+ڙ P[ p B ֆYn@B߳yR\mUગ,6oKpIMmʒnG"_eX dNf=z;BzZ۴s3"~N\$I60@#[Rx$Lo?wTmu_XĴO @dvvc,&޻Z\`PG=VϯM5܂!{gRǙ-yeH5-`~ߓ!¨oxSlən7߃KsHT;KoIN\cیr9tppv*j.䝭%ķ;R)WtK*`3 #8%Eܵ1_ʌR1W˷EdG ən4p^%A[`k}m7$xJEHTFcJ>JP _țcndH'?̾I-a] |=ax$]dqO7#~[_sAb)%;\mguu] mWus)硯g^78.e^i4J#Ga= @Mi5J(¨%u{$ppO7vY %2D}8mTBAتKX #:F؟y~T䐬D;_RzŴa1 QP#zL7P`pGC \@dRuH;/ݎ m И0G 8 ֳRp\nɿ7BZg&wң"@n-)N6pBd!dy>͎V%44L\.יVJz߁(5)KYZ+)%OUAVmnG>ͧ.78EbXUD~Ao"""G߀e0M(<Da0_;=?NoA1Cy]GY4R,gq褛f!̛{oc(S]a#(?ϮaYDxh`}|/].d[=l9J>B-A X98h00aDz)BBB 3+("79 k4r%N(Ιx6DuK9}F0gv{ pMgw?;30vAFF(d(@(&?__֠׿`_i/׫$9ͮ.3\$u&%]axljh)L&rss&;+lώI %n-uĶRWY:H>b_7YTK)ٔdѶ>N]}OQ屋YjAv™/x8U]h'g-ӃDu_8v)IW-6nݺnڵ#00<ANN$&&Ns23ܾF Zjmk źk8͹XgdҪ15%,^B)ſjۦ ㉌|ximp8طo$%%{nv'%U% xʹu&W%|vzNx{wѣGÔ̜9hЋIP2 B!B5xn`=>d2[}R]n{(R>}λ:w^Eh-)4y|l&kWuF\\FM6\ "pI)z[t{('8/a= *P#ye˖1zK>g}#a,` -)S0cƌFٺ˸… y@qDJ9:\Uf=,*nQ=s3_w8ݒ#G+T[+#dӦMXc(Ve7e^@cǿ0Bi߮:_}~7֯_ONNFJdd$QQQDEEa]V]vral66 t:}U;h2[ aEdhq_~˅HJ0el5-,mPCV]i2W:!i>om.l21VAALNN>dv֭[Ν;֭[?({{nYPPP-ϗ?hpzXq1(}"3ht HP>}1{n)m߾]fi޽{kn[;2<<H!D:pgC%L(S}2$$D[N66z -[\q'å^ׯ_^&J!YرСC1a .]Ȭ:ƦMdpp[#LNNF*+`y"o߾233S6fM&ٿ ˗K( \ti155Un۶MYF.[L駟?l>am7Gv,..#N VZoILLFBiƍO>Y&eB3M#y$ v*_z%n:yA*+9o޼RA_~2))N}˓'O :Y8w(يU8[P./Ghll,]vYSv+Wh"V^(]h X9(c}BF=N111{.dSC`,Ze˖|(P֩oLZWPR:ݽ[/%""BǗܹ79’%Kx9pxUOKJh֭[hC۸?@L,B-wPwߟ-Bo!?VOWƁN5tW3B7(/4WmCa!Ҟb~ !BĦN@Q=ċcswSh_ytr3CWZOjjx\ ڀ٨pV_fU M oF;z<LcڛP7\.]0zhj DV"@M'&Ь\``tsE*?T#4b5쿟HBЪ= OBjFlk@{Q#RFvnF)P㇆wk|Z!`B#u0w J\pKos_QN+*p9p;>A\jvxIyT5̈́ZeyB =~_g$ԢATb@.G32":` 1ӧcp{5xB-^0SWMXX&ªۂi>B@'n( iD\$Ӝ䗈X Ћ@9I,ALOV'=#UsEJ N>bZ[ZZ7kQ'ӗ w_k[/oPU `+E?#V#LUnJwܢ?C6f:W1#|kK)o.ek:FV`y)uq7fnUx$ 4S (<0]UJE.4psr%%N(rQ06̴~>ȄoNGzw%N+*1tk}fGdݙng{T&v Iaٔ`rLXN t B6;-us_G4vec&=˭^b;@F,}r%&U A 5kmTTiaWpw(fNcL-a5)$6dk)ȐLd Xo`Pڅk3E\Kd Y^!;I~H˗|3Ě%kfW z&UuPU`N &*HVmBҿ邑X:`.^fjvU]aBO3{;4 A@(}V$Q4!3D/bQ-;Zm Gp<߃nб6_d|ƺ.ҮbJ0 k-pծR~=GN G}GutlgN@m3j6WJw2d~9RRQ(XfB,u(:(v < ~"?[AtE;-2WeO!k!͍X"׷dN^tcmOs 5nMV Ki {8z]?GzZ0c-d^Ss V",~!g <=5QK{2]UHa4J:sEj˃W z 1vf8ޞcí-]##P`&\t2u- 1rò>Ts,OJ %ik{EaH;OFք@oM0 pxYǨI+ 2xHG2 XѭBt̹y@A"p/bKuR*W.@md1{sŞFm,D< W~}ĺ ƍY"* !VOe9+Rw)%eRuq'Ī+05{K%جcOq[743s@!#8-+} ˟@jFa^T*]M$o( hbε6VN bpG?xX㍳Tr3uo>*D[+o/F@Y-6X,7s=Ҹzgk) 7>]6zl5ӂ]5*&!)XUc<ПXˉ˾ C~ 7`xg9Eʤr .tnkhbS'Rb9YXUyO9+UE'Wy8ݒ#4.:[XX8/7J#Jd㢆$֕.}yo1Ft24‡L\a?"xrLv9@!V<2gaTj{Up쯪,^7 J\M lri P0g+ֿQƍz#O tce2(>5]+IDZ*s56;ZuNs?u!sLXaA3 (l{ "Eykc:S ߕW?ga#-N Z**Д_፯Kxqc y J x6oVbkA&=|05 4ĥ_ [ɾ_ƪczBT#Ȳx3K@:>ulU 5A/hM>OSTbsPzu[pq`fc㻛}p:` Eu;Dڐ#:X1%\hx//uwSZ:3NK>⒧d1nHF*t 6/mVJGp&6Vj_S[N~@ `WtiY&KwU!Qkߓb2-N4 Go|Y?Vk}R޻5pe|p=X|ui9nn>9}l[x$-h{|xP(ŪzntӫH P|N^Yc۵mu760s^:_n6"$t]#fB Rs Tl붞`Cuycͦ@eS"7_NϢxHJJ[n'PZZꛛtXju <|W [KoU!Jշo_^}UbbbZXVM\},X;*:C I@@)A t =I㤛EtEjm^=t7\e y+@خ];/^Lk}]vpB/^LAo;[!񹹾u ӱvzcξ..cn)@L~FncfXIOv0~/S1Yfa>K+gϞ~T gU^yX3fZH"Myn^m[aXhٲ%)!x<'NƑ#G:Z1A:&43dم_GTTfbԩժqFϟϚ5kx|3|s%oixkb&hQ'o(aRfɌ5#FбcGBCC%%%qVX~Hqqym ̍=̍Rзi6119s0jԨ3捻oP'nIĐvMx|lZ%<e܇c1[{HLLld aݺu̝;?FbmL)X, 2"ʪT%ZପV$V: pm7&5_OY;Jz!ثW/ƍǤIYbF.]4h'ȶmۘ={6kVƣM5P+'4l}eܱYh2dBF->.Q/rSm<8Q'l}ĢED~~iɓ⩧~g.5 "ZĦw[Řy9R,xzߨ^F!cs|?-,Y接K &xұ_~bb5eڵbȐ!BQ?)֯_?㏋CbŢ~S;mbP!W[=@SĶ!k":HwHթ^3/ ,U~?xUW} 999pw<(|AѢE >k})ƌ#cgjPuT?șPɯm۶Ǐ/j-n*~i*z~D >\z %6m${1ѡCjd4EJJJE"ާ ԕw*⟪h*X6 !gu@Wdd Snjobڵ";\IDAT;[cPq $>#s+Wz^;VݻW?C %Y"QjÊ>fӪ. 5fdSv)S ={\06Y]GXx~0b~#;;[⋢[n#rc}{9FH,Ik݋LQBCCOsQXX4Xd#JʱNW776\鈬n0vJBB)GXX97vsq2339v:33[j%T֡.-J*G=@u8XXE覂*֮/Hhtrj|,--رcdeevQ-=Uz)<ͻ.kJ Uϑwտ2ecCc!VUU]upH%I#zO3Q5XT诒I]y}&DU Z2ե^ ~U.Uu^0yM?Se<{4u!,2Bjp`:| )hNӆ 6dMȘ€P)<Wmڰ5}Tm(Gnyנጰ*(YZ7i8 T9A=?Z* gNߤ+F* 阭I=tjPk\JKjfd# jwr^h׺JCmaRg{#2d]jud8V7FCAAC\nH4\R 4hРA 4hРA MDIENDB`kitsune2.0/images/reinit.png0000644000175000017500000000273010617375336015270 0ustar cyrilcyrilPNG  IHDRr ߔbKGD pHYs B(xtIME'#+@eIDATHݖmle}?yk9=6t+K#jb [Lgf {QFEbbB$!d! 5) qi (:e2 }qv}=myy9uC>x%sss1~xrE6=@'d)`TgՒQ"C@wZ7VhTaz1*gf2,3:ZdJ;Ѿu/P KG9/,p߱3{̀]-O#f׷G ҈Y͂:@,=}W&8.8E <7bg&9RՆe1{b_U@エҌpjH?;LI(g:fPSH4%G_wiJCԞHnE_` o$H$;JF ύ6,%v䬈STُ<8{ ^Enލ32lh3k/UN!GN7rZ67Ij:F}; K`6UaxءBv[Rǜ :5#zᖸ!St|0Ig[$nA'ajz5 ؛!'z.ƌ_x Z 6xIϟ͗(Q(+4cwE)=܍nJ5 A'Op$ʜ.Dpy ]1w ,8 P,A}Z@ @02Fv:$ZD(bVvn'6R4rloZʕu]8Hnp8Ќ²CiwZ?5Jʣ#7^@ J5SP : T2a.X=ӽPz5r FOazrC:a0ABH}ǟ|ETߢ/Ioבԇ1׷09 1VzkVۏ?o2›w(hh&Q?q=A:~0S 9i_-Wc%9"BLhG'_ '~(M,QP|Y][n41[A tmw`3Ig*q;Z ec_}iS_gtOY"VXw@nqc`Gl5w__Tӹ*+^ì to& ɛ|̋ JX }`ْ.e%V)@˪VI|9D,ћt+3ڡjչ Si[#܀^FFi[eXd. TtPX?A,u\Ѥ旧r+kk0PЧme ־e_΄t' g&R1dusK/J]YeM~P-Xͦ .h[ǺTI0CUbϧa9<l:n\sINblCr_^b}U7Lx z6$W~*er wEAŜm'ilznuXL¨܈el1DqV cpNFb:n?i&Y5;t6ܦ!U9ؿ0ܫhv5}@*dOKgQQѯ}UT*='F9] R^v_":%Vɣ.`(Hb]Lq0hI y͍tIAIOI$ NsZEdБa4$@i SqGu%Vi 1V9`oy; nq?ZLQEjD!gpࣆ[鯩sXْMv^bꄩ1=ang(~]YܘNS"nUc"| hL~Zo]_g؇`i'r2"%VIWpoYU-yYI l|2ZnbE0xe2_@.xUVy ;rjv^9lv^b$0'^+ C=D4KL2.`u$6 8o\pBehi(PUQ0 U2|L>{A ]wz \6*XP 5v;eCg\&;yf5 (`F[C%VikBA,!EODcUjd]jG*iL 3ѵ֕F~D,L`l:p5Γ%=F)3eMz5C&x7) 7Mw !1k\|6'?Ԗ{gN|o]eL/JϐVz.:O p NN79t69϶*$xHoonU6*7t\54X%f_1nRQ;Tͩݤ L;e>32ҩOv\Ѥ~~Ov:d>P'8B9`9c|w OG-,jUA"VX%j__J\ 6n95el9fBhTICJ˥~`f\tpǬ$fw/ 3,a^b^5HEjjP),NMȹ*41پr&5 x JǨSOc8X0%V}"< U/LͨvzGQȔz6q/KXKwOszK^bݰ^8u53{Z/ѣVI5@H}wBipK J8˦\L~E-{jφhJg,+V]u3t]()1/uLz V ]$mMmBDns |x9"@ŅC]Y,"cf fr^6]%V) z?۹ڃ7**)P>d*1=WK|;DÊR~ ͕;b,@M`ԫzdB_ܤ)ZT8B~UkW%:2(;3+zrK2'le~Fj\3D y/mkYy+ _eQ>0 {K)K%V{DUfĊ4r޺^de5-o?NE/XQj.J!*e5L?^(hE)2H&jUòGLj:DyrGR3AYj=~<˚BGZ,X9zUGz6u ^{QkIW#n @t[J9ʗŁE(SeI%'p0$"T| "JLGZ>^mKF9:t+Y( Ws/3J4yс_R3: o>/^EXAɒU<0/i2%}Zϝ%,X?tJK1(+(G"[ZiM+%T RܭVaPw8Xi>z!N'W#2kWB7t|4: DW4RFECKSO Q7~W_mhp˾Jƒ!!IrG$e_{DjV`)%!ͽ.ҩn pQ*%iu{/ji2Լ F]j֗n")Iׯr! 7Vr."YU7Q#iABTAeVϙ˲'mP1gvب0aB«WLr:Ip[Gsb8dQ3Nz Lϟ0y<؇=c ҅+Mb3YzWmZH +AT# | XQ5qbi܇PM$K=x`# !IQh,_.[23QM@M6z22Gm*Īk߉} 7c-QĞ=|L gF/Cw^om`wաAvL[`,YY$qxvv|5GmGN :y\g$)d9W`Aiق ,3ReRK} 4H|%%6Ӧk^󇱻w3wp.8IT/hX)*[-(%فTI.E-Ү ?`4<$IfeIhV% Q"?/oEF/Q.>I׮$$2Rm굹QQ9^VZ¡-[i%xojuq1oH5˴aʚ ͷC2;cD;[j (~sD9}j L]'W`;B@!*M qI^!Mm$f=p_C=j*&;x}C&Kvx՗#;Ʇ}<\-cs+@ajצQDԭKxd|2ȶ_IFp h r~Sv~?c6%9eAeD oT[[ kaxk` +٩Ye -j U۴$,&|FJN 7,.IthK|YxhY*Vf 5v;l%2,2244*Nf}˖V۬V~YoxKN+ζ@$e0-M%˖sFCZ|_NdY XppfIS$^uw- }>kcTT>z1/FjhSCV-` KᤲbLD3*k4zϙ.lXشd)߾xKBuQ1cvz 1.9Fg^6$ϑ;AEppSK't~_!k{FBrfL2CMwI/zVXp0p$Nz~tv_6 1r]g{ iDcj_C:D`Ws)ߤE[>yĝJУQxW]ß;^ԇϫ%4D,!+Ӭ >еlGFYIBB7˩{vcFϒUf`9z]]W94 RNJ&TEk4hߎcrtU0/Aw}:2om䕟2gO?JzVxQ2H,w>wZjb_ViyޔErB*Wiݻ쀏$'o@?\_{c=N%֮KN?XQc,\8z3cnՒtҽs64ճl,HIeë()?=^- [?je! $P][Bt׮zS< 2;3V6ܐ:2I>gK&ϮJϞ]}7x6?3o[P7eJ(G[Y>Dy![kE.Sh$(" C⇍E^阕'cSPxx/;¨zf=h N꾚HY&*RË1Dm`,!3wk&I5g_K8\uaIfvfI3;赢n#92$"\ - ! ^_mKN^^\ _-c( 9Z ]֗Ov[' j.5TL1bQ2iSDavczZ6Mm%UɮEnTTĝ<ޗ2l˲XghS*+>ޑ֭tf_DRo!I7$F?-,lvC@abg?E4FR_X~]ׇG>Me9튈%޹2ٜYN>kU5mn~`ϙx,-bjk:1л6Ů364S %)HZFĆ7eE٠rQm}Ip?DxoIe`(RϻvFW-hk%Ê>@$z ReT=@U/p:e#Hs|R{ڸQjqUSѫAՃU\cE`g6vo+iVJ kIH1bE+z!\OE"/»TnRq94'Wҝ$e؝"vpCSܯu|_$ȋ3 Kgak;y2(5n3cb4FB #uNY}. }%~@oFr?gYXzڴiCǎiԨ:VիW8{,'OСC$%%} ꇫ݄_QC`!dOR]!''"kksKBwz/Rk`{5 vAtteZjcƌUbG5P Bb 5 ׃ J~:>fB_%9Xe8{5 FRQn] "88 0={GsZZa*V_a&pBƌS->>aÆa[׶ z"PFuh1ĊT|\;~C%t"006mжm[ڶmw܁TzJJ 111̞=+WP 婠'/:4U,ڴi]}^Y={6SL&JAZsqXBsD'LV>-%;Y3vdq>9[:3p@FIK$9o<9lv; +;)?TyftrӮٳ'f'~KI7V!F`aye>3fINtt4ǏgРA %Bᆪti]&+&L(v9~8ǎ#&&X222p:8NGT2tP\Pwි ӊBvT49>*Y뼝1V~ *pJKsteDf1mC~ DPHR&oXFDi65XU]up肝C;9pH׮]ׯ ǧĉ4hr VZL8#G⟫OLL -[$++m,ydTVUl>LƍP3gdΜ9$'{VO`BcI)(xQەwĪ6s'8ަ IDATbHbS\Hvr!ɅdOvsNrVFѣG>:tV{c< s% ;wҨQ#\9x /WV+WҲeۙ>}:* D7yjɄ@E楗^b̙9>~JkوTB(&Z(3JS1?f\Iw2fYY:xoIlE;`4iBTTtڕU7n ,`00k,zGnݺsvZN':ycPEuҥKbljժqŋՋ4&z\$Vs thTq%ݙ{5 C$BCC$22jժETTQQQDFFٲe ˡFׯO.]ҥ ݻwwM61dr̘1̟?m{-^\x ȭmFNHLLu֞,EYBOb=C69I_P_4k֌=z`20F aaaT\J*.*i>}aÆsNW}7ٳ'gϞ$$$пxY$::ÇӰCSo8#2^N$.ȑ#Yp!ݺuc˖-?B\B \ ʸ\ϓHEԳiZ,X#ȶmزe 7o&66VW^Ӈ˗Obɓy뭷ظq#{/P 4atܘdbذa|;D5E3taMT[IƪUh߾=:bccoo9tP q7x)SУG~g ^ Dc4'+`pyjW`|XAӦMٺu+M4v@hh(;vgȐ!TXDZsm޼0ZjEfX0> T0X{Y "fgUTD"j&u۷/k׮B ܎ cǎ7Rbׯ^zt҅ w;yY6[qv{l#"L믿~tRSSX,Ӊy~~ ##/3gr9|}}پ};UVN:H++XiN"_Jp{{\y[CFaѢE >?Zo@/Zv^]~:Y} !r">*> fԩx19VL) $ wɹ748'KˍQ{|lx&Lŷ@vXx1 4Ȗ4k0`V+jktpw8Tn~:9yz.Db=B!҉APtEa2"Qz\\ .triFܹs3:.2$>mvI^*=Pr锩<- ⼲bST~7z<Ri[9"S$tY&-Z?D%I\HqT$pz%" ܫL"yb3",gd{UወuIe{=4iBRR ͙\kGqDV"Z@@VGfuj6h;7s+ <2O|ܠ:̍d)3Gz>9瞣N Y~\skڈL`bw*QX\,IJn{z9`Sy$k8>⻒`ryoe*7|>oYopzQN0EF8,FmD;K wXgr}s:OnkJEE8ovz=Y`~F+}]mV*Nq_㸽ɨ̤oTTV1a" l"&brC[ט]DHQտY,?H>F^b * vu-+4IU&yӈTōPl+oRL"pE9YD&f~d~V$H~ }v.~BI棭r#?)`FgG4Q|^R]!ؤSnf~c,ceXyo˭r?Snt 3R%qQ7$=w],H,m-j/#c1Im;){[P!rεK^x^x^ܒDIENDB`kitsune2.0/kitsune.icns0000644000175000017500000010256410552722615014363 0ustar cyrilcyrilicnstics#H@???@???is32;wet}99mrl#LN@}T)Q:FF̓N5Naǁ ԸrH6p ogV G+ɳ8;7F{ǜlƆwp AƁUj}KM FO]kwssp?)<!A 9BE=D>F-,R)JQ0J- nY(%v+-6r {kDn&@ B?[4l '+melQ ^ukgmm$37FGs[LnƆu\ZR @ŁUj}z50 FO]kwssp?)<       + )7F&ZƆrF" <āUj}j FO]kwssp?)<s8mkB 7G/$Fku^竳WޝF\U1# ICN#0px????0px????il32""$6U յU (%d. $AZ4"5N #VsWZ1Z:.swU'u%#ӈ= j`1!# DMSʁ%}qch/F7  bx?zk=$(Ѓ“` po&*+7 [>}AsށNYp ͼR;sԀCTQ{)"W :y R|:8h lwu]Z%(+'>z³|ki7@#;+-&*/,   /{M\Q{h 2s n `e9u (;Q{ Yt, 4M4}44!bWA Dv1dCzo! <O9^/N/8uV jJP;=v'cf%U~ r  8Dg$FjS=" xpXTZc8 oo&* n>4v5J6SpzvmK9.kԀCJ8iF O :y Ru-Sf h lwu]X (+'>z³|ki7@#;+-&*/,                 )     oo&* )n(Lp !cԀC>H :y Rmh lwu]X (+'>z³|ki7@#;+-&*/,l8mkI;k $qN K={<r {AMz Dw~$X/jAށc?ny[ ;x_i^g 9uǵs\M=165e9spich#H <~~???????P <~~???????Pih32 =Z3{ tnM ".xD^#?@MF r ΋ ] /" u  ޕI5J ҋUF&ރkD%Y^<( WjDwP2ЅgɍKpH_  U2c$OUJC " zn\5AU  ˇ m5 ( 8 pA  ..{2Rea  Uv@ O )jS eЄ 8\J6$ @x 3wSu7YS5~i+?mzetuE-! 5xrxXF?  4gijn\I7)BiP%   brc$4G UCm>n+E( ^_h6`%&+y~ nP1$B c Ol(*7Z %H8 vnx; -c 0% iAOowMjJ5C|U)_ +~y2VO0s=S.5B(jV 4K.kE9 x; t,O1dm6Y J< n8U.1*X% ` F?]K5 ]}x_?U  u uA$"%a T mA Ty-N3ea 0dE* J )jO =xh 4) 9v 3wSs$[jYS5~i+9 AF}:tuE,  5xrxXF?  4gijn\I7)BiP%        -              "  '   )          >U     kA  v' ea  D )jJ 2t 3wSq  YS5~i+4 tuE* 5xrxXF?  4gijn\I7)BiP%  h8mk (Gvc< i|P #-'Bai*@n/&nW. FuzWS'W3)!5rDb &u>($|Z~ͣ#'Q/gT )YN{,6b'R|ϾqaPDYvxbW522hfgmit32#AC K4 S$}Yw5K; qx)   3O8ӄ< dǀb/p^+{|Dl g6Qx!\ϛS 0r:tN~mu/ qK^%p 8 M'l ƀ3Ղ; &p!h+1ςZ pVc?;?63ւ{ F|7R_m^qj+" sm; [m |[ Gy|SIU qbڃ_( 1rR ҂ (BG3ф}bL>5/)#MJ7 79 ` M|P4f7 t`< Ѷ`f{`kC4-dQW[W a܃X]%Ȧ'T Դm(;Z0w* K2'oAz4ܺ[) R+H5H`e@а<ݏ!g *KEp# C'Dρ$uStW%?&|g9+$ڧYS<~qߒO%[U*Ivڕs)N }oLwؗ܉D%ܨb2#?~sޚuSA*}-}j1eJ;+ IM3hxYeCEHO4eBRx0: -ͫRB+z 4=ߛ9^5%ax/~rŁϡP!d[![K!g$sz>)ڍ2AȔΏ9n41I Яr7 8.9׬]8  Sdށ ⵊ`@-  ϙ Ӎ, +{) : &ާUb ϚIG@ 6y 5 ཙY >sn6;MvӃL CߕVIƓ ڥqG'R S-4W~ $j˔C ᶊ_8&h Wٿ+Fz\ԑ AnͳdJ# Tl- 4߀U  *RJ~>:'Hg7B?;8$i sʩ_LG @؀Q&cȪ>9F:*Yd2sɃq Rmyo({4#NS=uӃ#)EG{I؀!-Ճ,   *hȅ4?# &(-41*)[AAӓ+Y e)԰g/Fg q%(-Z7 %;gԻnP8+(%"$+>nP~`E%% 8^ζiO6    >\`\XTOKGC=, V&'+bUqkl_0UzHez 3E+M#AEax nfnj $/!zW *`|:s9A AGG](>H%N0E 6wZ0!P"C-I?D O56AV ^Qjx 6_nq >v rp{}" ]N c<  x4 N`<KL9$ "$$|H 2\X'q/7? 7AuHik Q^M "w4YM_nJH5 2UX;M^21tc uNj8g7  nsN/ y -0x\I8,$ ,+&  7 4e|ywH. P: CB#b xi7v.U osQO : /2 h\g43J935R tak1mLffL{?"4}MaflgE Xg+@u  %G5mZk/J})g)eq7:z% x["yIq ;`~ +0Nf` Vj'(xR^:Cc2}%mW^I!o3:Le*Y]O g. Zx@_;]3Z]S~yB-U X^N w\5[]T}O' 8#Z\ZVd,Y]P sC_1.Z[_Hk X^KR;+"I*6[[`$<{T^?:n'(*7[[`%:&:T"`d!w//Z[_FW%"W! e6%Z[[R8 jFbPY]Prl]xd.N sG_@n5J ,ICFSu#Kr~&s xS ?Ylt)[ xfB ]mkheb_[VXx`!` |cN6!   ^|/ 9iP7% e”] "$ v& PM({Z s/5~m^QB2# "1CTal~2NSqE) 0;987615\f2ӌ;` r0(nŶq Cu|8Lp d( ~ F "lm%`قH$x zQ , {* dWާU8 xY)F @]F!5 LnX2 >sn6;MvӃ K %]v2*r~`A) S S-4W ~ : ((h;7B?; di sʩ_LG $Z}r/jcȪ>9F:*Yd2sɃq/S?FkR@({4#NS=uӃ%Yj()vGI؀!-Ճ,   *hȅ4?# &(-42+)[AAӓ+Y e)԰g/Fg q%(-Z7 %;gԻnP8+(%"$+>nP~`E%% 8^ζiO6    >\`\XTOKGC=,             "   %    )     )     1   /)(1    0- 5! *0(  1O" ,-   $LP1   #  FPQA  @RQ;    ?I  5                   (   +1  -1& .0) !2.0+   .1) /0+  ./. .0) //1 -1'  //2 ,1 //2+//1    .//    .0) $1!  &                "QM "s/  N   4><;:952ӌ;,oŶr$ L  ~H`قH  -|,   ާU  G @ "5   ?sn6;MvӃ K U S-4W~  &j Wٿ+F{  Vl- 4߁ ,SJ~>:)7B? ; i sʩ_LH cȪ>9F:*Yd2sɃr    ({4#NS=uӄ(   I؀!-Ճ, *hȅ4?$ '(-42+)[AAӓ+Y e)԰g/Fg q%(-Z7 %;gԻnP8+(%"$+>nP~`E%% 8^ζiO6    >\`\XTOKGC=,t8mk@?,# !h6<5|Qb/|/Ts$&;@yko_ O! 7bJ$ I Ss F ]E<)dPc1ynL*';5EXN}Xdq, RVx?!u1_F!i h7#<e1: Bi Io]"b\Ol^ ՂH<k2Z+>"kF5g; CJKs.}0J:gS|/č[1!u?# =Rdxn'$I/b&J݆>oÅ"ܑ~-@Վ;o|~a:#m) =a*9` Se?% *>Sís!:tEpk#g 7jDYX k4hxv13M_& ˧#>r4˩J ,\ЅF 5Y /^v_B)2d{cDu* 7UsȽq[E.!r%58531.,*(%?Jwm-A8ҙb`o ƊRC0<#v``%q+i;4} ckitsune2.0/kitsune.pro0000644000175000017500000000332610650431430014212 0ustar cyrilcyrilTEMPLATE = app DEPENDPATH += . src INCLUDEPATH += . CONFIG += thread RESOURCES += kitsune.qrc # Definition des configurations de compilation win32 { DEFINES += WINDOWS RC_FILE = kitsuneico.rc CONFIG += static } unix { DEFINES += LINUX TARGET = bin/kitsune CONFIG += static } macx { DEFINES += MACX RC_FILE = kitsune.icns CONFIG += x86 ppc CONFIG += static } #choisir un mode de compilation parmi release, test, debug ou profil CONFIG += release profil { CONFIG += debug QMAKE_CXXFLAGS_DEBUG += -pg QMAKE_LFLAGS_DEBUG += -pg } # utilisation du flag TEST dans les fichiers lors de la config test test { CONFIG += release DEFINES += TEST } # Input HEADERS += src/calcul.h \ src/jeu.h \ src/tirage.h \ src/global.h \ src/widgethorloge.h \ src/widgetoperation.h \ src/widgetoptions.h \ src/widgetpopup.h \ src/widgetplaque.h \ src/widgetprincipal.h \ src/widgetresolution.h SOURCES += src/calcul.cpp \ src/jeu.cpp \ src/kitsune.cpp \ src/tirage.cpp \ src/global.cpp \ src/widgethorloge.cpp \ src/widgetoperation.cpp \ src/widgetoptions.cpp \ src/widgetpopup.cpp \ src/widgetplaque.cpp \ src/widgetprincipal.cpp \ src/widgetresolution.cpp #liste des fichiers de traductions pour lupdate TRANSLATIONS = kitsune_en.ts \ kitsune_ja.ts isEmpty(PREFIX) { PREFIX = /usr } isEmpty(I18NDIR) { I18NDIR = $${PREFIX}/share/kitsune/i18n } target.path = $${PREFIX}/bin i18n.files = kitsune_en.qm kitsune_ja.qm i18n.path = $$I18NDIR INSTALLS += target i18n kitsune2.0/kitsune.qrc0000644000175000017500000000154610620435717014212 0ustar cyrilcyril images/grand_egal.png images/grand_plus.png images/grand_fois.png images/grand_moins.png images/grand_divise.png images/gomme.png images/reinit.png images/normal-150x150.png images/heureux-150x150.png images/triste-150x150.png txt/about-fr.html txt/about-ja.html txt/about-en.html txt/aide-fr.html txt/aide-ja.html txt/aide-en.html txt/licence-fr.html txt/licence-ja.html txt/licence-en.html txt/gpl-fr.html txt/gpl-ja.html txt/gpl-en.html kitsune_en.qm kitsune_ja.qm kitsune2.0/kitsune_en.ts0000644000175000017500000001644210626040162014526 0ustar cyrilcyril Principal &Fichier &File Kitsune Kitsune &Info &Help &Quitter E&xit &Options &Options Ai&de &Help &Licence &Licence A &propos &About Résoudre Solve Aléatoire Random Mise à zéro Initialize Licence de Kitsune License of Kitsune Aide Help Tirage : Selection : Le compte est bon ! Solvable ! Il n'y a pas de solution. Unsolvable. En attente. Waiting. Calcul en cours... Computing... Durée du calcul : Time elapsed : :/txt/about-fr.html :/txt/about-en.html :/txt/licence-fr.html :/txt/licence-en.html :/txt/aide-fr.html :/txt/aide-en.html Compte : Target : Gagné ! You win ! Perdu. You lose. Jouer Play QObject Solutions utilisant %1 plaques: Solutions with %1 tiles: Approximations utilisant %1 plaques: Best approximations with %1 tiles : WidgetOptions Options Options Simplifications Simplifications Activer "2+2=2×2" Use "2+2=2×2" Activer "sous-calcul" Use "optimal intermediate results" Activer "factorisation" Use "factorization" Règles du jeu Game rules Temps de réflexion Round length Nombre de plaques Number of tiles Valeur minimale du compte Minimal target Valeur maximale du compte Maximal target Options par défaut Default options OK OK Localisation Language Fichier d'options incorrect. Incorrect options file. Suppression Deletion Le fichier d'options a été supprimé. The options file has been deleted. La suppression du fichier d'options a échoué. Deletion of the options file has failed. Sauvegarder les options Save options Exploite la propriété "2+2=2×2" pour diminuer le nombre de solutions Use "2+2=2×2" property to reduce the number of solutions N'affiche pas les solutions dont un sous-calcul est lui-même une solution Don't display solutions whose part is a solution itself Considère comme équivalentes les formes développées et factorisées d'un même calcul Consider factorized and developed form of a calculus as equivalent WidgetPopup Licence GPL License Traduction de la GPL Translation OK OK Traduction de la Licence GNU GPL GNU GPL License Translation Licence originale (anglais) GNU GPL GNU GPL original (english) license :/txt/gpl-fr.html :/txt/gpl-en.html kitsune2.0/kitsune_ja.ts0000644000175000017500000001674010626040162014517 0ustar cyrilcyril Principal &Fichier &ファイル Kitsune Kitsune &Info &情報 &Quitter &終了 &Options &オプション Ai&de &ヘルプ &Licence &ライセンス A &propos &Kitsuneについて Résoudre 回答 Aléatoire 乱数 Mise à zéro デフォルト画面 Licence de Kitsune Kitsuneのライセンス Aide ヘルプ Tirage : カード :  Le compte est bon ! 正解あり Il n'y a pas de solution. 正解なし En attente. 待つ状態 Calcul en cours... 計算中 Durée du calcul : 計算時間 :/txt/about-fr.html :/txt/about-ja.html :/txt/licence-fr.html :/txt/licence-ja.html :/txt/aide-fr.html :/txt/aide-ja.html Compte : ターゲット: Gagné ! 正解 Perdu. 残念 Jouer スタート QObject Solutions utilisant %1 plaques: カードを%1枚使う回答 Approximations utilisant %1 plaques: カードを%1枚使う最適近似 WidgetOptions Options オプション Simplifications 単純化 Activer "2+2=2×2" "2+2=2×2"設定 Activer "sous-calcul" “計算部分”設定 Activer "factorisation" 因数分解 Règles du jeu ルール Temps de réflexion 考える時間 Nombre de plaques カード数 Valeur minimale du compte ターゲットの最低数 Valeur maximale du compte ターゲットの最大数 Options par défaut デフォルトのオプション OK OK Localisation 言語 Fichier d'options incorrect. オプションファイルのフォーマットエラー Suppression 削除 Le fichier d'options a été supprimé. オプションファイルは削除された。 La suppression du fichier d'options a échoué. オプションファイルは削除できなかった。 Sauvegarder les options オプションを保存 Exploite la propriété "2+2=2×2" pour diminuer le nombre de solutions 正解の数を減らすため、"2+2=2×2"を使う N'affiche pas les solutions dont un sous-calcul est lui-même une solution 正解の一つの部分が正解だったら、表示しない Considère comme équivalentes les formes développées et factorisées d'un même calcul 因数分解の計算と展開の計算を区別しない WidgetPopup Licence GPL GPL ライセンス Traduction de la GPL GPLの翻訳 OK OK Traduction de la Licence GNU GPL GNU GPL ライセンスの翻訳 Licence originale (anglais) GNU GPL GNU GPL 英語正式ライセンス :/txt/gpl-fr.html :/txt/gpl-ja.html kitsune2.0/kitsuneico.rc0000644000175000017500000000010010552722615014505 0ustar cyrilcyrilIDI_ICON1 ICON DISCARDABLE "appliwin.ico" kitsune2.0/script/0000755000175000017500000000000010626312563013316 5ustar cyrilcyrilkitsune2.0/script/release_nux0000755000175000017500000000063710626277076015575 0ustar cyrilcyril#!/bin/sh # script pour construire le binaire statique sous linux # ce script doit tre lanc depuis le rpertoire kitsune avec la commande : script/release_nux #Cration du fichier Makefile et des fichiers ncessaires Qt qmake #Cration des fichiers binaires des traductions lrelease kitsune.pro #Compilation make #Compression du fichier binaire avec upx (paquet upx-nrv sous debian) upx --best bin/kitsune kitsune2.0/script/release_tgz0000755000175000017500000000235210626277076015563 0ustar cyrilcyril#!/bin/sh # un bon tuto : http://www.lea-linux.org/cached/index/Dev-shell_script.html # script pour construire les paquets tgz contenant uniquement les fichiers versionns # ce script doit tre lanc depuis le rpertoire kitsune : # on lance ./script/release_tgz # et on rcupre le fichier kitsune.tar.gz dans le rpertoire bin #ce script prend en argument le numro de version #exemple : "script/release_tgz 1.3" cre le fichier kitsune1.3.tar.gz #WARNING : ce script cre un tgz sans rpertoire racine #suppression des anciens fichiers s'ils existent if [ -f bin/listing.tmp ] ; then echo Suppression d\'un ancien bin/listing.tmp rm bin/listing.tmp fi if [ -f bin/kitsune$1.tar.gz ] ; then echo Suppression d\'un ancien bin/kitsune$1.tar.gz rm bin/kitsune$1.tar.gz fi #Cration d'un listing des fichiers versionns #la commande svn list -R utilise le serveur et prend donc du temps echo Listing des fichiers versionns... for FICH in `svn list -R` ; do #On copie les fichiers normaux la fin du listing if [ -f $FICH ] ; then echo $FICH >> bin/listing.tmp fi done #Cration de l'archive echo Cration de l\'archive bin/kitsune$1.tar.gz tar czf bin/kitsune$1.tar.gz --files-from bin/listing.tmp #Suppression du listing rm bin/listing.tmp kitsune2.0/script/release_win.bat0000644000175000017500000000074310625374012016303 0ustar cyrilcyril@REM ce script est prvu pour tre lancEpar double-clic sur l'icne @REM on se place dans le rpertoire kitsune cd .. @REM release des traductions lrelease kitsune.pro @if errorlevel 1 goto end: @REM cration du makefile Epartir du fichier .pro qmake @if errorlevel 1 goto end: @REM compilation make @if errorlevel 1 goto end: @REM compression de l'excutable obtenu upx --best ./release/kitsune.exe @REM pause pour pouvoir lire les erreurs :end pause kitsune2.0/src/0000755000175000017500000000000010626312563012601 5ustar cyrilcyrilkitsune2.0/src/calcul.cpp0000644000175000017500000004622310617375337014567 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "calcul.h" #include "tirage.h" //Initialisation d'un calcul vide, par dfaut on le suppose de type additif. calcul::calcul() { est_plaque=false; est_additif=true; signe=true; //par dfaut : positif valeur_calcul=0; //par dfaut : 0 } //Initialisation d'un calcul partir d'une plaque. calcul::calcul(const plaque &plaque1) { est_plaque=true; pl=plaque1; valeur_calcul=plaque1; est_additif=true; //par dfaut : additif signe=true; //par dfaut : positif } //initialisation de la variable statique (par dfaut, on est au niveau suprieur) //utilis pour ne parenthser que les niveaux infrieurs bool calcul::niv_sup=true; //Fonction d'affichage d'un calcul, fonctionne rcursivement. //Elle affiche dans le sens inverse du stockage //(on stocke dans l'ordre croissant selon l'oprateur < dfini plus bas, et on affiche dans l'ordre dcroissant selon <). string calcul::affiche_calcul() const { string resultat; if (est_plaque){ stringstream ss; ss << (int) pl; ss >> resultat; } else{ list::const_reverse_iterator it; string Plus=string("x"), Moins=string("/"), Parenth_debut, Parenth_fin; if (est_additif){ Plus="+"; Moins="-"; if (!calcul::niv_sup) { Parenth_debut="("; Parenth_fin=")"; } } bool sauv=calcul::niv_sup; calcul::niv_sup=false; //niv_sup passe faux resultat.append(Parenth_debut); it=sous_calculs.rbegin(); resultat.append(it->affiche_calcul()); //affichage du premier calcul additionn it++; while(it!=sous_calculs.rend()) { if (it->signe==true) { resultat.append(Plus); } else { resultat.append(Moins); } resultat.append(it->affiche_calcul()); it++; } resultat.append(Parenth_fin); calcul::niv_sup=sauv; //on rtablit la valeur de niv_sup } return resultat; } //operateur d'galit sur les "calcul", dfini rcursivement bool calcul::operator==(const calcul& a) const{ if (valeur_calcul!=a.valeur_calcul) { return false; } if(est_plaque!=a.est_plaque || est_additif!=a.est_additif || signe!=a.signe) { return false; } if(est_plaque) { return pl==a.pl; } //les calculs sont gaux si leurs sous_calculs sont gaux //list::operator== appelle calcul::operator== d'o la rcursivit return sous_calculs==a.sous_calculs; } //Oprateur de comparaison sur les "calcul", dfini rcursivement. //Rgles de comparaison // 0.calcul ngatif < calcul positif // 1.petite valeur < grande valeur // 2.plaque < calcul plus compliqu // 3.calcul additif < calcul multiplicatif // 4.calcul court < calcul long // 5.rcursivit sur la liste des sous-calculs bool calcul::operator<(const calcul& a) const{ if (signe != a.signe) { return !signe; //rgle 0 } if (valeur_calcul != a.valeur_calcul) { //rgle 1 return valeur_calcula.valeur_calcul calcul calcul::operator-(const calcul& a) const { calcul resultat=reunion(a, true, true); //type_additif==true et opposition==true resultat.valeur_calcul=valeur_calcul-a.valeur_calcul; return resultat; } //oprateur de multiplication calcul calcul::operator*(const calcul& a) const { calcul resultat=reunion(a, false, false); //type_additif==false et opposition==false resultat.valeur_calcul=valeur_calcul*a.valeur_calcul; return resultat; } //oprateur de division, on suppose que this.valeur_calcul est divisible par a.valeur_calcul... calcul calcul::operator/(const calcul& a) const { calcul resultat=reunion(a, false, true); //type_additif==false et opposition==true resultat.valeur_calcul=valeur_calcul/a.valeur_calcul; return resultat; } //inverse les signes de la liste des sous-calculs void calcul::oppose_sous_calculs() { list::iterator Ci; //calcul i for(Ci=sous_calculs.begin(); Ci!=sous_calculs.end(); Ci++){ Ci->signe=!(Ci->signe); } } //fonction unique pour raliser toutes les oprations : on a rsultat=(*this)op(a) avec op = +, -, *, / //type_additif et opposition dcrive le type d'opration raliser // "+" : type_additif=true opposition=false // "-" : type_additif=true opposition=true // "*" : type_additif=false opposition=false // "/" : type_additif=false opposition=true calcul calcul::reunion(const calcul& a, bool type_additif, bool opposition) const { calcul resultat; resultat.est_additif=type_additif; //si a n'est pas un calcul de mme type que l'opration, alors a est un sous-calcul du rsultat //sinon ce sont ses sous-calculs qui sont des sous-calculs du rsultat if (a.est_plaque || a.est_additif!=type_additif) { resultat.sous_calculs.push_back(a); }else{ resultat.sous_calculs=a.sous_calculs; } //dans le cas o l'opration est de type opposition, on inverse les sous-calculs if (opposition==true) resultat.oppose_sous_calculs(); //on ajoute *this au rsultat de la mme faon que a if (est_plaque || est_additif!=type_additif) { resultat.sous_calculs.push_back(*this); }else{ resultat.sous_calculs.insert(resultat.sous_calculs.end(), sous_calculs.begin(), sous_calculs.end()); } //tri des sous_calculs resultat.sous_calculs.sort(); return resultat; } //-------------------------------------------------------------- //Fonctions d'analyse des calculs //-------------------------------------------------------------- //fonction renvoyant la liste des sous_calculs au sens large d'un calcul, de profondeur 1, //de taille >=2 car ceux de taille 1 ont dj t vrifis comme tant canoniques list calcul::liste_sous_calculs() const{ list resultat; if(est_plaque){ return resultat; } int nb=sous_calculs.size(); calcul calc_temp; compte valeur_calc_temp; calc_temp.est_additif=est_additif; //calcul des puissances de 2 indiquant quels calculs on garde int deux_puiss_pos=1; int i; for(i=0;i::const_iterator Ck; for(i=0;isigne==true) { valeur_calc_temp += Ck->valeur_calcul; } else { valeur_calc_temp -= Ck->valeur_calcul; } } else{ if (Ck->signe==true) { valeur_calc_temp *= Ck->valeur_calcul; } else { valeur_calc_div *= Ck->valeur_calcul; } } } k=k/2; } //on garde les sous-calculs de taille >=2 et 1 && nb_calculs calcul::liste_valeurs_combinaisons_enfants(bool utiliser_tous_enfants) const{ list resultat; list::const_iterator Vi; //valeur i list::const_iterator Vdeb=sous_calculs.begin(); //dbut de la liste des valeurs (optimisation) int i, i_temp, j; int taille_liste=sous_calculs.size(); int trois_puissance=1; //c++ c'est vraiment de la merde, y'a mme pas de fonction puissance... for(i=1;i<=taille_liste;i++){ trois_puissance=trois_puissance*3; } bool contient_zero; compte somme, prod, div; for(i=1;ivaleur_calcul; } else { prod*=Vi->valeur_calcul; } break; case 2: if(est_additif) { somme-=Vi->valeur_calcul; } else { div*=Vi->valeur_calcul; } break; } i_temp=i_temp/3; } if(est_additif && (contient_zero==true || utiliser_tous_enfants==true) && somme>0){ resultat.push_back(somme); } if(!est_additif && (contient_zero==true || utiliser_tous_enfants==true) && prod%div==0){ resultat.push_back(prod/div); } } return resultat; } //Fonction rcursive dterminant la liste des comptes obtenus en rorganisant les fratries parmi les descendants. //A utiliser avec le boolen "utiliser_tous_enfants" false. list calcul::liste_valeurs_combinaisons_descendants(bool utiliser_tous_enfants) const{ list resultat=liste_valeurs_combinaisons_enfants(utiliser_tous_enfants); list::const_iterator Ci; for(Ci=sous_calculs.begin();Ci!=sous_calculs.end();Ci++){ if(!(Ci->est_plaque)){ list popo=(Ci->liste_valeurs_combinaisons_descendants(true)); resultat.splice(resultat.end(),popo); } } return resultat; } //renvoie la liste des valeurs des sous-calculs au sens large de profondeur 1, de taille >=1 et calcul::liste_sous_comptes() const{ list resultat; if(est_plaque){ return resultat; } int nb=sous_calculs.size(); calcul calc_temp; compte valeur_calc_temp; calc_temp.est_additif=est_additif; //calcul des puissances de 2 indiquant quels calculs on garde int deux_puiss_pos=1; int i; for(i=0;i::const_iterator Ck; for(i=0;isigne==true) { valeur_calc_temp += Ck->valeur_calcul; } else { valeur_calc_temp -= Ck->valeur_calcul; } } else{ if (Ck->signe==true) { valeur_calc_temp *= Ck->valeur_calcul; } else { valeur_calc_div *= Ck->valeur_calcul; } } } k=k/2; } //on garde les sous-calculs de taille >=1 et =1 && nb_calculs::const_iterator Ci; for(Ci=sous_calculs.begin(); Ci!=sous_calculs.end(); Ci++){ resultat = resultat + (Ci->liste_plaques()); } } return resultat; } //renvoie la liste des valeurs des sous-calculs de profondeur 1 au sens strict tirage calcul::liste_valeurs() const{ tirage resultat; list::const_iterator Ci; for(Ci=sous_calculs.begin(); Ci!=sous_calculs.end(); Ci++){ (resultat.tab[Ci->valeur_calcul])++; } return resultat; } //Fonction renvoyant le nombre de plaques utilises par le calcul, ncessaire pour jeu::afficheBase(). int calcul::longueur() const{ if(est_plaque){ return 1; } else{ int resultat=0; list::const_iterator Ci; for(Ci=sous_calculs.begin(); Ci!=sous_calculs.end(); Ci++){ resultat+=Ci->longueur(); } return resultat; } } //-------------------------------------------------------------- //Fonctions de canonisation //-------------------------------------------------------------- //toutes les canonisations sont actives par dfaut bool calcul::cano1_actif=true; bool calcul::cano2_actif=true; bool calcul::cano3_actif=true; // fonction renvoyant false si le calcul n'est "pas assez simple" bool calcul::est_cano() const{ if(est_plaque) return true; // 2+2 n'est pas canonique, 2*2 oui (plus simple programmer que le contraire cause de 2/2=1=utile, 2-2=0=inutile). if(cano1_actif && !est_cano_1()) return false; // Aucun sous-calcul au sens large ne doit disposer parmi ses descendants d'une fratrie qui, rorganise, permet // d'obtenir la mme valeur que celle de ce sous-calcul if(cano2_actif && !est_cano_2()) return false; if(cano3_actif && !est_cano_3()) return false; return true; } //renvoie true si aucun sous-calcul au sens large de profondeur 1 n'est de type 2+2 (comme 100-2-10/5) //attention, est un peu plus efficace que prvu : elle vire aussi les calculs du type 2-2 et donc empite un peu //sur les plates bandes de est_cano_2 bool calcul::est_cano_1() const{ if(est_additif){ list liste=liste_sous_calculs(); liste.insert(liste.end(), sous_calculs.begin(), sous_calculs.end()); list::iterator Ci,Cj,Csuiv; for(Ci=liste.begin();Ci!=liste.end();Ci=Csuiv){ Csuiv=Ci; Csuiv++; if(Ci->valeur_calcul!=2){ liste.erase(Ci); } } if(liste.size()>1){ tirage valeurs_du_calcul=liste_valeurs(); for(Ci=liste.begin();Ci!=liste.end();Ci++){ for(Cj=Ci;Cj!=liste.end();Cj++){ if((Ci->liste_valeurs() + Cj->liste_valeurs()).inclus_dans(valeurs_du_calcul)){ return false; } } } } } return true; } //Aucun sous-calcul au sens large ne doit disposer parmi ses descendants d'une fratrie qui, rorganise, permet //d'obtenir la mme valeur que celle de ce sous-calcul. bool calcul::est_cano_2() const{ list liste=liste_valeurs_combinaisons_descendants(false); list::iterator Vi; for(Vi=liste.begin();Vi!=liste.end();Vi++){ if(*Vi==valeur_calcul){ return false; } } list liste_sous_calc=liste_sous_calculs(); list::iterator Ci; for(Ci=liste_sous_calc.begin();Ci!=liste_sous_calc.end();Ci++){ list liste2=Ci->liste_valeurs_combinaisons_descendants(false); for(Vi=liste2.begin();Vi!=liste2.end();Vi++){ if(*Vi==Ci->valeur_calcul){ return false; } } } return true; } //Pas de factorisation possible, ie 100*7+5*7 n'est pas canonique. bool calcul::est_cano_3() const{ if(est_plaque || (!est_additif)){ return true; //facto possible uniquement pour un calcul de type additif } list::const_iterator Ci; list LC; list::const_iterator CPTj; set candidats_facto; //le set o on stocke les valeurs possibles pour une factorisation (celles issues du premier fils) set::iterator CPTi,CPTsuiv; //-----------si un des fils est une plaque, pas de facto possible-------- for(Ci=sous_calculs.begin();Ci!=sous_calculs.end();Ci++) { if(Ci->est_plaque){ return true; } } //-------algo principal ------------------------------------------------ Ci=sous_calculs.begin(); LC=Ci->liste_sous_comptes(); for(CPTj=LC.begin();CPTj!=LC.end();CPTj++){ candidats_facto.insert(*CPTj); } for(Ci++;Ci!=sous_calculs.end();Ci++){ LC=Ci->liste_sous_comptes(); for(CPTi=candidats_facto.begin();CPTi!=candidats_facto.end();CPTi=CPTsuiv){ CPTsuiv=CPTi; CPTsuiv++; bool appartient=false; for(CPTj=LC.begin();CPTj!=LC.end();CPTj++){ if(*CPTj == *CPTi){ appartient=true; } } if(!appartient){ candidats_facto.erase(CPTi); } } } bool trouve=false; //sera vrai si l'on trouve un candidat la factorisation valable for(CPTi=candidats_facto.begin();CPTi!=candidats_facto.end();CPTi++){ //boucle pour viter le pb de (7+7)x8-8/(1+1) if(*CPTi < 0){ //si le candidat divise, pas de problme trouve=true; } else{ //cas o le candidat multiplie bool correct=true; for(Ci=sous_calculs.begin();Ci!=sous_calculs.end();Ci++){ if((Ci->valeur_calcul % (*CPTi))!=0){ correct=false; } } if(correct){ trouve=true; } } } //le calcul est canonique si on ne peut pas le factoriser return !trouve; } kitsune2.0/src/calcul.h0000644000175000017500000000717710617375337014241 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CALCUL_H #define CALCUL_H #include #include #include #include #include #include using namespace std; typedef unsigned char plaque; typedef long compte; //attention, ne pas mettre unsigned. On a besoin des ngatifs dans les fonctions de canonisation. class tirage; class calcul { public: // DONNEES bool est_plaque; plaque pl; bool est_additif; list sous_calculs; //liste des "sous_calculs de profondeur 1" bool signe; //signe du calcul dans son calcul-parent (true=positif, false=ngatif) compte valeur_calcul; int profondeur; // AFFICHAGE static bool niv_sup; //variable statique indiquant si l'on est au niveau suprieur string affiche_calcul() const; // FONCTIONS //fonctions d'initialisation calcul(); //l'initialisation par dfaut se fait sur un calcul de type additif calcul(const plaque&); //initialisation partir d'une plaque //l'oprateur == est utilis dans la dfinition de l'oprateur < //l'oprateur < est lui ncessaire pour pouvoir trier une liste de calculs avec "sort" bool operator==(const calcul& a) const; bool operator<(const calcul& a) const; //manip de signes void oppose_sous_calculs(); //oprations entre 2 calculs calcul operator+(const calcul&) const; calcul operator-(const calcul&) const; calcul operator*(const calcul&) const; calcul operator/(const calcul&) const; calcul reunion(const calcul&, bool type_additif, bool opposition) const; //fonctions d'analyse des calculs, ncessaires au fonctionnement des fonctions de canonisation list liste_sous_calculs() const; list liste_valeurs_combinaisons_enfants(bool) const; list liste_valeurs_combinaisons_descendants(bool) const; list liste_sous_comptes() const; tirage liste_plaques() const; tirage liste_valeurs() const; int longueur() const; //ncessaire pour jeu::afficheBase2() //fonction globale de canonisation appellant les fonctions en dessous bool est_cano() const; //fonctions de canonisation static bool cano1_actif, cano2_actif, cano3_actif; //pour activer ou desactiver les canonisations bool est_cano_1() const; bool est_cano_2() const; bool est_cano_3() const; }; #endif kitsune2.0/src/global.cpp0000644000175000017500000000544010625046606014551 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "global.h" //dfinition des polices pour les Widgets Qt policesQt::policesQt() { #ifndef WINDOWS font_normal.setFamily( "Bitstream Vera Sans" ); font_normal.setPixelSize( 12 ); font_gros.setFamily( "Bitstream Vera Sans" ); font_gros.setPixelSize( 14 ); font_gros.setBold( TRUE ); font_monospace.setFamily( "Bitstream Vera Sans Mono" ); font_monospace.setPixelSize( 12 ); #else //police par dfaut du systme pour font_normal et font_gros //taille par dfaut du systme pour font_normal font_gros.setPixelSize( 14 ); font_gros.setBold( TRUE ); font_monospace.setFamily( "Lucida Console" ); font_monospace.setPixelSize( 14 ); #endif } //dfinition des couleurs couleurs::couleurs() { palette_orange.setColor( QPalette::Window, QColor( 255, 196, 128 ) ); palette_orange.setColor( QPalette::Highlight, QColor( 255, 196, 128 ) ); palette_blanc.setColor( QPalette::Window, QColor( 255, 255, 255 ) ); //note : il vaut mieux mettre un alpha=0 qu'un certain gris, //car le gris par dfaut de la fentre sous Qt n'est pas le mme sous Linux et windows. //(gris de Linux : 207, 207, 207) palette_gris.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) ); //alpha=0 : transparent palette_gris_total.setColor( QPalette::WindowText, QColor( 0, 0, 0, 0 ) ); //alpha=0 : transparent } const QString global::numero_version=QString("2.0"); kitsune2.0/src/global.h0000644000175000017500000000416210624071643014214 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef GLOBAL_H #define GLOBAL_H #include #include #include //mini-classe pour harmoniser les polices Qt dans tout le programme //pour l'utilisation : faire driver le widget de cette classe //font_* sont alors utilisables tels quels dans le code class policesQt { public : policesQt(); QFont font_normal, font_monospace, font_gros; }; //de mme, mini-classe pour harmoniser les couleurs class couleurs { public : couleurs(); QPalette palette_orange, palette_blanc, palette_gris, palette_gris_total; }; //constantes communes tout le programme, mthode moins crade que les #define class global { public : static const QString numero_version; }; #endif kitsune2.0/src/jeu.cpp0000644000175000017500000004444610625374012014100 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "jeu.h" //QObject utilis uniquement pour tr (traduction de chaines) #include //lancement du calcul en tche de fond void jeu::run() { etude_tirage(); } //initialisation de la classe jeu partir d'un tirage void jeu::init(const tirage& t, const int &liminf, const int &limsup){ // c'est ici que l'on rentre le tirage que l'on veut tudier. tirage_etudie=t; // le sous_tirage_etudie est un vecteur rpertoriant l'ensemble des sous-tirages du tirages, tris comme il faut sous_tirage_etudie=tirage_etudie.calcul_sous_tirages(); // vecteur dans lequel on va stocker l'ensemble des calculs, tris selon les plaquettes qu'ils utilisent stock stock_vide; grande_base.clear(); grande_base.assign(sous_tirage_etudie.size(), stock_vide); // init du compteur de calculs non retenus car non canoniques (25/5 etc) compteur_simplif=0; // init du compteur de calculs non retenus parce que leur valeur n'est pas dans la plage voulue compteur_simplif2=0; // init des limites utilises pour ne garder que les calculs dont les valeurs sont dans la plage voulue lim_inf_inf=0; //varie entre 0 et 99 lim_inf_sup=100000; //varie entre 100 et 100000 lim_sup_inf=0; //varie entre 0 et 999 lim_sup_sup=100000; //varie entre 1000 et 100000 lim_inf=liminf; lim_sup=limsup; } //tude d'un tirage //la classe jeu doit tre initialise avec init avant d'appeler cette fonction void jeu::etude_tirage(){ int taille_sous_tirage=sous_tirage_etudie.size(); int i; stock::iterator Cj, Ck, Ck_debut; //boucle principale for(stock_courant=1; stock_courant::iterator it=sous_tirage_etudie[stock_courant].tab.begin(); grande_base[stock_courant].insert(calcul(it->first)); } else{ //cas o le sous_tirage comporte au moins 2 plaques vector sous_sous_tirage=(sous_tirage_etudie[stock_courant]).calcul_sous_tirages(); int sous_sous_taille=sous_sous_tirage.size(); //boucle : si on remplit le sous-tirage 2;3;5, il faut utiliser 2 + 3;5 et 3 + 5;2 etc for(i=1; i<(sous_sous_taille+1)/2; i++) { int position1=(sous_sous_tirage[i]).trouve_dans(sous_tirage_etudie); int position2=(sous_sous_tirage[sous_sous_taille-1-i]).trouve_dans(sous_tirage_etudie); for (Cj=grande_base[position1].begin(); Cj!=grande_base[position1].end(); Cj++) { if (position1!=position2) { Ck_debut=grande_base[position2].begin(); } else { Ck_debut=Cj; } for (Ck=Ck_debut; Ck!=grande_base[position2].end(); Ck++) { combinaisons(*Cj, *Ck); } } } } degageNonCano(); //supprime les calculs non canoniques du stock courant } //suppression finale des positions hors plage degageHorsPlage(); } // fonction qui renvoie true si le calcul est dans la bonne plage //(entre 100 et 999, et ventuellement <100 mais >=lim_inf_inf, de mme pour >999) // cette fonction modifie galement les lim_x_x quand elle rencontre un calcul qui permet de les affiner bool jeu::dans_la_bonne_plage(const calcul& C){ compte valeur=C.valeur_calcul; if(valeur>=lim_inf && valeur<=lim_sup){ // cas 100<=valeur<=999 if(lim_inf_sup>valeur){ lim_inf_sup=valeur; } if(lim_sup_inf999 if(lim_sup_sup>=valeur){ lim_sup_sup=valeur; return true; } } } return false; } //ajoute dans la base un calcul en vrifiant qu'il remplit les conditions adquates void jeu::ajouteBase(const calcul& A){ if(!dernier_sous_tirage || dans_la_bonne_plage(A)){ grande_base[stock_courant].insert(A); } } //calcule les combinaisons de A et B et demande leur ajout dans la base void jeu::combinaisons(const calcul& A, const calcul& B){ ajouteBase(A+B); // prise en compte de l'addition if(A.valeur_calculB.valeur_calcul) { ajouteBase(A-B); } if(A.valeur_calcul!=1 && B.valeur_calcul!=1) { // prise en compte de la multiplication ajouteBase(A*B); if(A.valeur_calcul==B.valeur_calcul) { // prise en compte de la division calcul C=A/B; calcul D=B/A; if(C < D) { ajouteBase(C); } else { ajouteBase(D); } } else { if (A.valeur_calcul % B.valeur_calcul==0){ ajouteBase(A/B); } else if (B.valeur_calcul % A.valeur_calcul==0){ ajouteBase(B/A); } } } } //fonction qui supprime du stock courant les calculs non canoniques void jeu::degageNonCano(){ stock::iterator Ci, Csuiv; for(Ci=grande_base[stock_courant].begin(); Ci!=grande_base[stock_courant].end(); Ci=Csuiv) { Csuiv=Ci; Csuiv++; if(! (Ci->est_cano())){ compteur_simplif++; grande_base[stock_courant].erase(Ci); } } } //supprime de la base les positions en dehors de la plage void jeu::degageHorsPlage() { int i; int taille_sous_tirage=sous_tirage_etudie.size(); stock::iterator Cj; //boucle pour dterminer entre quels entiers on va garder les calculs (lim_inf_inf et lim_sup_sup) for(i=1;ilim_inf_sup-lim_inf){ lim_inf_inf=lim_inf; } if(lim_sup_sup-lim_sup>lim_sup-lim_sup_inf){ lim_sup_sup=lim_sup; } //boucle pour virer toutes les positions qui ne sont pas entre les lim_inf_inf et lim_sup_sup finales stock::iterator Csuiv; for(i=1;ivaleur_calcul < lim_inf_inf || Cj->valeur_calcul > lim_sup_sup){ compteur_simplif2++; grande_base[i].erase(Cj); } } } } //fonction donnant la distance la solution : 0 si le problme est soluble, sinon la distance entre le compte et la meilleure solution //bien sr, cette fonction n'est utile que si on tudie un seul compte, ie si lim_inf=lim_sup int jeu::distance_a_la_solution() const{ int resultat=1000; vector::const_iterator STi; stock::const_iterator Cj; for(STi=grande_base.begin(); STi!=grande_base.end(); STi++) { for(Cj=STi->begin(); Cj!=STi->end(); Cj++) { if((Cj->valeur_calcul)>=lim_inf){ if((Cj->valeur_calcul -lim_inf)valeur_calcul -lim_inf); } } else{ if((lim_inf- Cj->valeur_calcul)valeur_calcul); } } } } return resultat; } //affichage des solutions en affichant en priorit les calculs utilisant peu de plaques //ne doit tre utilis que dans le cas de l'tude d'un unique compte //dans le cas o le compte ne serait pas bon, il n'affiche que les solutions optimales //note : tr n'a aucun effet quand l'appli Qt n'est pas lance QString jeu::afficheBase() const { QString resultat; string str_temp; int i; int dist=distance_a_la_solution(); stock stock_temp; vector::const_iterator STi; stock::const_iterator it; for(i=1;i<=tirage_etudie.taille();i++){ stock_temp.clear(); for(STi=grande_base.begin(); STi!=grande_base.end(); STi++) { for(it=STi->begin(); it!=STi->end(); it++) { if(it->longueur()==i && ((it->valeur_calcul -lim_inf)==dist || (lim_inf- it->valeur_calcul)==dist)){ stock_temp.insert(*it); } } } if(!stock_temp.empty()){ if(distance_a_la_solution()==0) { resultat.append(QObject::tr("Solutions utilisant %1 plaques:").arg(i)); } else { resultat.append(QObject::tr("Approximations utilisant %1 plaques:").arg(i)); } resultat.append("\n"); for(it=stock_temp.begin(); it!=stock_temp.end(); it++) { stringstream ss2; ss2 << it->valeur_calcul; ss2 >> str_temp; resultat.append(QString::fromStdString(str_temp)); resultat.append(". "); resultat.append(QString::fromStdString(it->affiche_calcul())); resultat.append("\n"); } resultat.append("\n"); } } return resultat; } string jeu::afficheProbleme() const { string resultat; stringstream flux; //affichage du tirage dans la chaine resultat flux << tirage_etudie; flux >> resultat; return resultat; } //affichage d'informations sur l'tude ralise void jeu::afficheInfo() const { cout << "tirage : " << tirage_etudie << endl << "taille du tirage = " << tirage_etudie.taille() << endl << "ensemble des sous tirages :" << endl << sous_tirage_etudie << endl << "nombre de calculs stockes : " << nb_calculs_stockes() << endl << "nombre de calculs simplifis (canonisation) : " << compteur_simplif << endl << "nombre de calculs simplifis (pas la plage voulue) : " << compteur_simplif2 << endl << "nombre de comptes ralisables (sur " << lim_sup-lim_inf+1 << " possibles) :" << nb_comptes_realises() << endl; } // renvoie le nombre de comptes faisables avec le tirage tudi int jeu::nb_comptes_realises() const{ set comptes_realises; // ensemble des comptes entre 100 et 999 raliss par ce tirage vector::const_iterator STi; stock::iterator Cj; for(STi=grande_base.begin(); STi!=grande_base.end(); STi++) { for(Cj=STi->begin();Cj!=STi->end();Cj++){ if(Cj->valeur_calcul>=lim_inf && Cj->valeur_calcul<=lim_sup){ comptes_realises.insert(Cj->valeur_calcul); } } } return comptes_realises.size(); } // renvoie le nombre de calculs stocks int jeu::nb_calculs_stockes() const{ int total=0; // nombre de calculs stocks. vector::const_iterator STi; for(STi=grande_base.begin(); STi!=grande_base.end(); STi++) { total=total+STi->size(); } return total; } //renvoie un vecteur contenant 0 si le compte n'est pas ralis, 1 sinon vector jeu::comptes_realises() const{ vector resultat; resultat.assign(1000,false); vector::const_iterator STi; stock::iterator Cj; for(STi=grande_base.begin(); STi!=grande_base.end(); STi++) { for(Cj=STi->begin();Cj!=STi->end();Cj++){ if(Cj->valeur_calcul>=lim_inf && Cj->valeur_calcul<=lim_sup){ resultat[Cj->valeur_calcul]=true; } } } return resultat; } // partir d'ici, travail sur l'tude globale void etude_globale::grosse_etude(const set &st){ tirages_etudies=st; //initialisation des variables qui vont contenir les rsultats nb_approch.assign(919,0); proba_approch.assign(919,0); nb_comptes.assign(1000,0); proba_comptes.assign(1000,0); nb_cpts_realises.assign(901,0); proba_cpts_realises.assign(901,0); nb_total_solutions=0; //variables d'avancement : nombre de tirages dj tudis, somme des coefficients des tirages dj tudis (pour les donnes partielles) int avancement_tirages=0; int avancement_coefs=0; //itrateurs set::iterator TIR; set::iterator CPT; //fichier contenant les informations sur le nombre de solutions obtenues par tirage ofstream f_nb_solutions("nb_solutions.txt"); f_nb_solutions.is_open(); f_nb_solutions << "Tirage\tNombre de comptes raliss\tNombre de solutions" << endl; //boucle principale for(TIR=tirages_etudies.begin();TIR!=tirages_etudies.end();TIR++){ jeu J; J.init(*TIR,100,999); J.etude_tirage(); vector les_comptes_realises=J.comptes_realises(); avancement_tirages++; int coef=TIR->coefficient(); avancement_coefs+=coef; int i; //pour l'tude de la frquence de ralisation d'un problme 0,1,2...918 prs (nombre de problmes, probas) for(i=100;i<1000;i++){ int ecart=0; if(!les_comptes_realises[i]){ bool approx_trouvee=false; while(!approx_trouvee){ ecart++; if(i-ecart>=100){ if(les_comptes_realises[i-ecart]){ approx_trouvee=true; } } else{ if(J.lim_inf_inf==i-ecart){ approx_trouvee=true; } } if(i+ecart<=999){ if(les_comptes_realises[i+ecart]){ approx_trouvee=true; } } else{ if(J.lim_sup_sup==i+ecart){ approx_trouvee=true; } } } } proba_approch[ecart]+=coef; nb_approch[ecart]++; } //pour l'tude de la frquence de ralisation de chaque compte (nombre de tirages, probas) for(i=100;i<1000;i++){ if(les_comptes_realises[i]){ nb_comptes[i]++; proba_comptes[i]+=coef; } } //pour l'tude du nombre de comptes raliss par chaque tirage int resultat=0; for(i=100;i<1000;i++){ if(les_comptes_realises[i]){ resultat++; } } nb_cpts_realises[resultat]++; proba_cpts_realises[resultat]+=coef; //pour l'tude du nombre total de solutions int ncs=J.nb_calculs_stockes(); f_nb_solutions << *TIR << "\t" << resultat << "\t" << ncs << endl; nb_total_solutions+=ncs; //affichage de l'avancement de l'tude cout << "\r" << avancement_tirages << "/13243 tirages tudis" << flush; } cout << endl; //retour la ligne en fin de boucle //une fois le calcul termin, on stocke les rsultats dans des fichiers. f_nb_solutions << "# Nombre total de solutions\t" << nb_total_solutions; f_nb_solutions.close(); ofstream f_approch("approch.txt"); if (f_approch.is_open()){ f_approch << "# total\t" << avancement_tirages*900 << "\t" << avancement_coefs*900 << endl; int i; for(i=0;i<=918;i++){ f_approch << i << "\t" << nb_approch[i] << "\t" << proba_approch[i] << endl; } f_approch.close(); } ofstream f_compte("compte.txt"); if (f_compte.is_open()){ f_compte << "# total\t" << avancement_tirages << "\t" << avancement_coefs << endl; int i; for(i=100;i<=999;i++){ f_compte << i << "\t" << nb_comptes[i] << "\t" << proba_comptes[i] << endl; } f_compte.close(); } ofstream f_tirage("tirage.txt"); if (f_tirage.is_open()){ f_tirage << "# total\t" << avancement_tirages << "\t" << avancement_coefs << endl; int i; for(i=0;i<=900;i++){ f_tirage << i << "\t" << nb_cpts_realises[i] << "\t" << proba_cpts_realises[i] << endl; } f_tirage.close(); } int proba_solub=proba_approch[0]/(avancement_coefs*9); int proba_solub_decim=(proba_approch[0]%(avancement_coefs*9))*100/(avancement_coefs*9); int proba_tir_ts=proba_cpts_realises[900]*100/avancement_coefs; int proba_tir_ts_decim=proba_cpts_realises[900]*10000/avancement_coefs-proba_tir_ts*100; ofstream f_resume("resume.txt"); if (f_resume.is_open()){ //Rsultats sur les problmes f_resume << "Nombre de problmes solubles : " << nb_approch[0] << "/" << avancement_tirages*900 << endl; f_resume << "Nombre de problmes insolubles : " << (avancement_tirages*900-nb_approch[0]) << "/" << avancement_tirages*900 << endl; f_resume << "Proba qu'un pb soit soluble : " << proba_approch[0] << "/" << avancement_coefs*900; f_resume << " soit environ " << proba_solub << ","; if(proba_solub_decim<10){ f_resume << "0" ; } f_resume << proba_solub_decim << " %" << endl; f_resume << endl; //Rsultats sur les comptes int i; int nb_max=0; int proba_max=0; int nb_min=avancement_tirages; int proba_min=avancement_coefs; for(i=100;i<=999;i++){ if(nb_comptes[i]>nb_max) nb_max=nb_comptes[i]; if(proba_comptes[i]>proba_max) proba_max=proba_comptes[i]; if(nb_comptes[i] #include #include #include #include typedef set stock; class jeu : public QThread { public : void run(); //pour lancer un calcul en tche de fond // DONNEES tirage tirage_etudie; vector sous_tirage_etudie; vector grande_base; int compteur_simplif; //nombre de calculs non canoniques int compteur_simplif2; //nombre de calculs dont la valeur n'est pas dans la plage voulue compte lim_inf_inf; compte lim_inf_sup; compte lim_sup_inf; compte lim_sup_sup; compte lim_inf; compte lim_sup; //communication au sein de la classe bool dernier_sous_tirage; //indique si on est en train de traiter le dernier sous_tirage ou pas int stock_courant; //stock actuellement utilis // FONCTIONS void etude_tirage(); //fonction principale (bloc monolithique initial) void init(const tirage &t, const int &liminf, const int &limsup); //bloc d'initialisation void combinaisons(const calcul& A, const calcul& B); //calcule les combinaisons de A et B void ajouteBase(const calcul& A); //ajoute un calcul la base (dans le stock courant) void degageNonCano(); //supprime les positions non cano du stock courant bool dans_la_bonne_plage(const calcul& C); //dtermine si un calcul a une valeur qu'il faut garder, et modifie //les limites si ncessaire void degageHorsPlage(); //supprime de la base les positions "hors-plage" QString afficheBase() const; string afficheProbleme() const; int distance_a_la_solution() const; void afficheInfo() const; //affichage d'informations en fin de calcul int nb_comptes_realises() const; //nb de comptes raliss par le tirage entre 100 et 999 int nb_calculs_stockes() const; //nb de calculs stocks vector comptes_realises() const; //renvoie un vecteur contenant 0 si le compte n'est pas ralis, 1 sinon }; class etude_globale { public : //on etudie quelques tirages pour les tests, et les 13243 pour le gros calcul set tirages_etudies; //vecteurs de taille 919 //pour savoir le nombre de problmes solubles 0,1,2...918 prs, et les probabilits associes vector nb_approch; vector proba_approch; //vecteurs de taille 1000 (seuls comptent les lments 100 999) //pour un compte donn, stocke le nombre de tirages qui peuvent l'atteindre, et la probabilit associe vector nb_comptes; vector proba_comptes; //vecteurs de taille 901 (de 0 900) //contient le nombre de comptes raliss par un tirage, ou la proba associe vector nb_cpts_realises; vector proba_cpts_realises; //entier contenant le nombre total de solutions sur l'ensemble des tirages int nb_total_solutions; //fonction principale permettant de calculer tous les paramtres ci-dessus //lance une tude sur l'ensemble des tirages void grosse_etude(const set &st); }; #endif kitsune2.0/src/kitsune.cpp0000644000175000017500000002160610621623631014770 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include #include "widgetoptions.h" #include "widgetprincipal.h" #include "widgetoperation.h" #include "tirage.h" #include "jeu.h" void main_graphique(int argc, char **argv ); //interface graphique avec Qt void main_aide(); //renvoie les options disponibles pour la ligne de commande void main_compte(); //permet de rsoudre un compte en ligne de commande void main_erreur(); //message lorsque l'on rentre un paramtre inexistant void main_renard(); //easter egg void main_stats(); //lance une tude statistique globale sur l'ensemble des tirages #ifdef TEST void main_test(); //fonction servant raliser des tests lors de la programmation void main_test_stats(); //fonction de test pour statistiques limites #endif plaque demande_plaque(); //fonction pour l'entre d'une plaque en ligne de commande compte demande_compte(); //fonction pour l'entre du compte en ligne de commande int main( int argc, char **argv ) { //init des plaques autorises (rgle du jeu) //note : ce bloc d'init n'est pas trs bien plac tirage r; for(int i=1; i<=10; i++) { r.tab[i]=2; } r.tab[25]=1; r.tab[50]=1; r.tab[75]=1; r.tab[100]=1; r.utiliser_comme_ref(); //appel d'une des fonctions principales en fonctions des arguments string s; switch(argc) { case 2 : s=(string) argv[1]; if (s=="-h" || s=="--help") {main_aide();} else if(s=="-c" || s=="--compte") {main_compte();} else if(s=="-s" || s=="--stats") {main_stats();} else if(s=="-r" || s=="--renard") {main_renard();} #ifdef TEST else if(s=="-t" || s=="--test") {main_test();} else if(s=="-ts" || s=="--test-stats") {main_test_stats();} #endif #ifdef MACX else if (s.substr(0,4)=="-psn"){ main_graphique(argc, argv); } #endif else {main_erreur();} break; case 1 : main_graphique(argc, argv); break; default : main_erreur(); } return EXIT_SUCCESS; } //interface graphique avec Qt void main_graphique(int argc, char **argv ) { int fin=WidgetOptions::NVE_LANGUE; while(fin==WidgetOptions::NVE_LANGUE) { QApplication a( argc, argv ); //mise ou remise zro de pointeurs pour les pixmap WidgetOperation::nettoyagePixmap(); //lecture du fichier d'options si existant WidgetOptions::lireFichier(); //installation de la langue QTranslator translator; QString fichier_langue=QString(":/kitsune_")+WidgetOptions::langue; translator.load(fichier_langue); a.installTranslator(&translator); //choix du style de l'application a.setStyle( "plastique" ); Principal *hm = new Principal(); hm->show(); fin=a.exec(); } } //renvoie les options disponibles pour la ligne de commande void main_aide() { cout << "Liste des options disponibles pour le programme Kitsune :" << endl << endl << "rien :" << " " << "lance l'interface graphique du programme." << endl << "-c ou --compte :" << " " << "rsout un problme particulier en ligne de commande." << endl << "-h ou --help :" << " " << "affiche une liste des paramtres disponibles." << endl << "-r ou --renard :" << " " << "?" << endl << "-s ou --stats :" << " " << "lance une srie de calculs statistiques." << endl; #ifdef TEST cout << "-t ou --test :" << " " << "fonction de test" << endl << "-ts ou --test-stats :" << "test des statistiques" << endl; #endif } //message lorsque l'on rentre un paramtre inexistant void main_erreur(){ cout << "Paramtre inexistant." << endl << "Utiliser l'option \"-h\" ou \"--help\" pour avoir une liste des paramtres disponibles." << endl; } //permet de rsoudre un compte en ligne de commande void main_compte(){ plaque pl; compte compte_init; string erreur_tirage="Erreur : tirage non valide, il ne faut pas plus de deux plaques de chaque type entre 1 et 10, et pas plus d'une plaque de chaque type pour 25, 50, 75, 100."; string noms[6]={"Premire plaque : ", "Deuxime plaque : ", "Troisime plaque : ", "Quatrime plaque : ", "Cinquime plaque : ", "Sixime plaque : "}; tirage t; for(int i=0; i<6; i++) { cout<< noms[i]; pl=demande_plaque(); t.tab[pl]++; } if(!t.est_valable()) { cout << erreur_tirage << endl; return; } cout<<" compte : "; compte_init=demande_compte(); jeu J; J.init(t,compte_init,compte_init); J.etude_tirage(); cout << endl; cout << J.afficheBase().toStdString(); } //fonction pour l'entre d'une plaque en ligne de commande plaque demande_plaque(){ string erreur_plaque=" Erreur : plaques possibles : 1 - 10, 25, 50, 75, 100."; int i; plaque pl; string s; while(true) { getline(cin,s); istringstream istr(s); if(istr>>i) { if ( (i>=1 && i<=10) || i==25 || i==50 || i==75|| i==100) { pl=i; return pl; } } //message erreur et nouvelle demande de plaque cout<< erreur_plaque << endl << " plaque : "; } } //fonction pour l'entre du compte en ligne de commande compte demande_compte(){ string erreur_compte=" Erreur : rentrer un nombre entier entre 100 et 999."; int i; compte resultat; string s; while(true) { getline(cin,s); istringstream istr(s); if(istr>>i) { if (i<=999 && i>=100) { resultat=i; return resultat; } } //message erreur et nouvelle demande du compte cout<< erreur_compte << endl << " compte : "; } } //easter egg void main_renard(){ cout << " _ _" << endl << " | \\_/ |" << endl << " / \\ /^^^/" << endl << " /_.^ ^._\\ /^^^|" << endl << " \\o/ | |" << endl << " / \\_ | /" << endl << " \\ \\_ / /" << endl << " | | / \\/ _/" << endl << " _|_|_\\ _/_/" << endl; } //lance une tude statistique globale sur l'ensemble des tirages void main_stats(){ //test pour dterminer si on a le droit de crer un fichier ofstream f_nb_solutions( "nb_solutions.txt" ); if ( !f_nb_solutions ) { cerr << "Erreur : impossible de crer un fichier dans ce rpertoire.\n"; return; } f_nb_solutions.close(); //pour lancer l'tude statistique globale sur les 13243 tirages //le calcul est plus rapide sans la canonisation calcul::cano1_actif=false; calcul::cano2_actif=false; calcul::cano3_actif=false; #ifdef TEST //activer ici les fonctions que l'on veut vrifier totalement calcul::cano1_actif=true; calcul::cano2_actif=true; calcul::cano3_actif=true; #endif set st=tous_les_tirages(); etude_globale E; E.grosse_etude(st); } #ifdef TEST //fonction temporaire servant raliser des tests lors de la programmation void main_test(){ calcul Calc=(calcul(6)*calcul(5)*calcul(2)/calcul(4))+calcul(4); //calcul Calc=(calcul(5)+calcul(1))*calcul(6)*calcul(4)*calcul(3)*calcul(2); list fugo=Calc.liste_sous_comptes(); list::iterator gougou; for(gougou=fugo.begin();gougou!=fugo.end();gougou++){ cout << *gougou << "\t" ; } cout << endl; cout << Calc.liste_plaques() << endl; } //tude limite un petit nombre de tirages (pour les tests) void main_test_stats(){ // modifier pour vrifier l'influence des fonctions de canonisation calcul::cano1_actif=true; calcul::cano2_actif=true; calcul::cano3_actif=true; tirage t1; t1.tab[1]=1; t1.tab[2]=1; t1.tab[3]=2; t1.tab[100]=1; t1.tab[75]=1; tirage t2; t2.tab[1]=1; t2.tab[2]=1; t2.tab[3]=1; t2.tab[4]=1; t2.tab[5]=1; t2.tab[100]=1; tirage t3; t3.tab[1]=2; t3.tab[2]=2; t3.tab[3]=2; set st; st.insert(t1); st.insert(t2); st.insert(t3); etude_globale E; E.grosse_etude(st); } #endif kitsune2.0/src/tirage.cpp0000644000175000017500000002077310621333424014563 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "tirage.h" int tirage::nb_plaques=6; int tirage::compte_minimal=100; int tirage::compte_maximal=999; map tirage::ref; //les plaques du tirage deviennent la rfrence des plaques autorises void tirage::utiliser_comme_ref() { ref=tab; } //fonction renvoyant la taille d'un tirage int tirage::taille() const { int resultat=0; map::const_iterator it; for(it=tab.begin();it!=tab.end();it++){ resultat=resultat+(it->second); } return resultat; } //renvoie true si le tirage est valable (pas trop de plaques de chaque sorte). bool tirage::est_valable() { map::const_iterator it; for(it=tab.begin();it!=tab.end();it++) { if( (it->second) > ref[it->first] ) return false; } return true; } //renvoie le poids d'un tirage relativement au nb de couples dans ce tirage, //en supposant que ce tirage est un tirage possible dans le jeu (pas de triplettes ou plus) int tirage::coefficient() const { int resultat=1; map::const_iterator it; for(it=tab.begin();it!=tab.end();it++){ if(it->second==1 && it->first<11){ resultat=resultat*2; } } return resultat; } //-------------------------------------------------------------- //Oprations sur les tirages //-------------------------------------------------------------- bool tirage::operator!=(const tirage& a) const{ return (tab!=a.tab); } bool tirage::operator==(const tirage& a) const { return (tab==a.tab); } bool tirage::operator<(const tirage& a) const { return (tab::const_iterator it; for(it=tab.begin();it!=tab.end();it++){ resultat.tab[it->first] += (it->second); } return resultat; } //oprateur d'inclusion au sens large //par exemple 1;1;4 est inclus dans 1;1;3;4;100 mais pas dans 1;4;10;50 bool tirage::inclus_dans(tirage a) const { map::const_iterator it; for(it=tab.begin();it!=tab.end();it++){ if ((it->second) > a.tab[it->first]){ return false; } } return true; } //fonction prenant un tirage en argument, et renvoyant un vecteur //contenant les sous-tirages de ce tirage, tris dans un ordre "intressant" vector tirage::calcul_sous_tirages() const { tirage tvide; //cre un vecteur contenant uniquement le tirage vide vector v(1,tvide); map::const_iterator i; for(i=tab.begin();i!=tab.end();i++){ //voir algorithme dtaill sur le site int a=v.size(); //attention, la taille de v varie tout au long de la boucle indexe par j int j; int k; for(j=1;j<=i->second;j++){ for(k=0;kfirst]=j; v.push_back(temp); } } } return v; } //-------------------------------------------------------------- //Fonction donnant la position d'un tirage dans un vecteur de tirages //-------------------------------------------------------------- int tirage::trouve_dans(const vector &v) const{ int resultat=0; while (v[resultat]!=*this){ resultat++; } return resultat; } //-------------------------------------------------------------- //Fonctions d'affichage //-------------------------------------------------------------- //fonction affichant un tirage ostream& operator<<(ostream& ostr, const tirage& t) { if (t.tab.size()==0) { return ostr << "vide"; } map::const_iterator i; int j; for(i=t.tab.begin(); i!=t.tab.end(); i++){ for(j=0; j<(i->second); j++){ ostr << (int) (i->first) << "."; } } return ostr; //<< "\b"; } //fonction affichant un vecteur de tirages. ostream& operator<<(ostream& ostr, const vector& v){ int taille=v.size(); int i; ostr << "["; for(i=0; i cree_liste_pseudo(){ //initialisation de v pseudo_tirage v; for(int i=0;i liste; int pos=tirage::nb_plaques-1; bool pas_termine=true; while(pas_termine){ while(v[tirage::nb_plaques-1]<24){ liste.push_back(v); v[tirage::nb_plaques-1]++; } while(pas_termine && v[pos]==19+pos){ pos--; if(pos>=0){ v[pos]++; } else{ pas_termine=false; pos++; } } if(pas_termine){ for(int j=pos+1;j tous_les_tirages(){ set resultat; list liste_pseudo=cree_liste_pseudo(); list::iterator PT; for(PT=liste_pseudo.begin();PT!=liste_pseudo.end();PT++){ resultat.insert(pseudo_en_tirage(*PT)); } return resultat; } //fonction renvoyant la plus petite plaque suprieure une plaque p, et disponible une fois enleves les plaques du tirage t plaque plus_petite_plaque_sup(tirage t,plaque p) { plaque resultat=augmente_plaque(p); while ( (t.tab[resultat]==2 && resultat<=10) || (t.tab[resultat]==1 && resultat >10) ){ resultat=augmente_plaque(resultat); } //if(resultat10) ){ resultat=diminue_plaque(resultat); } //if(resultat>p) resultat=0; //commenter si on autorise le bouclage return resultat; } //fonction donnant la plaque juste plus grande que la plaque p (avec bouclage) plaque augmente_plaque(plaque p) { map::iterator it; it=tirage::ref.find(p); if(it!=tirage::ref.end()) { //on passe la plaque suivante it++; //retour la premire plaque si on est arriv en fin de liste /*if(it==tirage::ref.end()) { it=tirage::ref.begin(); }*/ } if(it!=tirage::ref.end()) { //nouveau test (cas de la liste vide) return it->first; } else { //cas d'erreur - rgler un jour return 0; } } //fonction donnant la plaque juste plus petite que la plaque p (avec bouclage) plaque diminue_plaque(plaque p) { map::iterator it; it=tirage::ref.find(p); if(it!=tirage::ref.end()) { //retour la premire plaque si on est arriv en fin de liste /*if(it==tirage::ref.begin()) { it=tirage::ref.end(); }*/ //on passe la plaque precedente it--; } if(it!=tirage::ref.end()) { //nouveau test (cas de la liste vide) return it->first; } else { //cas d'erreur - rgler un jour return 0; } } kitsune2.0/src/tirage.h0000644000175000017500000000623610617375337014244 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef TIRAGE_H #define TIRAGE_H #include "calcul.h" #include #include class tirage { public : map tab; //tableau des plaques static int nb_plaques; static int compte_minimal; static int compte_maximal; static map ref; //liste des plaques autorises void utiliser_comme_ref(); //init des plaques autorises int taille() const; bool est_valable(); int coefficient() const; //indique le coef d'un tirage, ie 2^n o n est le nombre de //plaquettes du tirage non doubles et diffrentes de 25,50,75,100 bool operator!=(const tirage&) const; bool operator==(const tirage&) const; bool operator<(const tirage&) const; bool inclus_dans(tirage) const; tirage operator+(const tirage&) const; //renvoie vecteur des sous-tirages tris dans un ordre "intressant" vector calcul_sous_tirages() const; //renvoie l'entier correspondant au rang o se trouve un tirage dans un vecteur de tirage int trouve_dans(const vector&) const; }; ostream& operator<<(ostream& ostr, const tirage& t); //affichage d'un tirage ostream& operator<<(ostream& ostr, const vector& v); //affichage d'un vecteur de tirages typedef vector pseudo_tirage; //un pseudo-tirage est un choix de 6 nb entiers parmi [0;23] list cree_liste_pseudo(); //cre les 134596 pseudo-tirages diffrents tirage pseudo_en_tirage(pseudo_tirage); //transforme un pseudo-tirage en tirage set tous_les_tirages(); //cre les 13243 tirages diffrents //fonctions utilises dans widgetprincipal.cpp, pour manipuler les plaques plaque plus_petite_plaque_sup(tirage,plaque); plaque plus_petite_plaque_inf(tirage,plaque); plaque augmente_plaque(plaque); plaque diminue_plaque(plaque); #endif kitsune2.0/src/widgethorloge.cpp0000644000175000017500000000510710617724643016161 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgethorloge.h" #include //50 secondes disponibles par dfaut int WidgetHorloge::nb_sec=50; WidgetHorloge::WidgetHorloge( QWidget *parent ) : QWidget( parent ) { subdivision = 50; //nombre de subdivisions de la progress bar pbar = new QProgressBar( this ); pbar->setRange( 0, subdivision ); pbar->setValue( 0 ); pbar->setTextVisible( false ); //pour ne pas afficher l'avancement en pourcentage pbar->setPalette( palette_orange ); QHBoxLayout *hbLayout = new QHBoxLayout(this); hbLayout->setSpacing(0); hbLayout->setMargin(0); hbLayout->addWidget( pbar ); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(changeTemps())); } void WidgetHorloge::lance() { timer->start(1000*nb_sec/subdivision); unit_tps=0; pbar->setValue(unit_tps); } void WidgetHorloge::arrete() { timer->stop(); } void WidgetHorloge::remise_a_zero() { pbar->setValue(0); } void WidgetHorloge::changeTemps() { unit_tps++; //consommation d'une unit de temps pbar->setValue(unit_tps); //envoi d'un signal "Temps puis" lorsque le temps est coul if (unit_tps==subdivision) { timer->stop(); emit TempsEpuise(); } } kitsune2.0/src/widgethorloge.h0000644000175000017500000000414710625374012015617 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef WIDGETHORLOGE_H #define WIDGETHORLOGE_H #include #include "global.h" class QProgressBar; //Widget pour dcompter les 50 secondes rglementaires class WidgetHorloge : public QWidget, couleurs { Q_OBJECT public: WidgetHorloge( QWidget *parent=0); //constructeur QProgressBar *pbar; QTimer *timer; int subdivision; //nombre de subdivisions de la progress bar int unit_tps; //nombre d'units de temps parcourues (l'unit dpend du nombre de subdivisions) static int nb_sec; //nombre de secondes de rflexion disponibles public slots: void lance(); void arrete(); void remise_a_zero(); void changeTemps(); signals : void TempsEpuise(); }; #endif kitsune2.0/src/widgetoperation.cpp0000644000175000017500000001063410625046606016516 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgetoperation.h" #include "tirage.h" #include //valeurs conventionnelles pour identifier les 4 oprations //les 4 valeurs doivent se suivre (pour les boucles) const int WidgetOperation::Plus=1; const int WidgetOperation::Moins=2; const int WidgetOperation::Fois=3; const int WidgetOperation::Divise=4; //dfinition des pointeurs statiques vers les pixmap QPixmap * WidgetOperation::pixPlus=0; QPixmap * WidgetOperation::pixMoins=0; QPixmap * WidgetOperation::pixFois=0; QPixmap * WidgetOperation::pixDivise=0; QPixmap * WidgetOperation::pixVide=0; //Cration d'un widget avec un bouton d'opration //numW : identifiant qui doit tre unique pour chaque plaque/opration //opW : type d'opration (Plus, Moins, Fois, Divise) //cliquableW : indique si la plaque d'opration est cliquable ou non WidgetOperation::WidgetOperation( QWidget *parent, int numW, int opW, bool cliquableW) : QWidget( parent) { //init des pixmap si ncessaire(une seule fois) if(!pixPlus) { pixPlus = new QPixmap( QString(":/images/grand_plus.png") ); } if(!pixMoins) { pixMoins = new QPixmap( QString(":/images/grand_moins.png") ); } if(!pixFois) { pixFois = new QPixmap( QString(":/images/grand_fois.png") ); } if(!pixDivise) { pixDivise = new QPixmap( QString(":/images/grand_divise.png") ); } if(!pixVide) { pixVide = new QPixmap( QString("") ); } //init du numro de widget //num est un identifiant unique qui doit tre diffrent pour chaque plaque num=numW; cliquable=cliquableW; QVBoxLayout *vboxLayout = new QVBoxLayout( this ); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); //on cre un pushbutton si le widget est cliquable, un label sinon if(cliquable){ pbOperation = new QPushButton( "", this); pbOperation->setFlat( true ); pbOperation->setFixedSize( 32, 32 ); connect( pbOperation, SIGNAL(clicked()), this, SLOT(mousePressEvent()) ); vboxLayout->addWidget( pbOperation ); } else{ lbOperation = new QLabel(this); lbOperation->setFixedSize( 32, 32 ); lbOperation->setAlignment( Qt::AlignHCenter ); vboxLayout->addWidget( lbOperation ); } //affichage de l'image changeOperation(numW, opW); } //fonction appele ds qu'il y a un clic void WidgetOperation::mousePressEvent() { emit valeur(num,500+op); } //met jour l'image affiche par le widget void WidgetOperation::changeOperation(int numW, int opW) { if(num!=numW) return; op=opW; QPixmap* pix=pixVide; if(op==Plus) { pix=pixPlus; } else if(op==Moins) { pix=pixMoins; } else if(op==Fois) { pix=pixFois; } else if(op==Divise) { pix=pixDivise; } if(cliquable){ pbOperation->setIcon( *pix ); pbOperation->setIconSize( QSize(28,28) ); } else{ lbOperation->setPixmap( *pix ); } } //suppression des rfrences vers les pointeurs //ATTENTION : cette fonction doit tre imprativement appele si on relance l'appli Qt //(aprs un changement de langue par exemple) void WidgetOperation::nettoyagePixmap() { pixPlus=0; pixMoins=0; pixFois=0; pixDivise=0; pixVide=0; } kitsune2.0/src/widgetoperation.h0000644000175000017500000000477710625046606016176 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef WIDGETOPERATION_H #define WIDGETOPERATION_H #include class QPixmap; class QLabel; class QPushButton; //petite classe pour les plaques avec les oprations class WidgetOperation : public QWidget { Q_OBJECT public: WidgetOperation( QWidget *parent=0, int numW=0, int opW=0, bool cliquableW=false); //constructeur //constantes conventionnelles pour idnetifier les 4 oprations const static int Plus, Moins, Fois, Divise; //pixmap des oprations (pointeurs statiques car commun tous les objets de la classe) static QPixmap * pixPlus, * pixMoins, * pixFois, * pixDivise, *pixVide; //indique si la plaque est cliquable ou non bool cliquable; //lments graphiques : une tiquette cliquable avec un pixmap de l'opration QLabel *lbOperation; QPushButton *pbOperation; int num; //numero de widget int op; //operation affiche void static nettoyagePixmap(); public slots : void changeOperation(int, int); //permet de changer l'opration affiche void mousePressEvent(); signals : void valeur(int,int); //met l'opration affiche }; #endif kitsune2.0/src/widgetoptions.cpp0000644000175000017500000003400010624071643016200 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgetoptions.h" //pour les variables statiques des classes calcul et WidgetHorloge #include "calcul.h" #include "widgethorloge.h" #include "tirage.h" #include "widgetoperation.h" #include "global.h" #include #include //cration et initialisation des variables statiques int WidgetOptions::min_temps_reflexion=10; int WidgetOptions::max_temps_reflexion=300; int WidgetOptions::min_nb_plaques=3; int WidgetOptions::max_nb_plaques=6; int WidgetOptions::min_min_compte=1; int WidgetOptions::max_min_compte=100; int WidgetOptions::min_max_compte=1; int WidgetOptions::max_max_compte=999; int WidgetOptions::NVE_LANGUE=5; //valeur pour relancer l'appli (valeur sans importance - sauf 0) //en dbut de programme, la variable langue contient la langue locale du systme QString WidgetOptions::langue=QLocale::system().name(); bool WidgetOptions::sauveOptions=false; //constructeur de la fentre d'options WidgetOptions::WidgetOptions(QWidget* parent) : QDialog( parent) { //titre de la fentre setWindowTitle(QString(tr("Options"))); QGroupBox *simplif = new QGroupBox(tr("Simplifications"), this); //boutons cocher pour les diverses canonisations QLabel *titrecano1 = new QLabel(simplif); titrecano1->setText(tr("Activer \"2+2=22\"")); titrecano1->setToolTip(tr("Exploite la proprit \"2+2=22\" pour diminuer le nombre de solutions")); cano1 = new QCheckBox(simplif); QLabel *titrecano2 = new QLabel(simplif); titrecano2->setText(tr("Activer \"sous-calcul\"")); titrecano2->setToolTip(tr("N'affiche pas les solutions dont un sous-calcul est lui-mme une solution")); cano2 = new QCheckBox(simplif); QLabel *titrecano3 = new QLabel(simplif); titrecano3->setText(tr("Activer \"factorisation\"")); titrecano3->setToolTip(tr("Considre comme quivalentes les formes dveloppes et factorises d'un mme calcul")); cano3 = new QCheckBox(simplif); QGridLayout *simplifLayout= new QGridLayout( simplif ); simplifLayout->addWidget(titrecano1, 0, 0); simplifLayout->addWidget(cano1, 0, 1, 1, 1, Qt::AlignRight); simplifLayout->addWidget(titrecano2, 1, 0); simplifLayout->addWidget(cano2, 1, 1, 1, 1, Qt::AlignRight); simplifLayout->addWidget(titrecano3, 2, 0); simplifLayout->addWidget(cano3, 2, 1, 1, 1, Qt::AlignRight); QGroupBox *regles = new QGroupBox(tr("Rgles du jeu"), this); //rglage du temps de rflexion QLabel *titreTemps = new QLabel(regles); titreTemps->setText(tr("Temps de rflexion")); boxTemps = new QSpinBox(regles); boxTemps->setRange(min_temps_reflexion,max_temps_reflexion); boxTemps->setFixedSize(boxTemps->sizeHint()); //rglage du nombre de plaques QLabel *titreNbPlaque = new QLabel(regles); titreNbPlaque->setText(tr("Nombre de plaques")); boxNbPlaque = new QSpinBox(regles); boxNbPlaque->setRange(min_nb_plaques,max_nb_plaques); boxNbPlaque->setFixedSize(boxNbPlaque->sizeHint()); //rglage de la valeur minimale du compte QLabel *titreCompte = new QLabel(regles); titreCompte->setText(tr("Valeur minimale du compte")); boxCompte = new QSpinBox(regles); boxCompte->setRange(min_min_compte,max_min_compte); boxCompte->setFixedSize(boxCompte->sizeHint()); //rglage de la valeur maximale du compte QLabel *titreCompte2 = new QLabel(regles); titreCompte2->setText(tr("Valeur maximale du compte")); boxCompte2 = new QSpinBox(regles); boxCompte2->setRange(min_max_compte,max_max_compte); boxCompte2->setFixedSize(boxCompte2->sizeHint()); QGridLayout *reglesLayout= new QGridLayout( regles ); reglesLayout->addWidget(titreTemps, 0, 0); reglesLayout->addWidget(boxTemps, 0, 1); reglesLayout->addWidget(titreNbPlaque, 1, 0); reglesLayout->addWidget(boxNbPlaque, 1, 1, 1, 1, Qt::AlignRight); reglesLayout->addWidget(titreCompte, 2, 0); reglesLayout->addWidget(boxCompte, 2, 1); reglesLayout->addWidget(titreCompte2, 3, 0); reglesLayout->addWidget(boxCompte2, 3, 1); QGroupBox *grouplangue = new QGroupBox(tr("Localisation"), this); //boutons cocher pour les diverses localisations QLabel *titrelangue1 = new QLabel(grouplangue); titrelangue1->setText("Franais"); langue1 = new QRadioButton(grouplangue); QLabel *titrelangue2 = new QLabel(grouplangue); titrelangue2->setText("English"); langue2 = new QRadioButton(grouplangue); QLabel *titrelangue3 = new QLabel(grouplangue); //valeur unicode des caractre du terme "japonais" en japonais, entre 0 et 65535. //hack foireux pour que ce fichier source ne soit pas en unicode. ushort carac1=26085; ushort carac2=26412; ushort carac3=35486; QString japonais; japonais.append(carac1); japonais.append(carac2); japonais.append(carac3); titrelangue3->setText(japonais); langue3 = new QRadioButton(grouplangue); QGridLayout *langueLayout= new QGridLayout; langueLayout->addWidget(titrelangue1, 0, 0); langueLayout->addWidget(langue1, 0, 2, 1, 1, Qt::AlignRight); langueLayout->addWidget(titrelangue2, 1, 0); langueLayout->addWidget(langue2, 1, 2, 1, 1, Qt::AlignRight); langueLayout->addWidget(titrelangue3, 2, 0); langueLayout->addWidget(langue3, 2, 2, 1, 1, Qt::AlignRight); grouplangue->setLayout(langueLayout); //checkbox de sauvegarde des options QWidget *sauveHbox = new QWidget( this ); QHBoxLayout *hlayout1 = new QHBoxLayout( sauveHbox ); sauveOptionsBox = new QCheckBox( sauveHbox ); QLabel *sauveOptionsTitre = new QLabel( sauveHbox ); sauveOptionsTitre->setText( tr("Sauvegarder les options") ); hlayout1->addWidget( sauveOptionsTitre ); hlayout1->addStretch(1); hlayout1->addWidget( sauveOptionsBox ); hlayout1->setSpacing(1); hlayout1->setMargin(1); QWidget *boutonsHbox = new QWidget( this ); QHBoxLayout *hlayout2 = new QHBoxLayout( boutonsHbox ); //bouton pour rtablir les options par dfaut QPushButton *pbDefaut = new QPushButton( tr("Options par dfaut"), boutonsHbox ); pbDefaut->setFont( font_normal ); connect( pbDefaut, SIGNAL( clicked() ), this, SLOT( modifDefaut() ) ); //bouton "OK" pour fermer la fentre QPushButton *pbOk = new QPushButton( tr("OK"), boutonsHbox ); pbOk->setFont( font_normal ); pbOk->setFocus(); //Le bouton "OK" a le focus au lancement de la fentre connect( pbOk, SIGNAL( clicked() ), this, SLOT( modifOk() ) ); hlayout2->addWidget( pbDefaut ); hlayout2->addStretch(1); hlayout2->addWidget( pbOk ); hlayout2->setSpacing(1); hlayout2->setMargin(1); //positionnement des widgets QVBoxLayout *vlayout = new QVBoxLayout( this ); vlayout->addWidget(simplif); vlayout->addWidget(regles); vlayout->addWidget(grouplangue); vlayout->addWidget(sauveHbox); vlayout->addWidget(boutonsHbox); //initialisation des etats if (calcul::cano1_actif) { cano1->setCheckState(Qt::Checked); } else { cano1->setCheckState(Qt::Unchecked); } if (calcul::cano2_actif) { cano2->setCheckState(Qt::Checked); } else { cano2->setCheckState(Qt::Unchecked); } if (calcul::cano3_actif) { cano3->setCheckState(Qt::Checked); } else { cano3->setCheckState(Qt::Unchecked); } if (langue=="fr") { langue1->setDown(true); } if (langue=="en") { langue2->setDown(true); } if (langue=="ja") { langue3->setDown(true); } boxTemps->setValue(WidgetHorloge::nb_sec); boxNbPlaque->setValue(tirage::nb_plaques); boxCompte->setValue(tirage::compte_minimal); boxCompte2->setValue(tirage::compte_maximal); if(sauveOptions) { sauveOptionsBox->setCheckState(Qt::Checked); } else { sauveOptionsBox->setCheckState(Qt::Unchecked); } } //les modifs sont valides void WidgetOptions::modifOk() { //modification des paramtres calcul::cano1_actif=cano1->isChecked(); calcul::cano2_actif=cano2->isChecked(); calcul::cano3_actif=cano3->isChecked(); WidgetHorloge::nb_sec=boxTemps->value(); bool changementNbPlaque =false; if(tirage::nb_plaques != boxNbPlaque->value()) { tirage::nb_plaques=boxNbPlaque->value(); changementNbPlaque = true; } if(boxCompte->value()value()){ //cas normal o la valeur rentre pour le compte minimal est plus petite que l'autre tirage::compte_minimal=boxCompte->value(); tirage::compte_maximal=boxCompte2->value(); } else{ //cas o l'utilisateur est un boulet tirage::compte_minimal=boxCompte2->value(); tirage::compte_maximal=boxCompte->value(); } //rglage paramtre de langue if(langue1->isChecked() || langue2->isChecked() || langue3->isChecked()) { //utilisation de la traduction demande //on a besoin de quitter l'appli - elle est relance automatiquement dans la boucle principale if(langue1->isChecked()) { langue="fr"; } else if (langue2->isChecked()) { langue="en"; } else if (langue3->isChecked()) { langue="ja"; } } //sauvegarde ou non des options sur le disque sauveOptions=sauveOptionsBox->isChecked(); QString entete=QString("[Kitsune").append(global::numero_version).append(QString("]")); QString cheminFichierOptions=QString("/.kitsune.options.").append(global::numero_version); if(sauveOptions) { //criture du fichier de sauvegarde des options string filename=(QDir::homePath()+cheminFichierOptions).toStdString(); ofstream f_options(filename.c_str()); //TODO : utiliser un objet QFile au lieu de ofstream if (f_options.is_open()){ f_options << entete.toStdString() << endl; f_options << calcul::cano1_actif << endl; f_options << calcul::cano2_actif << endl; f_options << calcul::cano3_actif << endl; f_options << WidgetHorloge::nb_sec << endl; f_options << tirage::nb_plaques << endl; f_options << tirage::compte_minimal << endl; f_options << tirage::compte_maximal << endl; if (langue!="") { f_options << langue.toStdString() << endl; } else { f_options << "default" << endl; } f_options.close(); } } else { //suppresion du fichier d'options (si existant) supprFichierOptions(); } //appli relance si ncessaire (changement de langue) //note : qApp est un nom rserv qui dsigne l'application Qt elle-mme if(langue1->isChecked() || langue2->isChecked() || langue3->isChecked() || changementNbPlaque) { qApp->exit(NVE_LANGUE); } //fermeture du widget des options close(); } //Pour remettre les options leur valeur par dfaut void WidgetOptions::modifDefaut() { cano1->setCheckState(Qt::Checked); cano2->setCheckState(Qt::Checked); cano3->setCheckState(Qt::Checked); boxTemps->setValue(50); boxNbPlaque->setValue(6); boxCompte->setValue(100); boxCompte2->setValue(999); } //note : fonction appele dans kitsune.cpp avant de lancer le widget principal void WidgetOptions::lireFichier() { QString cheminFichierOptions=QString("/.kitsune.options.").append(global::numero_version); QFile f_options(QDir::homePath()+cheminFichierOptions); //fin de la fonction si le fichier n'existe pas if (!f_options.exists()) return; //le fichier existe : la sauvegarde des options est donc active sauveOptions = true; f_options.open( QIODevice::ReadOnly ); QTextStream ts( &f_options ); //lecture de l'entte QString entete=QString("[Kitsune").append(global::numero_version).append(QString("]")); QString debut; ts >> debut; if(debut != entete) { //ce fichier ne correspond pas cette version de kitsune; on l'ignore f_options.close(); return; } //lecture des valeurs int valeur_1, valeur_2, valeur_3, valeur_4, valeur_5, valeur_6, valeur_7; ts >> valeur_1; ts >> valeur_2; ts >> valeur_3; ts >> valeur_4; ts >> valeur_5; ts >> valeur_6; ts >> valeur_7; //test de la validit des valeurs if( valeur_1>=0 && valeur_1<=1 && valeur_2>=0 && valeur_2<=1 && valeur_3>=0 && valeur_3<=1 && valeur_4>=min_temps_reflexion && valeur_4<=max_temps_reflexion && valeur_5>=min_nb_plaques && valeur_5<=max_nb_plaques && valeur_6>=min_min_compte && valeur_6<=max_min_compte && valeur_7>=min_max_compte && valeur_7<=max_max_compte && valeur_6<=valeur_7) { calcul::cano1_actif=valeur_1; calcul::cano2_actif=valeur_2; calcul::cano3_actif=valeur_3; WidgetHorloge::nb_sec=valeur_4; tirage::nb_plaques=valeur_5; tirage::compte_minimal=valeur_6; tirage::compte_maximal=valeur_7; } else { QMessageBox::warning (0, tr("Options"), tr("Fichier d'options incorrect."), QMessageBox::Ok); } //lecture de la langue ts >> langue; if (langue=="default") { langue=""; } f_options.close(); } void WidgetOptions::supprFichierOptions() { QString cheminFichierOptions=QString("/.kitsune.options.").append(global::numero_version); QFile f_options(QDir::homePath()+cheminFichierOptions); //fin de la fonction si le fichier n'existe pas if (!f_options.exists()) { return; } if(f_options.remove()) { QMessageBox::information (this, tr("Suppression"), tr("Le fichier d'options a t supprim."), QMessageBox::Ok); } else { //TODO : indiquer le chemin du fichier d'options dans le message d'erreur QMessageBox::warning (this, tr("Suppression"), tr("La suppression du fichier d'options a chou."), QMessageBox::Ok); } } kitsune2.0/src/widgetoptions.h0000644000175000017500000000505610625374012015653 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef WIDGETOPTIONS_H #define WIDGETOPTIONS_H #include "global.h" #include class QCheckBox; class QSpinBox; class QRadioButton; class QString; class WidgetOptions : public QDialog, policesQt { Q_OBJECT public: //paramtres limites/par dfaut des options static int min_temps_reflexion; static int max_temps_reflexion; static int min_nb_plaques; static int max_nb_plaques; static int min_min_compte; static int max_min_compte; static int min_max_compte; static int max_max_compte; //paramtres pour les langues static QString langue; static int NVE_LANGUE; //valeur pour relancer l'appli (valeur sans importance - sauf 0) //lecture du fichier d'options static void lireFichier(); //appelable tel quel static bool sauveOptions; //indique s'il faut sauvegarder les options sur le disque //widget options WidgetOptions( QWidget* parent = 0); QCheckBox *cano1, *cano2, *cano3, *sauveOptionsBox; QRadioButton *langue1, *langue2, *langue3; QSpinBox *boxTemps, *boxNbPlaque, *boxCompte, *boxCompte2; public slots: void modifOk(); void modifDefaut(); void supprFichierOptions(); }; #endif kitsune2.0/src/widgetplaque.cpp0000644000175000017500000001243110621561656016005 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgetplaque.h" #include "tirage.h" #include //Cration d'un widget regroupant 1 Lcd et 2 pushbuttons pour les plaques WidgetPlaque::WidgetPlaque( QWidget *parent, int numW, int type_plaqueW) : QWidget( parent) { //init du num de widget et de la variable d'tat est_compte //num est un identifiant unique qui doit tre diffrent pour chaque plaque num=numW; type_plaque=type_plaqueW; //init des elements graphiques QVBoxLayout *vboxLayout = new QVBoxLayout(this); vboxLayout->setSpacing(0); vboxLayout->setMargin(0); //un afficheur lcd lcd = new QLCDNumber(this); if (type_plaque==0) { lcd->setNumDigits( 1 ); lcd->setFixedSize( 32, 51 ); } else { lcd->setNumDigits( 3 ); lcd->setFixedHeight( 28 ); } lcd->setSegmentStyle( QLCDNumber::Flat ); lcd->setAutoFillBackground ( true ); if (type_plaque==0) { //plaque du compte colorise(0); cliquable=false; reglable=true; } else if (type_plaque==1){ //plaque du tirage colorise(1); cliquable=true; reglable=true; } else { //plaque de rsolution colorise(3); cliquable=false; reglable=false; } vboxLayout->addWidget(lcd); //cration du timer timer= new QTimer; connect(timer, SIGNAL(timeout()), this, SLOT(pbClicked()) ); } void WidgetPlaque::pbClicked() { emit change(num, clicPlus); } void WidgetPlaque::displayRefresh(int numW, int valeur) { //rception du signal si le numro de widget correspond //mthode un peu lourde mais qui permet de supprimer le nom des widgets if(num==numW) { if(numW>=100){ //cas d'un lcd du widget de rsolution if (valeur <=999) {lcd->setNumDigits(3);} else if(valeur <=9999) {lcd->setNumDigits(4);} else if(valeur <=99999) {lcd->setNumDigits(5);} else if(valeur <=999999) {lcd->setNumDigits(6);} else if(valeur <=9999999) {lcd->setNumDigits(7);} else if(valeur <=99999999) {lcd->setNumDigits(8);} else lcd->setNumDigits(9); } lcd->display(valeur); //on n'affiche que les plaques que l'on utilise if(numW>=tirage::nb_plaques && numW<10){ hide(); } else{ show(); } } } void WidgetPlaque::updateEtat(int numW, int valeur) { if(num==numW) { if(valeur==0){ //plaque en attente d'un clic cliquable=true; colorise(1); //colore en blanc } else if(valeur==1){ //plaque du tirage dsactive cliquable=false; colorise(1); //colore en blanc } else if(valeur==2){ //plaque = le bon compte cliquable=false; colorise(0); //colore en orange } else if(valeur==3){ //plaque utilise cliquable=false; colorise(2); //colore en gris } else { //plaque cache cliquable=false; colorise(3); //colore en gris total } } } //pour rendre non cliquable une plaque void WidgetPlaque::nonCliquable(int numW){ if(num==numW) { cliquable=false; } } //action effectue lorsqu'on utilise la molette de la souris void WidgetPlaque::wheelEvent(QWheelEvent *event) { if (!reglable) return; if (event->delta()>0){ clicPlus=true; } else { clicPlus=false; } pbClicked(); } //on met la valeur de la plaque ds qu'il y a un clic void WidgetPlaque::mousePressEvent(QMouseEvent *event) { if(reglable){ if(event->button()==Qt::RightButton) { clicPlus=false; } else { clicPlus=true; } pbClicked(); timer->start(150); //launch the timer to repeat the action } else if(cliquable){ cliquable=false; colorise(2); emit valeur(num,lcd->intValue()); } } //dtection de la relche du bouton void WidgetPlaque::mouseReleaseEvent ( QMouseEvent *) { timer->stop(); } //permet d'activer/dsactiver les possibilits de rglage de la plaque void WidgetPlaque::estReglable(bool regl) { reglable = regl; } void WidgetPlaque::colorise(int couleur) { if (couleur==0) { lcd->setPalette( palette_orange ); } else if (couleur==1) { lcd->setPalette( palette_blanc ); } else if (couleur==2) { lcd->setPalette( palette_gris ); } else { lcd->setPalette( palette_gris_total ); } } kitsune2.0/src/widgetplaque.h0000644000175000017500000000546210624071643015453 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef WIDGETPLAQUE_H #define WIDGETPLAQUE_H #include #include #include #include "global.h" class QLCDNumber; class QTimer; //Widget regroupant 1 Lcd et 2 pushbuttons pour les plaques class WidgetPlaque : public QWidget, couleurs { Q_OBJECT public: WidgetPlaque( QWidget *parent=0, int numW=0, int type_plaque=0); //constructeur //elements graphiques QLCDNumber *lcd; //numero de widget int num; //type de plaque : 0 pour une plaque du compte, 1 pour une plaque du tirage, 2 pour une plaque du widget de rsolution. int type_plaque; //true si un clic doit la modifier (+-), false si elle doit servir faire un calcul bool reglable; //false si elle a dj t utilise bool cliquable; //timer pour la rptition des clics QTimer *timer; bool clicPlus; private slots : void pbClicked(); public slots : void displayRefresh(int numW, int valeur); void updateEtat(int numW, int valeur); void estReglable(bool reglable); //permet d'activer/dsactiver les possibilits de rglage de la plaque void colorise(int couleur); void nonCliquable(int numW); void mousePressEvent(QMouseEvent *); void mouseReleaseEvent ( QMouseEvent *); void wheelEvent(QWheelEvent *event); signals : void change(int, bool); //prt tre connect directement tirage_change void valeur(int, int); //met la valeur de la plaque }; #endif kitsune2.0/src/widgetpopup.cpp0000644000175000017500000001253010624071643015654 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgetpopup.h" #include "widgetoptions.h" #include //La fentre qui apparat quand on clique sur le menu "Licence" est diffrente des 4 autres fentres de ce type //(elle possde deux boutons en plus), d'o le boolen "est_fenetre_licence" pour dterminer dans quel cas on se trouve WidgetPopup::WidgetPopup( QWidget* parent, bool est_fenetre_licence, QString nomFichier, QString titreFenetre) : QDialog( parent) { //titre de fentre if(titreFenetre!=QString("")) { setWindowTitle(titreFenetre); } //un layout vertical pour le QDialog WidgetPopup QVBoxLayout *vboxPopup = new QVBoxLayout( this ); vboxPopup->setSpacing(0); vboxPopup->setMargin(0); //deux layouts horizontaux dans lesquels on placera le texte pour l'un, le ou les boutons pour l'autre QWidget *horizontalLayout1 = new QWidget( this ); QWidget *horizontalLayout2 = new QWidget( this ); QHBoxLayout *hboxLayout1 = new QHBoxLayout(horizontalLayout1); QHBoxLayout *hboxLayout2 = new QHBoxLayout(horizontalLayout2); hboxLayout1->setSpacing(0); hboxLayout1->setMargin(0); hboxLayout2->setSpacing(0); hboxLayout2->setMargin(0); vboxPopup->addWidget( horizontalLayout1 ); vboxPopup->addWidget( horizontalLayout2 ); //le cadre de texte QTextBrowser *textEditPopup = new QTextBrowser( horizontalLayout1 ); //la taille du texte, dont dpend la taille de la fentre au lancement textEditPopup->setMinimumWidth(600); textEditPopup->setMinimumHeight(400); //paramtres du texte textEditPopup->setReadOnly( TRUE ); textEditPopup->setOpenExternalLinks( TRUE ); //pour utiliser un navigateur pour ouvrir les liens externes if(nomFichier!=QString("")) { QFile fichier(nomFichier); fichier.open( QIODevice::ReadOnly ); QTextStream textestream( &fichier ); if (nomFichier.contains("ja")) { textestream.setCodec("UTF-8"); //textes en japonais } else{ textestream.setCodec("ISO 8859-1"); //textes en franais ou anglais } textEditPopup->setHtml(textestream.readAll()); //lecture du texte du fichier fichier.close(); } hboxLayout1->addWidget(textEditPopup); //les boutons "Licence", "Traduction", que l'on affiche ou non suivant le cas if (est_fenetre_licence){ QPushButton *pbLicence = new QPushButton( tr("Licence GPL"), horizontalLayout2 ); pbLicence->setFont( font_normal ); connect( pbLicence, SIGNAL( clicked() ), this, SLOT( ouvre_licence() ) ); hboxLayout2->addStretch(1); hboxLayout2->addWidget(pbLicence); hboxLayout2->addStretch(1); //Ajout d'une traduction pour les non-anglophones if (WidgetOptions::langue!="en") { QPushButton *pbTraduction = new QPushButton( tr("Traduction de la GPL"), horizontalLayout2 ); pbTraduction->setFont( font_normal ); hboxLayout2->addWidget(pbTraduction); connect( pbTraduction, SIGNAL( clicked() ), this, SLOT( ouvre_traduction() ) ); } } //le bouton "OK" que l'on affiche de toute faon QPushButton* pbOk = new QPushButton( tr("OK"), horizontalLayout2 ); pbOk->setFont( font_normal ); //Il capte le focus au lancement, ce qui permet de juste avoir appuyer sur "Entre" pour sortir de la fentre pbOk->setFocus(); hboxLayout2->addStretch(1); hboxLayout2->addWidget(pbOk); hboxLayout2->addStretch(1); //on ferme la fentre quand on clique sur "OK" connect( pbOk, SIGNAL( clicked() ), this, SLOT( close() ) ); } //fonction d'affichage d'une fentre contenant la GPL en anglais //traduction ou non suivant boolen void WidgetPopup::ouvre_licence() { lire_texte(false); } //fonction d'affichage d'une fentre contenant la GPL en franais void WidgetPopup::ouvre_traduction() { lire_texte(true); } void WidgetPopup::lire_texte(bool traduction) { if(traduction) { WidgetPopup popup( this, false, QString(tr(":/txt/gpl-fr.html")), QString(tr("Traduction de la Licence GNU GPL"))); popup.exec(); } else { WidgetPopup popup( this, false, QString(":/txt/gpl-en.html"), QString(tr("Licence originale (anglais) GNU GPL"))); popup.exec(); } } kitsune2.0/src/widgetpopup.h0000644000175000017500000000352410625374012015321 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef WIDGETPOPUP_H #define WIDGETPOPUP_H #include "global.h" #include class WidgetPopup : public QDialog, policesQt { Q_OBJECT public: WidgetPopup( QWidget* parent = 0, bool est_fenetre_licence = false, QString nomFichier=QString(""), QString titreFenetre=QString("")); public slots: void ouvre_licence(); void ouvre_traduction(); void lire_texte(bool traduction); }; #endif kitsune2.0/src/widgetprincipal.cpp0000644000175000017500000005711210625374012016474 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgetprincipal.h" #include /*------------------------------------------------------------------------------------------------- // Widget Principal //-----------------------------------------------------------------------------------------------*/ Principal::Principal( QWidget *parent ) : QMainWindow( parent ) { //Dfinition des textes affichs //la classe Principal possde la macro Q_OBJECT et donc peut faire des appels tr texte_version="Kitsune "+ global::numero_version; texte_renard_repos=tr("Kitsune"); texte_renard_ceb=tr("Le compte est bon !"); texte_renard_pds=tr("Il n'y a pas de solution."); texte_renard_gagne=tr("Gagn !"); texte_renard_perdu=tr("Perdu."); texte_statut_attente=tr("En attente."); texte_statut_en_cours=tr("Calcul en cours..."); texte_statut_duree=tr("Dure du calcul : "); //mapper pour la lecture de fichiers textes lireTexte_Mapper=new QSignalMapper(this); connect( lireTexte_Mapper, SIGNAL(mapped(int)), this, SLOT(lire_texte(int)) ); //barre de titre setWindowTitle(QString(tr("Kitsune"))); //Barre de menus QMenuBar *MenuBar = new QMenuBar( this ); setMenuBar(MenuBar); MenuBar->setFont( font_normal ); QMenu *fichierMenu = new QMenu ( this ); QMenu *infoMenu = new QMenu ( this ); QAction *optionsAction = new QAction( this ); QAction *fileExitAction = new QAction( this ); fichierMenu = menuBar()->addMenu(tr("&Fichier")); fichierMenu->addAction(optionsAction); fichierMenu->addAction(fileExitAction); fichierMenu->setFont( font_normal ); QAction *helpAideAction = new QAction( this ); QAction *helpLicenceAction = new QAction( this ); QAction *helpAboutAction = new QAction( this ); infoMenu = menuBar()->addMenu(tr("&Info")); infoMenu->setFont( font_normal ); infoMenu->addAction(helpAideAction); infoMenu->addAction(helpLicenceAction); infoMenu->addAction(helpAboutAction); //initialisation des menus fileExitAction->setText(tr("&Quitter")); optionsAction->setText(tr("&Options")); helpAideAction->setText(tr("Ai&de")); helpLicenceAction->setText(tr("&Licence")); helpAboutAction->setText(tr("A &propos")); //fonctions de connexion signal<--->slot //fonctions pour la barre de menus connect( fileExitAction, SIGNAL( triggered() ), this, SLOT( close() ) ); connect( optionsAction, SIGNAL( triggered() ), this, SLOT( options() ) ); connect( helpAideAction, SIGNAL( triggered() ), lireTexte_Mapper, SLOT(map()) ); connect( helpLicenceAction, SIGNAL( triggered() ), lireTexte_Mapper, SLOT(map()) ); connect( helpAboutAction, SIGNAL( triggered() ), lireTexte_Mapper, SLOT(map()) ); lireTexte_Mapper->setMapping(helpAideAction, 2); lireTexte_Mapper->setMapping(helpLicenceAction, 1); lireTexte_Mapper->setMapping(helpAboutAction, 0); //Pour la barre de statut, temps de calcul heure = new QTime(); //Widget horizontal parent QWidget *hbox = new QWidget( this ); QHBoxLayout *hboxLayout = new QHBoxLayout( hbox ); hboxLayout->setSpacing(1); hboxLayout->setMargin(1); setCentralWidget(hbox); //Bote verticale contenant tous les lments de la gauche de la fentre QWidget *vboxA = new QWidget( hbox ); QVBoxLayout *vboxLayoutA = new QVBoxLayout( vboxA ); vboxA->setFixedWidth(288); vboxLayoutA->setSpacing(0); vboxLayoutA->setMargin(0); //Bote verticale contenant tous les lments du milieu de la fentre QWidget *vboxB = new QWidget( hbox ); QVBoxLayout *vboxLayoutB = new QVBoxLayout( vboxB ); vboxLayoutB->setSpacing(0); vboxLayoutB->setMargin(0); vboxB->setFixedWidth(200); //cadre de texte pour les rsultats, colonne de droite textEditC = new QTextEdit( hbox ); textEditC->setReadOnly( TRUE ); textEditC->setFixedWidth(288); textEditC->setFont( font_monospace ); //insertion des widgets dans le layout hboxLayout->addStretch( 1 ); hboxLayout->addWidget( vboxA ); hboxLayout->addStretch( 1 ); hboxLayout->addWidget( vboxB ); hboxLayout->addStretch( 1 ); hboxLayout->addWidget( textEditC ); hboxLayout->addStretch( 1 ); //----------Colonne de gauche-------------------------------------------------------------- //Widgets aligns verticalement gauche QWidget *horLayout1 = new QWidget( vboxA ); QHBoxLayout *hboxLayout1 = new QHBoxLayout(horLayout1); hboxLayout1->setSpacing(0); hboxLayout1->setMargin(0); QWidget *horLayout2 = new QWidget( vboxA ); QHBoxLayout *hboxLayout2 = new QHBoxLayout(horLayout2); hboxLayout2->setSpacing(0); hboxLayout2->setMargin(0); QWidget *horLayout3 = new QWidget( vboxA ); QHBoxLayout *hboxLayout3 = new QHBoxLayout(horLayout3); hboxLayout3->setSpacing(0); hboxLayout3->setMargin(0); resol= new WidgetResolution(horLayout3); //barre de progression pour le temps horloge=new WidgetHorloge( vboxA ); horloge->setFixedHeight( 15 ); BarreStatut = new QStatusBar ( vboxA ); //insertion des widgets dans le layout vboxLayoutA->addStretch( 1 ); vboxLayoutA->addWidget( horLayout1 ); vboxLayoutA->addWidget( horLayout2 ); vboxLayoutA->addWidget( horLayout3 ); vboxLayoutA->addSpacing( 5 ); vboxLayoutA->addWidget( horloge ); vboxLayoutA->addWidget( BarreStatut ); vboxLayoutA->addStretch( 1 ); //premire ligne : le compte + les modifieurs //WidgetPlaque 10, 11 et 12 hboxLayout1->addStretch( 1 ); for(int Wi=0; Wi<3; Wi++) { WidgetPlaque *plaque= new WidgetPlaque(horLayout1, Wi+10, 0); hboxLayout1->addWidget( plaque ); connect( this, SIGNAL(refresh(int, int)), plaque, SLOT(displayRefresh(int, int)) ); connect( plaque, SIGNAL(change(int, bool)), this, SLOT(compte_change(int, bool)) ); connect( this, SIGNAL(plaqueReglable(bool)), plaque, SLOT(estReglable(bool)) ); } hboxLayout1->addStretch( 1 ); //deuxime ligne : les plaques + les modifieurs horLayout2->setFixedHeight( 43 ); for(int Wi=0; Wi<6; Wi++) { WidgetPlaque *plaque= new WidgetPlaque(horLayout2, Wi, 1); hboxLayout2->addWidget( plaque ); connect( this, SIGNAL(refresh(int, int)), plaque, SLOT(displayRefresh(int, int)) ); connect( this, SIGNAL(changeEtat(int, int)), plaque, SLOT(updateEtat(int, int)) ); connect( resol, SIGNAL(changeEtat(int, int)), plaque, SLOT(updateEtat(int, int)) ); connect( plaque, SIGNAL(change(int, bool)), this, SLOT(tirage_change(int, bool)) ); connect( this, SIGNAL(plaqueReglable(bool)), plaque, SLOT(estReglable(bool)) ); connect( plaque, SIGNAL(valeur(int,int)), resol, SLOT(gestionPlaque(int,int)) ); } //troisime ligne : le widget de rsolution hboxLayout3->addStretch( 1 ); hboxLayout3->addWidget( resol ); hboxLayout3->addStretch( 1 ); connect( resol, SIGNAL(la_victoire()), this, SLOT(victoire()) ); //cinquime ligne : la barre de statut BarreStatut->setSizeGripEnabled ( false ); BarreStatut->setFont( font_normal ); connect( horloge, SIGNAL(TempsEpuise()), this, SLOT(defaite()) ); //----------Deuxime colonne--------------------------------------------------------------- //image du renard QWidget *horLayoutB1 = new QWidget( vboxB ); QHBoxLayout *hboxLayoutB1 = new QHBoxLayout(horLayoutB1); hboxLayoutB1->setSpacing(0); hboxLayoutB1->setMargin(0); horLayoutB1->setFixedHeight(150); pixmapLabelRenard = new QLabel( horLayoutB1 ); renard_normal = new QPixmap(":/images/normal-150x150.png"); renard_heureux = new QPixmap(":/images/heureux-150x150.png"); renard_triste = new QPixmap(":/images/triste-150x150.png"); pixmapLabelRenard->setFixedSize( 150, 150 ); hboxLayoutB1->addStretch( 1 ); hboxLayoutB1->addWidget(pixmapLabelRenard); hboxLayoutB1->addStretch( 1 ); //le texte sous le renard texte_renard = new QLabel( vboxB ); texte_renard->setFont( font_gros ); texte_renard->setAlignment( Qt::AlignHCenter ); //les boutons pbJouer = new QPushButton(tr("Jouer"), vboxB ); pbRes = new QPushButton(tr("Rsoudre"), vboxB ); pbAlea = new QPushButton(tr("Alatoire"), vboxB ); pbZero = new QPushButton(tr("Mise zro"), vboxB ); pbJouer->setFont( font_normal ); pbRes->setFont( font_normal ); pbAlea->setFont( font_normal ); pbZero->setFont( font_normal ); pbJouer->setFixedWidth( 100 ); pbRes->setFixedWidth( 100 ); pbAlea->setFixedWidth( 100 ); pbZero->setFixedWidth( 100 ); //au dmarrage de l'application, le focus est positionn sur le bouton "alatoire" pbAlea->setFocus(); //insertion des widgets dans le layout vboxLayoutB->addStretch( 3 ); vboxLayoutB->addWidget( horLayoutB1 ); vboxLayoutB->addWidget( texte_renard ); vboxLayoutB->addStretch( 3 ); vboxLayoutB->addWidget( pbJouer ); vboxLayoutB->addStretch( 1 ); vboxLayoutB->addWidget( pbAlea ); vboxLayoutB->addStretch( 1 ); vboxLayoutB->addWidget( pbRes ); vboxLayoutB->addStretch( 1 ); vboxLayoutB->addWidget( pbZero ); vboxLayoutB->addStretch( 3 ); vboxLayoutB->setAlignment(pbJouer,Qt::AlignHCenter); vboxLayoutB->setAlignment(pbRes,Qt::AlignHCenter); vboxLayoutB->setAlignment(pbAlea,Qt::AlignHCenter); vboxLayoutB->setAlignment(pbZero,Qt::AlignHCenter); //----------Initialisations---------------------------------------------------------------- //pour avoir du vrai alatoire, pas toujours les mmes valeurs srand (time (NULL)); //l'mission du signal permet de bloquer ou de dbloquer le module de rsolution connect( this, SIGNAL(bloque_module(bool)), resol, SLOT(bloque_le_module(bool)) ); //fonctions pour les boutons connect( pbJouer, SIGNAL(clicked()), this, SLOT(jouer()) ); connect( pbRes, SIGNAL(clicked()), this, SLOT(resoudre()) ); connect( pbAlea, SIGNAL(clicked()), this, SLOT(aleatoire()) ); connect( pbZero, SIGNAL(clicked()), this, SLOT(mise_a_zero()) ); //init et connection de la classe jeu J =new jeu; connect( J, SIGNAL(finished()), this, SLOT(fin_calcul()) ); //initialisation des paramtres mise_a_zero(); } /*------------------------------------------------------------------------------------------------- // Fonctions appeles par la barre de menus en haut de l'interface //-----------------------------------------------------------------------------------------------*/ //fonction d'ouverture pour le cochage des options void Principal::options() { //note : ancien_nb_plaques est actuellement inutile car on relance l'appli lorsque le nb de plaques change int ancien_nb_plaques=tirage::nb_plaques; int ancien_compte_minimal=tirage::compte_minimal; int ancien_compte_maximal=tirage::compte_maximal; WidgetOptions opt( this ); opt.exec(); if(ancien_nb_plaques!=tirage::nb_plaques || ancien_compte_minimal!=tirage::compte_minimal || ancien_compte_maximal!=tirage::compte_maximal){ mise_a_zero(); } } //Fonction appele lors d'un clic dans le menu "Info" void Principal::lire_texte(int num) { if(num==0) { //fentre " propos" WidgetPopup popup( this, false, QString(tr(":/txt/about-fr.html")), QString(texte_version)); popup.exec(); } else if(num==1) { //popup de licence (true) WidgetPopup popup( this, true, QString(tr(":/txt/licence-fr.html")), QString(tr("Licence de Kitsune"))); popup.exec(); } else if(num==2) { //fentre d'aide WidgetPopup popup( this, false, QString(tr(":/txt/aide-fr.html")), QString(tr("Aide"))); popup.exec(); } } /*------------------------------------------------------------------------------------------------- // Fonctions appeles lors d'un clic sur un des boutons //-----------------------------------------------------------------------------------------------*/ //on rsout un problme rentr manuellement void Principal::jouer() { jeu_en_cours=true; trop_tard=false; textEditC->setPlainText(""); //rinitialisation de la zone des rsultats pbAlea->setEnabled( false ); pbJouer->setEnabled( false ); emit plaqueReglable( false ); resol->init(); reinit_plaques_tirage( false ); reinit_statut(); horloge->remise_a_zero(); //lancement de la resolution en tache de fond lancement_calcul(); } //on rsout le calcul si ce n'est pas dj fait en mmoire, et on affiche les solutions void Principal::resoudre() { if(jeu_en_cours){ emit bloque_module( true ); emit plaqueReglable( true ); reinit_plaques_tirage( false ); pbJouer->setEnabled( true ); horloge->arrete(); defaite(); jeu_en_cours=false; affiche_solutions(); } else { lancement_calcul(); } } //dtermination alatoire d'un nouveau problme void Principal::aleatoire(){ //tat de l'application jeu_en_cours=true; trop_tard=false; textEditC->setPlainText(""); //rinitialisation de la zone des rsultats pbAlea->setEnabled( false ); pbJouer->setEnabled( false ); emit plaqueReglable( false ); resol->init(); reinit_plaques_tirage( false ); reinit_statut(); horloge->remise_a_zero(); //dtermination du nouveau compte liste_des_chiffres.clear(); liste_des_chiffres.assign(3,0); int valeur_compte=tirage::compte_minimal+rand()%(tirage::compte_maximal-tirage::compte_minimal+1); liste_des_chiffres[0]=valeur_compte/100; liste_des_chiffres[1]=(valeur_compte/10)%10; liste_des_chiffres[2]=(valeur_compte)%10; //dtermination des plaques et du tirage t.tab.clear(); pseudo_tirage pt; //pseudo-tirage pour le calcul alatoire des plaques pt.assign(tirage::nb_plaques,0); liste_des_plaques.clear(); liste_des_plaques.assign(tirage::nb_plaques,0); int i; int hasard; vector v; v.assign(24,0); for(i=0;i<=23;i++){ v[i]=i; } for(i=0;isetPlainText(""); resol->init(); reinit_plaques_tirage(false); //barre de progression pour le temps coul horloge->arrete(); horloge->remise_a_zero(); //initialisation du compte la valeur (compte minimal+compte maximal+1)/2 //(+1 car on arrondit la valeur suprieure) liste_des_chiffres.clear(); liste_des_chiffres.assign(3,0); int tirage_par_defaut=(tirage::compte_minimal+tirage::compte_maximal+1)/2; liste_des_chiffres[0]=tirage_par_defaut/100; liste_des_chiffres[1]=(tirage_par_defaut/10)%10; liste_des_chiffres[2]=tirage_par_defaut%10; //initialisation des plaques int i; liste_des_plaques.clear(); liste_des_plaques.assign(tirage::nb_plaques,0); for(i=0;isetEnabled( true ); pbJouer->setEnabled( true ); } /*------------------------------------------------------------------------------------------------- // Fonctions pour le lancement et la fin d'un calcul //-----------------------------------------------------------------------------------------------*/ //lance le thread de rsolution du problme void Principal::lancement_calcul(){ //TODO: dsactiver le clic sur les plaques du tirage //les boutons sont dsactivs le temps du calcul pbRes->setEnabled( false ); pbZero->setEnabled( false ); pbAlea->setEnabled( false ); pbJouer->setEnabled( false ); //affichage BarreStatut->showMessage( QString(texte_statut_en_cours) ); setCursor( QCursor(Qt::WaitCursor)); //la souris est un sablier pendant le calcul //initialisation du compteur pour connaitre le temps de calcul heure->start(); //calcul du compte tudier compte le_compte_etudie=liste_des_chiffres[0]*100+liste_des_chiffres[1]*10+liste_des_chiffres[2]; //tude du tirage J->init(t,le_compte_etudie,le_compte_etudie); J->start(); //lance etude_tirage sous forme d'un thread } //appel automatiquement en fin de calcul (connect au signal J.finished) void Principal::fin_calcul() { //calcul termin => on rtablit la flche de la souris setCursor( QCursor(Qt::ArrowCursor)); affiche_temps_de_calcul(); if(jeu_en_cours){ //mise jour de l'affichage update_affichage_compte(); update_affichage_plaques(); //on indique la meilleure solution possible au widget de rsolution int dist=J->distance_a_la_solution(); resol->cible.first=J->lim_inf-dist; //J->lim_inf stocke le compte tudi resol->cible.second=J->lim_inf+dist; //on dbloque le widget de rsolution emit bloque_module( false ); reinit_plaques_tirage( true ); horloge->lance(); //le compte rebours commence } else { affiche_solutions(); renard_apres_calcul(); //boutons ractivs pbAlea->setEnabled( true ); pbJouer->setEnabled( true ); } //boutons ractivs pbRes->setEnabled( true ); pbZero->setEnabled( true ); } /*------------------------------------------------------------------------------------------------- // Fonctions de mise jour de l'affichage //-----------------------------------------------------------------------------------------------*/ //une fonction pour mettre jour l'affichage du compte void Principal::update_affichage_compte() { for(int Wi=0; Wi<3; Wi++) { emit refresh(Wi+10, liste_des_chiffres[Wi]); } } //une fonction pour mettre jour l'affichage des plaques void Principal::update_affichage_plaques() { for(int Wi=0; Wi<6; Wi++) { emit refresh(Wi, liste_des_plaques[Wi]); } } //on rend les plaques du tirage blanches void Principal::reinit_plaques_tirage(bool cliquable){ int valeur=1; if(cliquable) {valeur=0;} for(int i=0;i<6;i++){ emit changeEtat(i,valeur); } } //une fonction pour mettre jour l'affichage du statut, du renard et du texte void Principal::reinit_statut() { BarreStatut->showMessage( texte_statut_attente ); pixmapLabelRenard->setPixmap(*renard_normal); texte_renard->setText( texte_renard_repos ); } /*------------------------------------------------------------------------------------------------- // Fonctions d'affichage des rsultats //-----------------------------------------------------------------------------------------------*/ //le joueur a trouv le bon compte ou la meilleure approx avec le widget de rsolution void Principal::victoire(){ jeu_en_cours=false; emit bloque_module( true ); emit plaqueReglable( true ); reinit_plaques_tirage( false ); affiche_solutions(); horloge->arrete(); pbAlea->setEnabled( true ); pbJouer->setEnabled( true ); if(!trop_tard){ renard_apres_jeu(true); } } //le temps s'est coul avant que le joueur ait trouv le bon compte, ou il a abandonn void Principal::defaite(){ trop_tard=true; renard_apres_jeu(false); pbAlea->setEnabled( true ); } //Affiche le temps que la machine a pris pour calculer les solutions dans la barre d'tat en bas de l'interface void Principal::affiche_temps_de_calcul(){ //dtermination du temps que le calcul a pris int temps_ecoule=heure->elapsed(); //calcul et affichage du temps coul int secondes=temps_ecoule/1000; int centiemes=(temps_ecoule%1000)/10; QString resultat=QString(texte_statut_duree); resultat.append( QString().sprintf("%d,", secondes) ); if(centiemes<10){ //pour viter la blague du 1.7s au lieu de 1.07s resultat.append( QString("0")); } resultat.append( QString().sprintf("%d s", centiemes) ); BarreStatut->showMessage( resultat ); } //affichage des solutions void Principal::affiche_solutions() { //rappel du tirage et du compte textEditC->setPlainText(""); textEditC->insertPlainText(QString(tr("Tirage : "))); textEditC->insertPlainText(QString(J->afficheProbleme().c_str())); textEditC->insertPlainText(QString("\n")); //rappel du compte textEditC->insertPlainText(QString(tr("Compte : "))); textEditC->insertPlainText(QString("%1").arg(J->lim_inf)); textEditC->insertPlainText(QString("\n\n")); //affichage des rsultats dans le cadre de texte prvu cet effet textEditC->insertPlainText(J->afficheBase()); } //met jour l'affichage du renard une fois un calcul normal termin void Principal::renard_apres_calcul(){ if(J->distance_a_la_solution()==0){ texte_renard->setText( texte_renard_ceb ); pixmapLabelRenard->setPixmap(*renard_heureux); } else{ texte_renard->setText( texte_renard_pds ); pixmapLabelRenard->setPixmap(*renard_triste); } } //met jour l'affichage du renard une fois le jeu termin void Principal::renard_apres_jeu(bool gagne){ //petite phrase d'information en bas de la fentre + image if(gagne){ texte_renard->setText( texte_renard_gagne ); pixmapLabelRenard->setPixmap(*renard_heureux); } else{ texte_renard->setText( texte_renard_perdu ); pixmapLabelRenard->setPixmap(*renard_triste); } } /*------------------------------------------------------------------------------------------------- // Fonctions de modification des plaques //-----------------------------------------------------------------------------------------------*/ //fonction appele chaque modification du compte void Principal::compte_change(int numero_plaque, bool est_plus) { if(est_plus) { liste_des_chiffres[numero_plaque-10]=liste_des_chiffres[numero_plaque-10]+1; } else { liste_des_chiffres[numero_plaque-10]=liste_des_chiffres[numero_plaque-10]-1; } int nouveau_compte=liste_des_chiffres[0]*100+liste_des_chiffres[1]*10+liste_des_chiffres[2]; if(nouveau_compte>=tirage::compte_minimal && nouveau_compte <= tirage::compte_maximal) { liste_des_chiffres[0]=nouveau_compte/100; liste_des_chiffres[1]=(nouveau_compte/10)%10; liste_des_chiffres[2]=(nouveau_compte)%10; update_affichage_compte(); reinit_plaques_tirage( false ); reinit_statut(); return; } //annulation de la modif if(est_plus) { liste_des_chiffres[numero_plaque-10]=liste_des_chiffres[numero_plaque-10]-1; } else { liste_des_chiffres[numero_plaque-10]=liste_des_chiffres[numero_plaque-10]+1; } } //fonction appele chaque modification d'une plaque du tirage void Principal::tirage_change(int numero_plaque, bool est_plus) { plaque plaque_passee=liste_des_plaques[numero_plaque]; plaque plaque_future=0; if(est_plus){ plaque_future=plus_petite_plaque_sup(t,plaque_passee); } else{ plaque_future=plus_petite_plaque_inf(t,plaque_passee); } if(plaque_future!=0){ liste_des_plaques[numero_plaque]=plaque_future; t.tab[plaque_passee]--; t.tab[plaque_future]++; //affichage update_affichage_plaques(); reinit_plaques_tirage( false ); reinit_statut(); } } kitsune2.0/src/widgetprincipal.h0000644000175000017500000001011010625374012016124 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef PRINCIPAL_H #define PRINCIPAL_H #include "tirage.h" #include "jeu.h" #include "widgetpopup.h" #include "widgetplaque.h" #include "widgetoptions.h" #include "widgetresolution.h" #include "global.h" #include "widgethorloge.h" #include #include #include class QSignalMapper; class QTextEdit; class QLabel; class QPixmap; class Principal : public QMainWindow, policesQt { Q_OBJECT public: Principal( QWidget *parent=0 ); QString texte_version, texte_renard_repos, texte_renard_ceb, texte_renard_pds, texte_statut_attente, texte_statut_en_cours, texte_statut_duree, texte_renard_gagne, texte_renard_perdu; //la classe jeu ne doit pas tre dtruite en sortie de resoudre (thread actif) jeu *J; //divers paramtres lis au calcul tirage t; vector liste_des_plaques; vector liste_des_chiffres; //paramtres pour dterminer l'tat dans lequel se trouve l'application //true si le joueur est en train de rsoudre un compte en temps limit bool jeu_en_cours; //mis true si le joueur n'a pas eu le temps de trouver la solution bool trop_tard; //pour savoir combien de temps le calcul a pris QTime *heure; //widgets parents QWidget *hbox_res; QTextEdit *textEditC; WidgetResolution *resol; //diffrents widgets QLabel *texte_renard; WidgetHorloge *horloge; QStatusBar *BarreStatut; QPushButton *pbJouer, *pbRes, *pbAlea, *pbZero; //image du renard QLabel *pixmapLabelRenard; QPixmap *renard_normal, *renard_heureux, *renard_triste; //mapper pour le signal de lecture d'un fichier texte QSignalMapper *lireTexte_Mapper; public slots: //fonctions d'ouverture des fentres des menus void options(); void lire_texte(int num); //fonctions appeles lorsque l'on pousse un des boutons void jouer(); void resoudre(); void aleatoire(); void mise_a_zero(); //fonctions pour le lancement et la fin d'un calcul void lancement_calcul(); void fin_calcul(); //fonctions de mise jour de l'affichage void update_affichage_plaques(); void update_affichage_compte(); void reinit_statut(); void reinit_plaques_tirage(bool); //fonctions d'affichage des rsultats void victoire(); void defaite(); void affiche_temps_de_calcul(); void affiche_solutions(); void renard_apres_calcul(); void renard_apres_jeu(bool); //fonctions appeles lors de la modification d'une plaque void compte_change(int,bool); void tirage_change(int,bool); signals : //signal de rafraichissement void refresh(int, int); //num de widget a rafraichir et valeur void plaqueReglable(bool); void changeEtat(int, int); void bloque_module(bool); //pour bloquer!dbloquer le module de rsolution }; #endif kitsune2.0/src/widgetresolution.cpp0000644000175000017500000002243210625046606016720 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "widgetresolution.h" #include "widgetplaque.h" #include "widgetoperation.h" #include //Dfinition du widget contenant le module de rsolution WidgetResolution::WidgetResolution( QWidget *parent ) : QWidget( parent) { //layout vertical pour les lments du widget QVBoxLayout *vbox_Layout = new QVBoxLayout( this ); vbox_Layout->setSpacing(0); vbox_Layout->setMargin(0); //dfinitions des pixmaps pour les icnes QPixmap *pixEgal = new QPixmap( QString(":/images/grand_egal.png") ); QPixmap *pixGomme = new QPixmap( QString(":/images/gomme.png") ); QPixmap *pixReinit = new QPixmap( QString(":/images/reinit.png") ); //boutons des oprations disposs sur une ligne QWidget *hbox_oper = new QWidget( this ); QHBoxLayout *hbox_oper_Layout = new QHBoxLayout( hbox_oper ); hbox_oper_Layout->setSpacing(0); hbox_oper_Layout->setMargin(0); //les 4 oprations lmentaires hbox_oper_Layout->addStretch( 1 ); int i; for(i=0; i<4; i++) { WidgetOperation *op = new WidgetOperation( this, 300+i, WidgetOperation::Plus+i, true); connect( op, SIGNAL(valeur(int,int)), this, SLOT(gestionPlaque(int,int)) ); hbox_oper_Layout->addWidget( op ); } hbox_oper_Layout->addStretch( 1 ); //boutons de nettoyage des calculs QWidget *hbox_nett = new QWidget( this ); QHBoxLayout *hbox_nett_Layout = new QHBoxLayout( hbox_nett ); hbox_nett_Layout->setSpacing(0); hbox_nett_Layout->setMargin(0); QPushButton *pbGomme = new QPushButton( "", hbox_nett); pbGomme->setFlat( true ); pbGomme->setFixedSize( 32, 32 ); pbGomme->setIcon( *pixGomme ); pbGomme->setIconSize( QSize(28,28) ); connect( pbGomme, SIGNAL(clicked()), this, SLOT(gomme()) ); QPushButton *pbReinit = new QPushButton( "", hbox_nett); pbReinit->setFlat( true ); pbReinit->setFixedSize( 32, 32 ); pbReinit->setIcon( *pixReinit ); pbReinit->setIconSize( QSize(28,28) ); connect( pbReinit, SIGNAL(clicked()), this, SLOT(init()) ); hbox_nett_Layout->addStretch( 1 ); hbox_nett_Layout->addWidget( pbGomme ); hbox_nett_Layout->addWidget( pbReinit ); hbox_nett_Layout->addStretch( 1 ); //grille de rsolution des calculs QWidget *grilleCalcul = new QWidget( this ); QGridLayout *grilleCalculLayout = new QGridLayout( grilleCalcul ); int j; int plaqueId=100; //identifiant unique de chaque plaque de la grille for(i=0; iaddWidget(plaque , i, j*2, 1, 1, Qt::AlignTop); connect(this, SIGNAL(changePlaque(int, int)), plaque, SLOT(displayRefresh(int, int)) ); connect(this, SIGNAL(changeEtat(int, int)), plaque, SLOT(updateEtat(int, int)) ); connect(this, SIGNAL(non_Cliquable(int)), plaque, SLOT(nonCliquable(int)) ); if(j==2) { connect( plaque, SIGNAL(valeur(int,int)), this, SLOT(gestionPlaque(int,int)) ); } } WidgetOperation *operation = new WidgetOperation( grilleCalcul, 400+i, 0, false); connect(this, SIGNAL(changePlaque(int, int)), operation, SLOT(changeOperation(int, int)) ); grilleCalculLayout->addWidget(operation, i, 1); QLabel *labelEgal = new QLabel( grilleCalcul ); labelEgal->setPixmap( *pixEgal ); labelEgal->setFixedSize( 32, 32 ); labelEgal->setAlignment( Qt::AlignHCenter ); grilleCalculLayout->addWidget(labelEgal , i, 3); } //ordre des trois principaux lments du widget de rsolution vbox_Layout->addWidget(hbox_oper); vbox_Layout->addWidget(grilleCalcul); vbox_Layout->addWidget(hbox_nett); //initialisation de la position position=100; x=1; y=1; total.assign(7,0); a.assign(7,0); b.assign(7,0); c.assign(7,0); //initialisation du vecteur des antcdents antecedents.assign(115,-1); //par dfaut, le module de rsolution est bloqu } //une plaque ou une opration de valeur val a t clique //pour ne pas confondre plaque et opration, les oprations ont pour valeur 501, 502, 503 et 504 void WidgetResolution::gestionPlaque(int numW, int val) { if(bloque) return; if(val>=501 && val <=504) { //clic sur une opration if(y==2) { emit changePlaque(399+x, val-500); b[x]=val-500; y++; } else if(y==3) { //une plaque est attendue, on modifie l'opration de la ligne en cours emit changePlaque(399+x, val-500); b[x]=val-500; } else if(y==1 && x>1) { //convention : on utilise automatiquement le rsultat de la ligne prcdente a[x]=total[x-1]; position--; emit changeEtat(position, 3); position++; emit changePlaque(position, total[x-1]); emit changeEtat(position, 3); antecedents[position]=position-1; position++; emit changePlaque(399+x, val-500); b[x]=val-500; y += 2; } } else { //calcul du rsultat de ligne et vrification d'opration autorise //cette vrification est ncessaire avant de changer la plaque if(y==3) { c[x]=val; if(b[x]==WidgetOperation::Plus) { total[x] = a[x] + c[x]; } else if(b[x]==WidgetOperation::Moins) { total[x] = a[x] - c[x]; if(total[x]<=0) { //opration interdite emit changeEtat(numW, 0); return; } } else if(b[x]==WidgetOperation::Fois) { total[x] = a[x] * c[x]; } else if(b[x]==WidgetOperation::Divise) { total[x] = a[x] / c[x]; if(a[x]%c[x] != 0){ //opration interdite emit changeEtat(numW, 0); return; } } } //changement de la plaque en cours if(y==1 || y==3) { antecedents[position]=numW; //on change la plaque en cours de la grille emit changePlaque(position, val); emit changeEtat(position, 3); position++; if(position==115) position=100; if(y==1) a[x]=val; //if(y==3) c=val; //note : dj effectu ci-dessus } else if(y==2) { //une opration est attendue donc on change la plaque prcdente emit changeEtat(antecedents[position-1], 0); //on dgrise l'antcdent de l'ancienne plaque antecedents[position-1]=numW; emit changePlaque(position-1, val); a[x]=val; } //incrmentation de y et changement de la plaque de fin de ligne if(y==1) { y++; } else if(y==3) { emit changePlaque(position, total[x]); emit changeEtat(position, 0); y=1; x++; position++; } //le bon compte est trouv if(total[x-1]==cible.first || total[x-1]==cible.second){ changeEtat(position-1, 2); emit la_victoire(); } } } //efface toutes les plaques void WidgetResolution::init() { int i; //efface les plaques normales for(i=0; i<15; i++) { emit changePlaque(100+i, 0); emit changeEtat(100+i, 4); antecedents[100+i]=-1; } //efface les plaques d'opration for(i=0; i<5; i++) { emit changePlaque(400+i, 0); } //rend blanches et cliquables les plaques du tirage for(int i=0;i<6;i++){ emit changeEtat(i,0); } //remet tous les compteurs de position leurs valeurs initiales position=100; x=1; y=1; total.assign(7,0); a.assign(7,0); b.assign(7,0); c.assign(7,0); } void WidgetResolution::gomme() { if(bloque) return; if(y==1) { if(position==100) return; //rien faire //on efface le rsultat de la ligne prcdente et la plaque prcdente position--; emit changePlaque(position, 0); emit changeEtat(position, 4); position--; emit changeEtat(antecedents[position], 0); antecedents[position]=-1; emit changePlaque(position, 0); emit changeEtat(position, 4); y=3; x--; } else if(y==2) { //on est en attente d'une plaque d'opration //on efface donc la plaque normale prcdente position--; y--; emit changeEtat(antecedents[position], 0); antecedents[position]=-1; emit changePlaque(position, 0); emit changeEtat(position, 4); } else if(y==3) { //on efface la plaque d'opration emit changePlaque(399+x, 0); y--; } } //fonction pour bloquer/dbloquer le module de rsolution void WidgetResolution::bloque_le_module(bool blocage){ if(blocage){ bloque=true; } else { bloque=false; } //bloque les ventuelles plaques blanches du tableau de rsolution for(int i=0; i<15; i++) { emit non_Cliquable(100+i); } } kitsune2.0/src/widgetresolution.h0000644000175000017500000000515710625046606016372 0ustar cyrilcyril/*************************************************************************** * Copyright (C) 2006-2007 by Julien Lemoine, Simon Viennot * * lapinot@tuxfamily.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef WIDGETRESOLUTION_H #define WIDGETRESOLUTION_H #include #include "tirage.h" class WidgetResolution : public QWidget { Q_OBJECT public: WidgetResolution( QWidget *parent=0 ); //constructeur bool bloque; //les operations et la gomme sont bloqus s'il est true int x, y; //position dans la grille de rsolution //valeurs des cases de la grille de rsolution vector a; //colonne de la premire plaque vector b; //colonne d'opration vector c; //colonne de la deuxime plaque vector total; //colonne du total int position; //identifiant de la plaque en cours (de 100 114) pair cible; //compte atteindre //pas d'antcdent : -1, sinon, numro de l'antcdent stock dans le vecteur. //l'antcdent d'une plaque de la grille de rsolution = plaque du tirage ou de la grille utilise vector antecedents; public slots: void gestionPlaque(int, int); void init(); //fonction pour effacer toutes les plaques void gomme(); void bloque_le_module(bool); //pour bloquer/dbloquer le module signals: void changePlaque(int, int); void changeEtat(int, int); void la_victoire(); void non_Cliquable(int); }; #endif kitsune2.0/txt/0000755000175000017500000000000010626312563012631 5ustar cyrilcyrilkitsune2.0/txt/about-en.html0000644000175000017500000000345210625046606015236 0ustar cyrilcyril About Kitsune About Kitsune

Kitsune is a free software distributed under licence GPL v.2.
Supported OS : Linux, Mac, Windows.


Contact

Web site : http://kitsune.tuxfamily.org/
Programmers : Julien Lemoine, Simon Viennot.
Email : lapinot@tuxfamily.org


Acknowledgements

Kitsune was developed with :
  • C++ language for program's main part.
  • Qt4 library for the graphical interface.
  • Subversion for revision control of source code.
  • Inkscape and The GIMP for images.
  • MinGW for compilation on Windows platform.
  • UPX to compress binaries.
  • Web site is powered by DokuWiki and hosted by Tuxfamily.



kitsune2.0/txt/about-fr.html0000644000175000017500000000415210625046606015241 0ustar cyrilcyril A propos de Kitsune A propos de Kitsune

Kitsune est un logiciel libre, voir le menu "Licence" pour plus d'informations à ce propos.
Kitsune est disponible en version Linux, Mac et Windows.


Contact

Site web : http://kitsune.tuxfamily.org/
Programmeurs : Julien Lemoine, Simon Viennot.
Email : lapinot@tuxfamily.org


Remerciements

Voici une liste de projets libres grâce auxquels Kitsune a pu voir le jour :
  • Le coeur du programme est programmé en C++, compilé avec GCC.
  • L'interface graphique utilise Qt4.
  • La programmation s'est faite à l'aide de Kate et de Subversion.
  • Les images ont été conçues avec Inkscape et The GIMP.
  • La compilation sous Windows s'est faite avec MinGW.
  • L'exécutable a été compressé avec UPX.
  • Le site web est hébergé par Tuxfamily, et utilise DokuWiki.



kitsune2.0/txt/about-ja.html0000644000175000017500000000360610625046606015227 0ustar cyrilcyril Kitsuneについて Kitsuneについて

Kitsuneは Linux、Mac、Windowsのバージョンもあります。


Contact

サイト : http://kitsune.tuxfamily.org/
プログラマー: Julien Lemoine, Simon Viennot.
メール: lapinot@tuxfamily.org


開発環境

Kitsuneは、次のオープンソースのソフトウェアを使って、開発された :
  • C++言語のGNUコンパイラ GCC.
  • GUIツールキット Qt4.
  • バージョン管理システ Subversion.
  • 画像編集ソフトウェア InkscapeThe GIMP.
  • Windows環境でGNUソフトウェア MinGW.
  • 圧縮ソフトウエア UPX.
  • サイトは、Tuxfamilyのホストで、DokuWikiで作成しています.



kitsune2.0/txt/aide-en.html0000644000175000017500000000350110624071642015016 0ustar cyrilcyril Aide Outline

Kitsune solves a given problem by computing all the "best solutions" : if the target is reachable, these are all the ways to reach it. If it is not reachable, these are the best approximations.


Software use

You can change any tile's value with the mouse wheel, or with left or right click. After having chosen the target and tiles, just click on "Solve" to compute the solutions, or "Play" to try to solve the problem. The default rules used by Kitsune are :

  • A target between 100 and 999
  • 6 tiles chosen in the following set : 2 series of tiles from 1 to 10, and the four tiles 10, 25, 50, 75, 100.

If you want to train yourself, click on "Random" to generate a random choice of tiles and target. A bar indicates the remaining thinking time. Default round length is 50 seconds, but this parameter is adjustable in the "Options" menu.


Problems solutions

Kitsune displays first the solutions which use less tiles.

Kitsune does its best to display only a minimal set of different solutions : for example, we don't need to display both 6×100 and 100×6, so Kitsune will display one of these two solutions.


Statistics

You can find on our web site a lot of statistical results on the game, computed with Kitsune.

kitsune2.0/txt/aide-fr.html0000644000175000017500000001333510624071642015031 0ustar cyrilcyril Aide Présentation

Kitsune est un logiciel destiné à resoudre les problèmes de chiffres d'une célèbre émission de télévision. Il vous permet de résoudre un problème de votre choix, ou de vous entraîner avec des problèmes aléatoires. Etant donné un problème, Kitsune vous donne toutes les meilleures solutions : soit celles permettant d'obtenir le bon compte lorsque cela est possible, soit celles s'en approchant le plus lorsque l'on ne peut pas l'obtenir.


Fonctionnement

Vous pouvez régler la valeur du compte et des plaques avec la molette ou les clics gauche et droit de la souris. Cliquez ensuite sur "Résoudre" pour afficher les solutions, ou sur "Jouer" pour essayer de résoudre le problème vous-mème.

Vous pouvez également utiliser la touche "Aléatoire" pour que le compte et les plaques soient choisis au hasard, afin de vous entraîner. Dans ce mode, vous disposez de 50 secondes pour essayer de trouver le bon compte. Le délai est paramétrable en utilisant le menu "Options".

Que ce soit par la touche "Aléatoire" ou par ses propres réglages, le logiciel est paramétré pour que l'on ne puisse afficher que des comptes et des plaques conformes aux règles du jeu : le compte est compris entre 100 et 999, et les 6 plaques sont choisies parmi 2 séries de 10 plaques numérotées de 1 à 10, et 4 plaques numérotées 25, 50, 75, 100. Vous pouvez modifier dans le menu "Options" la plage de comptes autorisés et choisir un nombre de plaques entre 3 et 6.

La touche "Mise à zéro" permet d'enlever les solutions affichées, et de retourner sur la configuration de départ (1.2.3.4.5.6 - 550).


Affichage des solutions

Kitsune affiche d'abord les solutions utilisant le moins de plaques.

Kitsune s'efforce de vous donner le minimum de solutions : il est par exemple inutile de garder à la fois 6×100 et 100×6, et Kitsune n'affiche donc qu'une de ces deux solutions. Vous pouvez activer ou désactiver certaines simplifications dans le menu "Options" :
  • 2+2=2×2 : si cette option est activée, Kitsune utilisera le fait que 2+2=2×2 et n'affichera que les solutions pour lesquelles on a un calcul du type 2×2.
  • sous-calcul : si cette option est activée, Kitsune n'affichera pas les calculs dans lesquels un sous-calcul a même valeur. Par exemple, on n'aura pas de calcul du type 10−5 car 10−5=5.
  • factorisation : si cette option est activée, le programme n'affichera pas les calculs que l'on peut faire avec moins de plaques en factorisant. Par exemple 100×7+5×7 ne sera pas affiché, car 100×7+5×7=(100+5)×7.

Pour plus d'informations sur ces choix, vous pouvez consulter la page du site web sur les solutions équivalentes.


Module de résolution

Un clic sur "Jouer" ou sur "Aléatoire" active le module de résolution, qui vous permet de rentrer vos propres solutions. Vous disposez alors de seulement 50 secondes pour rsoudre le problème donné (délai paramétrable dans le menu "Options").
  • "Jouer" permet d'essayer de résoudre le problème que vous avez vous-mêmes choisi.
  • "Aléatoire" permet de s'entraîner sur un problème choisi au hasard.
Les plaques utilisables ont un fond blanc et celles deja utilisées un fond gris. En début de ligne de résolution, si vous cliquez sur une opération plutot que sur une plaque, le dernier résultat intermédiaire sera utilisé automatiquement.

Dans le cas d'un problème non soluble, vous devez atteindre la meilleure approximation pour gagner.

Sauvegarde des options

Dans le menu "Options", vous pouvez cocher la case "Sauvegarder les options" pour que Kitsune sauvegarde les choix d'options dans un fichier. Le fichier utilisé est .kitsune.options.[numéro de version], mais son emplacement varie suivant le système utilisé. Il est notamment sauvegardé dans le répertoire :
  • $HOME de l'utilisateur (sous Linux).
  • C:\Documents and Settings\Utilisateur\ (sous Windows).
Si vous décochez la case "Sauvegarder les options", le fichier est automatiquement effacé.

Divers

Si vous êtes curieux, vous trouverez sur le site web une collection de résultats statistiques obtenus à l'aide de ce programme.


kitsune2.0/txt/aide-ja.html0000644000175000017500000000444110624335024015007 0ustar cyrilcyril ヘルプ 概要

Kitsuneは、暗算ゲームのソフトウェアです。ヨーロッパの有名なクイズ番組があって、クイズの中で暗算の能力を問う数字コーナーは一つですが、Kitsuneは、その数字コーナーの問題に回答します。ユーザが選んだ問題を解いたり、乱数の問題を作ったりします。

使い方

マウスのホイールや右、左クリックで、カードの数字を調整できます。 数字を選んでから、「スタート」ボタンか「回答」ボタンを押します。

  • 「スタート」ボタンを押したら、選択した問題を50秒で解いてみましょう。
  • 「回答」ボタンを押したら、答えが出ます。
「乱数」ボタンを押せば、Kitsuneが作った問題に挑戦できます。50秒以内に、カードの組み合わせでターゲットを計算しなければなりません。ターゲットに届けない場合もありますが、そういう時、できるだけ近付かなければなりません。



オプションの保存

オプションのメニューで、「オプションを保存」を選択したら、オプションを保存します。使われているファイルは .kitsune.options.[バージョン番号]ですが、場所はシステムによって違います。特に、次のフォルダが使われています。
  • ユーザの $HOME フォルダ (Linux上).
  • C:\Documents and Settings\ユーザ\ (Windows上).
「オプションを保存」を解除すれば、オプションのファイルを削除します。

サイト

一番新しいバージョンと情報は、サイトに参考してください:http://kitsune.tuxfamily.org/



kitsune2.0/txt/gpl-en.html0000644000175000017500000004601610624071642014706 0ustar cyrilcyril GNU General Public License - GNU Project - Free Software Foundation (FSF)

GNU GENERAL PUBLIC LICENSE

Version 2, June 1991

Copyright (C) 1989, 1991 Free Software Foundation, Inc. 
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Preamble

The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.

To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.

Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.

Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.

The precise terms and conditions for copying, distribution and modification follow.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.

1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.

You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.

2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:

a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.

In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.

3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:

a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.

If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.

4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.

6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.

7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.

It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.

This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.

8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.

9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.

10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.

NO WARRANTY

11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.

one line to give the program's name and an idea of what it does.
Copyright (C) yyyy name of author
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this when it starts in an interactive mode:

Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'. This is free software, and you are welcome
to redistribute it under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:

Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written
by James Hacker.

signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice

This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.

kitsune2.0/txt/gpl-fr.html0000644000175000017500000005770510624071642014722 0ustar cyrilcyril GNU General Public License - GNU Project - Free Software Foundation (FSF)

GNU GENERAL PUBLIC LICENSE

( Obtenu sur http://fsffrance.org/gpl/gpl-fr.fr.html )

Ceci est une traduction non officielle de la GNU General Public License en franais. Elle n'a pas t publie par la Free Software Foundation, et ne dtermine pas les termes de distribution pour les logiciels qui utilisent la GNU GPL, seul le texte anglais original de la GNU GPL dtermine ces termes. Cependant, nous esprons que cette traduction aidera les francophones mieux comprendre la GNU GPL.

Licence Publique Gnrale GNU

Prambule

Les licences de la plupart des logiciels sont conues pour vous enlever toute libert de les partager et de les modifier.

A contrario, la Licence Publique Gnrale est destine garantir votre libert de partager et de modifier les logiciels libres, et assurer que ces logiciels soient libres pour tous leurs utilisateurs.

La prsente Licence Publique Gnrale s'applique la plupart des logiciels de la Free Software Foundation, ainsi qu' tout autre programme pour lequel ses auteurs s'engagent l'utiliser.

(Certains autres logiciels de la Free Software Foundation sont couverts par la GNU Lesser General Public License la place.)

Vous pouvez aussi l'appliquer aux programmes qui sont les vtres.

Quand nous parlons de logiciels libres, nous parlons de libert, non de prix.

Nos licences publiques gnrales sont conues pour vous donner l'assurance d'tre libres de distribuer des copies des logiciels libres (et de facturer ce service, si vous le souhaitez), de recevoir le code source ou de pouvoir l'obtenir si vous le souhaitez, de pouvoir modifier les logiciels ou en utiliser des lments dans de nouveaux programmes libres et de savoir que vous pouvez le faire.

Pour protger vos droits, il nous est ncessaire d'imposer des limitations qui interdisent quiconque de vous refuser ces droits ou de vous demander d'y renoncer.

Certaines responsabilits vous incombent en raison de ces limitations si vous distribuez des copies de ces logiciels, ou si vous les modifiez.

Par exemple, si vous distribuez des copies d'un tel programme, titre gratuit ou contre une rmunration, vous devez accorder aux destinataires tous les droits dont vous disposez.

Vous devez vous assurer qu'eux aussi reoivent ou puissent disposer du code source.

Et vous devez leur montrer les prsentes conditions afin qu'ils aient connaissance de leurs droits.

Nous protgeons vos droits en deux tapes : (1) nous sommes titulaires des droits d'auteur du logiciel, et (2) nous vous dlivrons cette licence, qui vous donne l'autorisation lgale de copier, distribuer et/ou modifier le logiciel.

En outre, pour la protection de chaque auteur ainsi que la ntre, nous voulons nous assurer que chacun comprenne que ce logiciel libre ne fait l'objet d'aucune garantie.

Si le logiciel est modifi par quelqu'un d'autre puis transmis des tiers, nous voulons que les destinataires soient mis au courant que ce qu'ils ont reu n'est pas le logiciel d'origine, de sorte que tout problme introduit par d'autres ne puisse entacher la rputation de l'auteur originel.

En dfinitive, un programme libre restera la merci des brevets de logiciels.

Nous souhaitons viter le risque que les redistributeurs d'un programme libre fassent des demandes individuelles de licence de brevet, ceci ayant pour effet de rendre le programme propritaire.

Pour viter cela, nous tablissons clairement que toute licence de brevet doit tre concde de faon ce que l'usage en soit libre pour tous ou bien qu'aucune licence ne soit concde.

Les termes exacts et les conditions de copie, distribution et modification sont les suivants:

Conditions de copie, distribution et modification de la Licence Publique Gnrale GNU.

0. La prsente Licence s'applique tout programme ou tout autre ouvrage contenant un avis, appos par le titulaire des droits d'auteur, stipulant qu'il peut tre distribu au titre des conditions de la prsente Licence Publique Gnrale.

Ci-aprs, le "Programme" dsigne l'un quelconque de ces programmes ou ouvrages, et un "ouvrage fond sur le Programme" dsigne soit le Programme, soit un ouvrage qui en drive au titre des lois sur le droit d'auteur : en d'autres termes, un ouvrage contenant le Programme ou une partie de ce dernier, soit l'identique, soit avec des modifications et/ou traduit dans un autre langage.

(Ci-aprs, le terme "modification" implique, sans s'y rduire, le terme traduction)

Chaque concessionaire sera dsign par "vous".

Les activits autres que la copie, la distribution et la modification ne sont pas couvertes par la prsente Licence ; elles sont hors de son champ d'application.

L'opration consistant excuter le Programme n'est soumise aucune limitation et les sorties du programme ne sont couvertes que si leur contenu constitue un ouvrage fond sur le Programme (indpendamment du fait qu'il ait t ralis par l'excution du Programme).

La validit de ce qui prcde dpend de ce que fait le Programme.

1. Vous pouvez copier et distribuer des copies l'identique du code source du Programme tel que vous l'avez reu, sur n'importe quel support, du moment que vous apposiez sur chaque copie, de manire ad hoc et parfaitement visible, l'avis de droit d'auteur adquat et une exonration de garantie ; que vous gardiez intacts tous les avis faisant rfrence la prsente Licence et l'absence de toute garantie ; et que vous fournissiez tout destinataire du Programme autre que vous-mme un exemplaire de la prsente Licence en mme temps que le Programme.

Vous pouvez faire payer l'acte physique de transmission d'une copie, et vous pouvez, votre discrtion, proposer une garantie contre rmunration.

2. Vous pouvez modifier votre copie ou des copies du Programme ou n'importe quelle partie de celui-ci, crant ainsi un ouvrage fond sur le Programme, et copier et distribuer de telles modifications ou ouvrage selon les termes de l'Article 1 ci-dessus, condition de vous conformer galement chacune des obligations suivantes :

a) Vous devez munir les fichiers modifis d'avis bien visibles stipulants que vous avez modifi ces fichiers, ainsi que la date de chaque modification ;

b) Vous devez prendre les dispositions ncessaires pour que tout ouvrage que vous distribuez ou publiez, et qui, en totalit ou en partie, contient ou est fond sur le Programme - ou une partie quelconque de ce dernier - soit concd comme un tout, titre gratuit, n'importe quel tiers, au titre des conditions de la prsente Licence.

c) Si le programme modifi lit habituellement des instructions de faon interactive lorsqu'on l'excute, vous devez, quand il commence son excution pour ladite utilisation interactive de la manire la plus usuelle, faire en sorte qu'il imprime ou affiche une annonce comprenant un avis de droit d'auteur ad hoc, et un avis stipulant qu'il n'y a pas de garantie (ou bien indiquant que c'est vous qui fournissez la garantie), et que les utilisateurs peuvent redistribuer le programme en respectant les prsentes obligations, et expliquant l'utilisateur comment voir une copie de la prsente Licence.

(Exception : si le Programme est lui-mme interactif mais n'imprime pas habituellement une telle annonce, votre ouvrage fond sur le Programme n'est pas oblig d'imprimer une annonce).

Ces obligations s'appliquent l'ouvrage modifi pris comme un tout.

Si des lments identifiables de cet ouvrage ne sont pas fonds sur le Programme et peuvent raisonnablement tre considrs comme des ouvrages indpendants distincts en eux mmes, alors la prsente Licence et ses conditions ne s'appliquent pas ces lments lorsque vous les distribuez en tant qu'ouvrages distincts.

Mais lorsque vous distribuez ces mmes lments comme partie d'un tout, lequel constitue un ouvrage fond sur le Programme, la distribution de ce tout doit tre soumise aux conditions de la prsente Licence, et les autorisations qu'elle octroie aux autres concessionnaires s'tendent l'ensemble de l'ouvrage et par consquent chaque et toute partie indiffrement de qui l'a crite.

Par consquent, l'objet du prsent article n'est pas de revendiquer des droits ou de contester vos droits sur un ouvrage entirement crit par vous; son objet est plutt d'exercer le droit de contrler la distribution d'ouvrages drivs ou d'ouvrages collectifs fonds sur le Programme.

De plus, la simple proximit du Programme avec un autre ouvrage qui n'est pas fond sur le Programme (ou un ouvrage fond sur le Programme) sur une partition d'un espace de stockage ou un support de distribution ne place pas cet autre ouvrage dans le champ d'application de la prsente Licence.

3. Vous pouvez copier et distribuer le Programme (ou un ouvrage fond sur lui, selon l'Article 2) sous forme de code objet ou d'excutable, selon les termes des Articles 1 et 2 ci-dessus, condition que vous accomplissiez l'un des points suivants :

a) L'accompagner de l'intgralit du code source correspondant, sous une forme lisible par un ordinateur, lequel doit tre distribu au titre des termes des Articles 1 et 2 ci-dessus, sur un support habituellement utilis pour l'change de logiciels; ou,

b) L'accompagner d'une proposition crite, valable pendant au moins trois ans, de fournir tout tiers, un tarif qui ne soit pas suprieur ce que vous cote l'acte physique de raliser une distribution source, une copie intgrale du code source correspondant sous une forme lisible par un ordinateur, qui sera distribue au titre des termes des Articles 1 et 2 ci-dessus, sur un support habituellement utilis pour l'change de logiciels; ou,

c) L'accompagner des informations reues par vous concernant la proposition de distribution du code source correspondant. (Cette solution n'est autorise que dans le cas d'une distribution non commerciale et seulement si vous avez reu le programme sous forme de code objet ou d'excutable accompagn d'une telle proposition - en conformit avec le sous-Article b ci-dessus.)

Le code source d'un ouvrage dsigne la forme favorite pour travailler des modifications de cet ouvrage. Pour un ouvrage excutable, le code source intgral dsigne la totalit du code source de la totalit des modules qu'il contient, ainsi que les ventuels fichiers de dfinition des interfaces qui y sont associs, ainsi que les scripts utiliss pour contrler la compilation et l'installation de l'excutable. Cependant, par exception spciale, le code source distribu n'est pas cens inclure quoi que ce soit de normalement distribu (que ce soit sous forme source ou binaire) avec les composants principaux (compilateur, noyau, et autre) du systme d'exploitation sur lequel l'excutable tourne, moins que ce composant lui-mme n'accompagne l'excutable.

Si distribuer un excutable ou un code objet consiste offrir un accs permettant leur copie depuis un endroit particulier, alors l'offre d'un accs quivalent pour copier le code source depuis le mme endroit compte comme une distribution du code source - mme si les tiers ne sont pas contraints de copier le source en mme temps que le code objet.

4. Vous ne pouvez copier, modifier, concder en sous-licence, ou distribuer le Programme, sauf tel qu'expressment prvu par la prsente Licence. Toute tentative de copier, modifier, concder en sous-licence, ou distribuer le Programme d'une autre manire est rpute non valable, et met immdiatement fin vos droits au titre de la prsente Licence. Toutefois, les tiers ayant reu de vous des copies, ou des droits, au titre de la prsente Licence ne verront pas leurs autorisations rsilies aussi longtemps que ledits tiers se conforment pleinement elle.

5. Vous n'tes pas oblig d'accepter la prsente Licence tant donn que vous ne l'avez pas signe. Cependant, rien d'autre ne vous accorde l'autorisation de modifier ou distribuer le Programme ou les ouvrages fonds sur lui. Ces actions sont interdites par la loi si vous n'acceptez pas la prsente Licence. En consquence, en modifiant ou distribuant le Programme (ou un ouvrage quelconque fond sur le Programme), vous signifiez votre acceptation de la prsente Licence en le faisant, et de toutes ses conditions concernant la copie, la distribution ou la modification du Programme ou d'ouvrages fonds sur lui.

6. Chaque fois que vous redistribuez le Programme (ou n'importe quel ouvrage fond sur le Programme), une licence est automatiquement concde au destinataire par le concdant originel de la licence, l'autorisant copier, distribuer ou modifier le Programme, sous rserve des prsentes conditions. Vous ne pouvez imposer une quelconque limitation supplmentaire l'exercice des droits octroys au titre des prsentes par le destinataire. Vous n'avez pas la responsabilit d'imposer le respect de la prsente Licence des tiers.

7. Si, consquement une dcision de justice ou l'allgation d'une transgression de brevet ou pour toute autre raison (non limite un probleme de brevet), des obligations vous sont imposes (que ce soit par jugement, conciliation ou autre) qui contredisent les conditions de la prsente Licence, elles ne vous excusent pas des conditions de la prsente Licence. Si vous ne pouvez distribuer de manire satisfaire simultanment vos obligations au titre de la prsente Licence et toute autre obligation pertinente, alors il en dcoule que vous ne pouvez pas du tout distribuer le Programme. Par exemple, si une licence de brevet ne permettait pas une redistribution sans redevance du Programme par tous ceux qui reoivent une copie directement ou indirectement par votre intermdiaire, alors la seule faon pour vous de satisfaire la fois la licence du brevet et la prsente Licence serait de vous abstenir totalement de toute distribution du Programme.

Si une partie quelconque de cet article est tenue pour nulle ou inopposable dans une circonstance particulire quelconque, l'intention est que le reste de l'article s'applique. La totalit de la section s'appliquera dans toutes les autres circonstances.

Cet article n'a pas pour but de vous induire transgresser un quelconque brevet ou d'autres revendications un droit de proprit ou contester la validit de la moindre de ces revendications ; cet article a pour seul objectif de protger l'intgrit du systme de distribution du logiciel libre, qui est mis en oeuvre par la pratique des licenses publiques. De nombreuses personnes ont fait de gnreuses contributions au large spectre de logiciels distribus par ce systme en se fiant l'application cohrente de ce systme ; il appartient chaque auteur/donateur de dcider si il ou elle veut distribuer du logiciel par l'intermdiaire d'un quelconque autre systme et un concessionaire ne peut imposer ce choix.

Cet article a pour but de rendre totalement limpide ce que l'on pense tre une consquence du reste de la prsente Licence.

8. Si la distribution et/ou l'utilisation du Programme est limite dans certains pays que ce soit par des brevets ou par des interfaces soumises au droit d'auteur, le titulaire originel des droits d'auteur qui dcide de couvrir le Programme par la prsente Licence peut ajouter une limitation gographique de distribution explicite qui exclue ces pays afin que la distribution soit permise seulement dans ou entre les pays qui ne sont pas ainsi exclus. Dans ce cas, la prsente Licence incorpore la limitation comme si elle tait crite dans le corps de la prsente Licence.

9. La Free Software Foundation peut, de temps autre, publier des versions rvises et/ou nouvelles de la Licence Publique Gnrale. De telles nouvelles versions seront similaires la prsente version dans l'esprit mais pourront diffrer dans le dtail pour prendre en compte de nouvelles problmatiques ou inquitudes.

Chaque version possde un numro de version la distinguant. Si le Programme prcise le numro de version de la prsente Licence qui s'y applique et "une version ultrieure quelconque", vous avez le choix de suivre les conditions de la prsente version ou de toute autre version ultrieure publie par la Free Software Foundation. Si le Programme ne spcifie aucun numro de version de la prsente Licence, vous pouvez choisir une version quelconque publie par la Free Software Foundation quelque moment que ce soit.

10. Si vous souhaitez incorporer des parties du Programme dans d'autres programmes libres dont les conditions de distribution sont diffrentes, crivez l'auteur pour lui en demander l'autorisation. Pour les logiciels dont la Free Software Foundation est titulaire des droits d'auteur, crivez la Free Software Foundation ; nous faisons parfois des exceptions dans ce sens. Notre dcision sera guide par le double objectif de prserver le statut libre de tous les drivs de nos logiciels libres et de promouvoir le partage et la rutilisation des logiciels en gnral.

ABSENCE DE GARANTIE

11. COMME LA LICENCE DU PROGRAMME EST CONCEDEE A TITRE GRATUIT, AUCUNE GARANTIE NE S'APPLIQUE AU PROGRAMME, DANS LES LIMITES AUTORISEES PAR LA LOI APPLICABLE. SAUF MENTION CONTRAIRE ECRITE, LES TITULAIRES DU DROIT D'AUTEUR ET/OU LES AUTRES PARTIES FOURNISSENT LE PROGRAMME "EN L'ETAT", SANS AUCUNE GARANTIE DE QUELQUE NATURE QUE CE SOIT, EXPRESSE OU IMPLICITE, Y COMPRIS, MAIS SANS Y ETRE LIMITE, LES GARANTIES IMPLICITES DE COMMERCIABILITE ET DE LA CONFORMITE A UNE UTILISATION PARTICULIERE. VOUS ASSUMEZ LA TOTALITE DES RISQUES LIES A LA QUALITE ET AUX PERFORMANCES DU PROGRAMME. SI LE PROGRAMME SE REVELAIT DEFECTUEUX, LE COUT DE L'ENTRETIEN, DES REPARATIONS OU DES CORRECTIONS NECESSAIRES VOUS INCOMBENT INTEGRALEMENT.

12. EN AUCUN CAS, SAUF LORSQUE LA LOI APPLICABLE OU UNE CONVENTION ECRITE L'EXIGE, UN TITULAIRE DE DROIT D'AUTEUR QUEL QU'IL SOIT, OU TOUTE PARTIE QUI POURRAIT MODIFIER ET/OU REDISTRIBUER LE PROGRAMME COMME PERMIS CI-DESSUS, NE POURRAIT ETRE TENU POUR RESPONSABLE A VOTRE EGARD DES DOMMAGES, INCLUANT LES DOMMAGES GENERIQUES, SPECIFIQUES, SECONDAIRES OU CONSECUTIFS, RESULTANT DE L'UTILISATION OU DE L'INCAPACITE D'UTILISER LE PROGRAMME (Y COMPRIS, MAIS SANS Y ETRE LIMITE, LA PERTE DE DONNEES, OU LE FAIT QUE DES DONNEES SOIENT RENDUES IMPRECISES, OU LES PERTES EPROUVEES PAR VOUS OU PAR DES TIERS, OU LE FAIT QUE LE PROGRAMME ECHOUE A INTEROPERER AVEC UN AUTRE PROGRAMME QUEL QU'IL SOIT) MEME SI LE DIT TITULAIRE DU DROIT D'AUTEUR OU LE PARTIE CONCERNEE A ETE AVERTI DE L'EVENTUALITE DE TELS DOMMAGES.

FIN DES CONDITIONS

Comment appliquer ces conditions vos nouveaux programmes

Si vous dveloppez un nouveau programme, et si vous voulez qu'il soit de la plus grande utilit possible pour le public, le meilleur moyen d'y parvenir est d'en faire un logiciel libre que chacun peut redistribuer et modifier au titre des prsentes conditions.

Pour ce faire, munissez le programme des avis qui suivent. Le plus sr est de les ajouter au dbut de chaque fichier source pour vhiculer le plus efficacement possible l'absence de toute garantie ; chaque fichier devrait aussi contenir au moins la ligne "copyright" et une indication de l'endroit o se trouve l'avis complet.

[Une ligne donnant le nom du programme et une courte ide de ce qu'il fait.] Copyright (C) [anne] [nom de l'auteur] Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier au titre des clauses de la Licence Publique Gnrale GNU, telle que publie par la Free Software Foundation ; soit la version 2 de la Licence, ou ( votre discrtion) une version ultrieure quelconque. Ce programme est distribu dans l'espoir qu'il sera utile, mais SANS AUCUNE GARANTIE ; sans mme une garantie implicite de COMMERCIABILITE ou DE CONFORMITE A UNE UTILISATION PARTICULIERE. Voir la Licence Publique Gnrale GNU pour plus de dtails. Vous devriez avoir reu un exemplaire de la Licence Publique Gnrale GNU avec ce programme ; si ce n'est pas le cas, crivez la Free Software Foundation Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Ajoutez aussi des informations sur la manire de vous contacter par courrier lectronique et courrier postal.

Si le programme est interactif, faites en sorte qu'il affiche un court avis tel que celui-ci lorsqu'il dmarre en mode interactif :

Gnomovision version 69, Copyright (C) anne nom de l'auteur Gnomovision n'est accompagn d'ABSOLUMENT AUCUNE GARANTIE ; pour plus de dtails tapez "show w". Ceci est un logiciel libre et vous tes invit le redistribuer en respectant certaines obligations ; pour plus de dtails tapez "show c".

Les instructions hypothtiques "show w" et "show c" sont supposes montrer les parties ad hoc de la Licence Publique Gnrale. Bien entendu, les instructions que vous utilisez peuvent porter d'autres noms que "show w" et "show c" ; elles peuvent mme tre des clics de souris ou des lments d'un menu ou tout ce qui convient votre programme.

Vous devriez aussi obtenir de votre employeur (si vous travaillez en tant que dveloppeur) ou de votre cole, si c'est le cas, qu'il (ou elle) signe une "renonciation aux droits d'auteur" concernant le programme, si ncessaire. Voici un exemple (changez les noms) :

Yoyodyne, Inc., dclare par la prsente renoncer toute prtention sur les droits d'auteur du programme "Gnomovision" (qui fait des avances aux compilateurs) crit par James Hacker. [signature de Ty Coon], 1er avril 1989 Ty Coon, Prsident du Vice

La prsente Licence Publique Gnrale n'autorise pas l'incorporation de votre programme dans des programmes propritaires. Si votre programme est une bibliothque de sous-programmes, vous pouvez considrer plus utile d'autoriser l'dition de liens d'applications propritaires avec la bibliothque. Si c'est ce que vous voulez faire, utilisez la GNU Lesser General Public License au lieu de la prsente Licence.

kitsune2.0/txt/gpl-ja.html0000644000175000017500000007650710624071642014706 0ustar cyrilcyril GNU General Public License - GNU Project - Free Software Foundation (FSF)

次の翻訳は、http://www.opensource.jp/gpl/gpl.ja.html.euc-jpからのコピーです。

GNU 一般公衆利用許諾契約書

バージョン 2、1991年6月
日本語訳、2002年8月28日

Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA この利用許諾契約書を、一字一句そのままに複製し頒布することは許可する。 しかし変更は認めない。

This is an unofficial translation of the GNU General Public License into Japanese. It was not published by the Free Software Foundation, and does not legally state the distribution terms for software that uses the GNU GPL--only the original English text of the GNU GPL does that. However, we hope that this translation will help Japanese speakers understand the GNU GPL better.
(訳: 以下はGNU General Public Licenseの非公式な日本語訳です。これはフ リーソフトウェア財団(the Free Software Foundation)によって発表されたも のではなく、GNU GPLを適用したソフトウェアの頒布条件を法的に有効な形で 述べたものではありません。頒布条件としてはGNU GPLの英語版テキストで指 定されているもののみが有効です。しかしながら、私たちはこの翻訳が、日本 語を使用する人々にとってGNU GPLをより良く理解する助けとなることを望ん でいます。)
翻訳は 八田真行<mhatta@gnu.org>が行った。原文はhttp://www.gnu.org/licenses/gpl.html である。誤訳の指摘や改善案を歓迎する。

はじめに

ソフトウェア向けライセンスの大半は、あなたがそのソフトウェアを共有した り変更したりする自由を奪うように設計されています。対照的に、GNU 一般公 衆利用許諾契約書は、あなたがフリーソフトウェアを共有したり変更したりす る自由を保証する--すなわち、ソフトウェアがそのユーザすべてにとってフリー であることを保証することを目的としています。この一般公衆利用許諾契約書 はフリーソフトウェア財団のソフトウェアのほとんどに適用されており、また GNU GPLを適用すると決めたフリーソフトウェア財団以外の作者によるプログ ラムにも適用されています(いくつかのフリーソフトウェア財団のソフトウェ アには、GNU GPLではなくGNU ライブラリ一般公衆利用許諾契約書が適用され ています)。あなたもまた、ご自分のプログラムにGNU GPLを適用することが可 能です。

私たちがフリーソフトウェアと言うとき、それは利用の自由について言及して いるのであって、価格は問題にしていません。私たちの一般公衆利用許諾契約 書は、あなたがフリーソフトウェアの複製物を頒布する自由を保証するよう設 計されています(希望に応じてその種のサービスに手数料を課す自由も保証さ れます)。また、あなたがソースコードを受け取るか、あるいは望めばそれを 入手することが可能であるということ、あなたがソフトウェアを変更し、その 一部を新たなフリーのプログラムで利用できるということ、そして、以上で述 べたようなことができるということがあなたに知らされるということも保証さ れます。

あなたの権利を守るため、私たちは誰かがあなたの有するこれらの権利を否定 することや、これらの権利を放棄するよう要求することを禁止するという制限 を加える必要があります。よって、あなたがソフトウェアの複製物を頒布した りそれを変更したりする場合には、そういった制限のためにあなたにある種の 責任が発生することになります。

例えば、あなたがフリーなプログラムの複製物を頒布する場合、有料か無料に 関わらず、あなたは自分が有する権利を全て受領者に与えなければなりません。 また、あなたは彼らもソースコードを受け取るか手に入れることができるよう 保証しなければなりません。そして、あなたは彼らに対して以下で述べる条件 を示し、彼らに自らの持つ権利について知らしめるようにしなければなりませ ん。

私たちはあなたの権利を二段階の手順を踏んで保護します。(1) まずソフトウェ アに対して著作権を主張し、そして (2) あなたに対して、ソフトウェアの複 製や頒布または改変についての法的な許可を与えるこの契約書を提示します。

また、各作者や私たちを保護するため、私たちはこのフリーソフトウェアには 何の保証も無いということを誰もが確実に理解するようにし、またソフトウェ アが誰か他人によって改変され、それが次々と頒布されていったとしても、そ の受領者は彼らが手に入れたソフトウェアがオリジナルのバージョンでは無い こと、そして原作者の名声は他人によって持ち込まれた可能性のある問題によっ て影響されることがないということを周知させたいと思います。

最後に、ソフトウェア特許がいかなるフリーのプログラムの存在にも不断の脅 威を投げかけていますが、私たちは、フリーなプログラムの再頒布者が個々に 特許ライセンスを取得することによって、事実上プログラムを独占的にしてし まうという危険を避けたいと思います。こういった事態を予防するため、私た ちはいかなる特許も誰もが自由に利用できるようライセンスされるか、全くラ イセンスされないかのどちらかでなければならないことを明確にしました。

(訳注: 本契約書で「独占的(proprietary)」とは、ソフトウェアの利用や再頒 布、改変が禁止されているか、許可を得ることが必要とされているか、あるい は厳しい制限が課せられていて自由にそうすることが事実上できなくなってい る状態のことを指す。詳しくはhttp://www.gnu.org/philosophy/categories.ja.html#ProprietarySoftware を参照せよ。)

複製や頒布、改変についての正確な条件と制約を以下で述べていきます。

複製、頒布、改変に関する条件と制約

0. この利用許諾契約書は、そのプログラム(またはその他の著作物)をこの一般公 衆利用許諾契約書の定める条件の下で頒布できる、という告知が著作権者によっ て記載されたプログラムまたはその他の著作物全般に適用される。以下では、 「『プログラム』」とはそのようにしてこの契約書が適用されたプログラムや 著作物全般を意味し、また「『プログラム』を基にした著作物」とは『プログ ラム』やその他著作権法の下で派生物と見なされるもの全般を指す。すなわち、 『プログラム』かその一部を、全く同一のままか、改変を加えたか、あるいは 他の言語に翻訳された形で含む著作物のことである(「改変」という語の本来 の意味からはずれるが、以下では翻訳も改変の一種と見なす)。それぞれの契 約者は「あなた」と表現される。

複製や頒布、改変以外の活動はこの契約書ではカバーされない。それらはこの 契約書の対象外である。『プログラム』を実行する行為自体に制限はない。ま た、そのような『プログラム』の出力結果は、その内容が『プログラム』を基 にした著作物を構成する場合のみこの契約書によって保護される(『プログラ ム』を実行したことによって作成されたということとは無関係である)。この ような線引きの妥当性は、『プログラム』が何をするのかに依存する。

1. それぞれの複製物において適切な著作権表示と保証の否認声明(disclaimer of warranty)を目立つよう適切に掲載し、またこの契約書および一切の保証の不 在に触れた告知すべてをそのまま残し、そしてこの契約書の複製物を『プログ ラム』のいかなる受領者にも『プログラム』と共に頒布する限り、あなたは 『プログラム』のソースコードの複製物を、あなたが受け取った通りの形で複 製または頒布することができる。媒体は問わない。

あなたは、物理的に複製物を譲渡するという行為に関して手数料を課しても良 いし、希望によっては手数料を取って交換における保護の保証を提供しても良 い。

2. あなたは自分の『プログラム』の複製物かその一部を改変して『プログラム』 を基にした著作物を形成し、そのような改変点や著作物を上記第1節の定める 条件の下で複製または頒布することができる。ただし、そのためには以下の条 件すべてを満たしていなければならない:

  • a) あなたがそれらのファイルを変更したということと変更した日時が良く 分かるよう、改変されたファイルに告示しなければならない。

  • b) 『プログラム』またはその一部を含む著作物、あるいは『プログラム』 かその一部から派生した著作物を頒布あるいは発表する場合には、その 全体をこの契約書の条件に従って第三者へ無償で利用許諾しなけれ ばならない。

  • c) 改変されたプログラムが、通常実行する際に対話的にコマンドを読むよ うになっているならば、そのプログラムを最も一般的な方法で対話的に 実行する際、適切な著作権表示、無保証であること(あるいはあなたが保 証を提供するということ)、ユーザがプログラムをこの契約書で述べた条 件の下で頒布することができるということ、そしてこの契約書の複製物 を閲覧するにはどうしたらよいかというユーザへの説明を含む告知が印 刷されるか、あるいは画面に表示されるようにしなければならない(例外 として、『プログラム』そのものは対話的であっても通常そのような告 知を印刷しない場合には、『プログラム』を基にしたあなたの著作物に そのような告知を印刷させる必要はない)。
以上の必要条件は全体としての改変された著作物に適用される。著作物の一部 が『プログラム』から派生したものではないと確認でき、それら自身別の独立 した著作物であると合理的に考えられるならば、あなたがそれらを別の著作物 として分けて頒布する場合、そういった部分にはこの契約書とその条件は適用 されない。しかし、あなたが同じ部分を『プログラム』を基にした著作物全体 の一部として頒布するならば、全体としての頒布物は、この契約書が課す条件 に従わなければならない。というのは、この契約書が他の契約者に与える許可 は『プログラム』丸ごと全体に及び、誰が書いたかは関係なく各部分のすべて を保護するからである。

よって、すべてあなたによって書かれた著作物に対し、権利を主張したりあな たの権利に異議を申し立てることはこの節の意図するところではない。むしろ、 その趣旨は『プログラム』を基にした派生物ないし集合著作物の頒布を管理す る権利を行使するということにある。

また、『プログラム』を基にしていないその他の著作物を『プログラム』(あ るいは『プログラム』を基にした著作物)と一緒に集めただけのものを一巻の 保管装置ないし頒布媒体に収めても、その他の著作物までこの契約書が保護す る対象になるということにはならない。

3. あなたは上記第1節および2節の条件に従い、『プログラム』(あるいは第2節に おける派生物)をオブジェクトコードないし実行形式で複製または頒布するこ とができる。ただし、その場合あなたは以下のうちどれか一つを実施しなけれ ばならない:

  • a) 著作物に、『プログラム』に対応した完全かつ機械で読み取り可能なソー スコードを添付する。ただし、ソースコードは上記第1節および2節の条 件に従いソフトウェアの交換で習慣的に使われる媒体で頒布しなければ ならない。あるいは、

  • b) 著作物に、いかなる第三者に対しても、『プログラム』に対応した完全 かつ機械で読み取り可能なソースコードを、頒布に要する物理的コスト を上回らない程度の手数料と引き換えに提供する旨述べた少なくとも3年 間は有効な書面になった申し出を添える。ただし、ソースコードは上記 第1節および2節の条件に従いソフトウェアの交換で習慣的に使われる媒 体で頒布しなければならない。あるいは、

  • c) 対応するソースコード頒布の申し出に際して、あなたが得た情報を一緒 に引き渡す(この選択肢は、営利を目的としない頒布であって、かつあな たが上記小節bで指定されているような申し出と共にオブジェクトコード あるいは実行形式のプログラムしか入手していない場合に限り許可され る)。
著作物のソースコードとは、それに対して改変を加える上で好ましいとされる 著作物の形式を意味する。ある実行形式の著作物にとって完全なソースコード とは、それが含むモジュールすべてのソースコード全部に加え、関連するイン ターフェース定義ファイルのすべてとライブラリのコンパイルやインストール を制御するために使われるスクリプトをも加えたものを意味する。しかし特別 な例外として、そのコンポーネント自体が実行形式に付随するのでは無い限り、 頒布されるものの中に、実行形式が実行されるオペレーティングシステムの主 要なコンポーネント(コンパイラやカーネル等)と通常一緒に(ソースかバイナ リ形式のどちらかで)頒布されるものを含んでいる必要はないとする。

実行形式またはオブジェクトコードの頒布が、指定された場所からコピーする ためのアクセス手段を提供することで為されるとして、その上でソースコード も同等のアクセス手段によって同じ場所からコピーできるようになっているな らば、第三者がオブジェクトコードと一緒にソースも強制的にコピーさせられ るようになっていなくてもソースコード頒布の条件を満たしているものとする。

4. あなたは『プログラム』を、この契約書において明確に提示された行為を除き 複製や改変、サブライセンス、あるいは頒布してはならない。他に『プログラ ム』を複製や改変、サブライセンス、あるいは頒布する企てはすべて無効であ り、この契約書の下でのあなたの権利を自動的に終結させることになろう。し かし、複製物や権利をこの契約書に従ってあなたから得た人々に関しては、そ のような人々がこの契約書に完全に従っている限り彼らのライセンスまで終結 することはない。

5. あなたはこの契約書を受諾する必要は無い。というのは、あなたはこれに署名 していないからである。しかし、この契約書以外にあなたに対して『プログラ ム』やその派生物を改変または頒布する許可を与えるものは存在しない。これ らの行為は、あなたがこの契約書を受け入れない限り法によって禁じられてい る。そこで、『プログラム』(あるいは『プログラム』を基にした著作物全般) を改変ないし頒布することにより、あなたは自分がそのような行為を行うため にこの契約書を受諾したということ、そして『プログラム』とそれに基づく著 作物の複製や頒布、改変についてこの契約書が課す制約と条件をすべて受け入 れたということを示したものと見なす。

6. あなたが『プログラム』(または『プログラム』を基にした著作物全般)を再頒 布するたびに、その受領者は元々のライセンス許可者から、この契約書で指定 された条件と制約の下で『プログラム』を複製や頒布、あるいは改変する許可 を自動的に得るものとする。あなたは、受領者がここで認められた権利を行使 することに関してこれ以上他のいかなる制限も課してはならない。あなたには、 第三者がこの契約書に従うことを強制する責任はない。

7. 特許侵害あるいはその他の理由(特許関係に限らない)から、裁判所の判決ある いは申し立ての結果としてあなたに(裁判所命令や契約などにより)このライセ ンスの条件と矛盾する制約が課された場合でも、あなたがこの契約書の条 件を免除されるわけではない。もしこの契約書の下であなたに課せられた 責任と他の関連する責任を同時に満たすような形で頒布できないならば、結果 としてあなたは『プログラム』を頒布することが全くできないということであ る。例えば特許ライセンスが、あなたから直接間接を問わずコピーを受け取っ た人が誰でも『プログラム』を使用料無料で再頒布することを認めていない場 合、あなたがその制約とこの契約書を両方とも満たすには『プログラム』 の頒布を完全に中止するしかないだろう。

この節の一部分が特定の状況の下で無効ないし実施不可能な場合でも、節の残 りの部分は適用されるよう意図されている。その他の状況では節が全体として 適用されるよう意図されている。

特許やその他の財産権を侵害したり、そのような権利の主張の効力に異議を唱 えたりするようあなたを誘惑することがこの節の目的ではない。この節には、 人々によってライセンス慣行として実現されてきた、フリーソフトウェア頒布 のシステムの完全性を護るという目的しかない。多くの人々が、フリーソフト ウェアの頒布システムが首尾一貫して適用されているという信頼に基づき、こ のシステムを通じて頒布される多様なソフトウェアに寛大な貢献をしてきたの は事実であるが、人がどのようなシステムを通じてソフトウェアを頒布したい と思うかはあくまでも作者/寄与者次第であり、あなたが選択を押しつけるこ とはできない。

この節は、この契約書のこの節以外の部分の一帰結になると考えられるケー スを徹底的に明らかにすることを目的としている。

8. 『プログラム』の頒布や利用が、ある国においては特許または著作権が主張さ れたインターフェースのいずれかによって制限されている場合、『プログラム』 にこの契約書を適用した元の著作権者は、そういった国々を排除した明確 な地理的頒布制限を加え、そこで排除されていない国の中やそれらの国々の間 でのみ頒布が許可されるようにしても構わない。その場合、そのような制限は この契約書本文で書かれているのと同様に見なされる。

9. フリーソフトウェア財団は、時によって改訂または新版の一般公衆利用許諾書 を発表することができる。そのような新版は現在のバージョンとその精神にお いては似たものになるだろうが、新たな問題や懸念を解決するため細部では異 なる可能性がある。

それぞれのバージョンには、見分けが付くようにバージョン番号が振られてい る。『プログラム』においてそれに適用されるこの契約書のバージョン番号が 指定されていて、更に「それ以降のいかなるバージョン(any later version)」 も適用して良いとなっていた場合、あなたは従う条件と制約として、指定のバー ジョンか、フリーソフトウェア財団によって発行された指定のバージョン以降 の版のどれか一つのどちらかを選ぶことが出来る。『プログラム』でライセン スのバージョン番号が指定されていないならば、あなたは今までにフリーソフ トウェア財団から発行されたバージョンの中から好きに選んで構わない。

10. もしあなたが『プログラム』の一部を、その頒布条件がこの契約書と異なる他 のフリーなプログラムと統合したいならば、作者に連絡して許可を求めよ。フ リーソフトウェア財団が著作権を保有するソフトウェアについては、フリーソ フトウェア財団に連絡せよ。私たちは、このような場合のために特別な例外を 設けることもある。私たちが決定を下すにあたっては、私たちのフリーソフト ウェアの派生物すべてがフリーな状態に保たれるということと、一般的にソフ トウェアの共有と再利用を促進するという二つの目標を規準に検討されるであ ろう。

無保証について

11. 『プログラム』は代価無しに利用が許可されるので、適切な法が認める限りに おいて、『プログラム』に関するいかなる保証も存在しない。書面で別に述べ る場合を除いて、著作権者、またはその他の団体は、『プログラム』を、表明 されたか言外にかは問わず、商業的適性を保証するほのめかしやある特定の目 的への適合性(に限られない)を含む一切の保証無しに「あるがまま」で提供す る。『プログラム』の質と性能に関するリスクのすべてはあなたに帰属する。 『プログラム』に欠陥があると判明した場合、あなたは必要な保守点検や補修、 修正に要するコストのすべてを引き受けることになる。

12. 適切な法か書面での同意によって命ぜられない限り、著作権者、または上記で 許可されている通りに『プログラム』を改変または再頒布したその他の団体は、 あなたに対して『プログラム』の利用ないし利用不能で生じた通常損害や特別 損害、偶発損害、間接損害(データの消失や不正確な処理、あなたか第三者が 被った損失、あるいは『プログラム』が他のソフトウェアと一緒に動作しない という不具合などを含むがそれらに限らない)に一切の責任を負わない。その ような損害が生ずる可能性について彼らが忠告されていたとしても同様である。

条件と制約終わり

以上の条項をあなたの新しいプログラムに適用する方法

あなたが新しいプログラムを開発したとして、公衆によってそれが利用される 可能性を最大にしたいなら、そのプログラムをこの契約書の条項に従って 誰でも再頒布あるいは変更できるようフリーソフトウェアにするのが最善です。

そのためには、プログラムに以下のような表示を添付してください。その場合、 保証が排除されているということを最も効果的に伝えるために、それぞれのソー スファイルの冒頭に表示を添付すれば最も安全です。少なくとも、「著作権表 示」という行と全文がある場所へのポインタだけは各ファイルに含めて置いて ください。

one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

(訳:
プログラムの名前と、それが何をするかについての簡単な説明。
Copyright (C) 西暦年  作者の名前

このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェ
ア財団によって発行された GNU 一般公衆利用許諾契約書(バージョン2か、希
望によってはそれ以降のバージョンのうちどれか)の定める条件の下で再頒布
または改変することができます。

このプログラムは有用であることを願って頒布されますが、*全くの無保証* 
です。商業可能性の保証や特定の目的への適合性は、言外に示されたものも含
め全く存在しません。詳しくはGNU 一般公衆利用許諾契約書をご覧ください。
 
あなたはこのプログラムと共に、GNU 一般公衆利用許諾契約書の複製物を一部
受け取ったはずです。もし受け取っていなければ、フリーソフトウェア財団ま
で請求してください(宛先は the Free Software Foundation, Inc., 59
Temple Place, Suite 330, Boston, MA 02111-1307 USA)。
)

電子ないし紙のメールであなたに問い合わせる方法についての情報も書き加え ましょう。

プログラムが対話的なものならば、対話モードで起動した際に出力として以下 のような短い告知が表示されるようにしてください:

Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.

(訳:

Gnomovision バージョン 69, Copyright (C) 西暦年 作者の名前 Gnomovision は*全くの無保証*で提供されます。詳しくは「show w」とタイプし て下さい。 これはフリーソフトウェアであり、ある条件の下で再頒布することが奨励されて います。詳しくは「show c」とタイプして下さい。

)

ここで、仮想的なコマンド「show w」「show c」 は一般公衆利用許諾契約書の適切な部分を表示するようになっていな ければなりません。もちろん、あなたが使うコマンドを「show w」 「show c」と呼ぶ必然性はありませんので、あなたの プログラムに合わせてマウスのクリックやメニューのアイテムにしても結構で す。

また、あなたは、必要ならば(プログラマーとして働いていたら)あなたの雇用 主、あるいは場合によっては学校から、そのプログラムに関する「著作権放棄 声明(copyright disclaimer)」に署名してもらうべきです。以下は例ですので、 名前を変えてください:

Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice

(訳:

Yoyodyne社はここに、James Hackerによって書かれたプログラム「Gnomovision」 (コンパイラへ通すプログラム)に関する一切の著作権の利益を放棄します。 Ty Coon氏の署名、1989年4月1日 Ty Coon、副社長

)

この一般公衆利用許諾契約書では、あなたのプログラムを独占的なプログラム に統合することを認めていません。あなたのプログラムがサブルーチンライブ ラリならば、独占的なアプリケーションとあなたのライブラリをリンクするこ とを許可したほうがより便利であると考えるかもしれません。もしこれがあな たの望むことならば、この契約書の代わりにGNU ライブラリ一般公衆利用許諾 契約書を適用してください。

kitsune2.0/txt/licence-en.html0000644000175000017500000000266010624071642015523 0ustar cyrilcyril Aide

Kitsune is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Copyright (C) 2006-2007 Julien Lemoine, Simon Viennot.


Kitsune is a software aiming at solving digit problems of a famous television game show. It enables you to solve a problem of your choice, or to train yourself with random problems. Source code is made available on the web site.

Email : lapinot@tuxfamily.org

kitsune2.0/txt/licence-fr.html0000644000175000017500000000300310624071642015520 0ustar cyrilcyril Aide

Kitsune est distribu sous licence GPL v.2.

Ceci signifie que ce programme est un logiciel libre : vous pouvez le redistribuer et/ou le modifier au titre des clauses de la Licence Publique Gnrale GNU, telle que publie par la Free Software Foundation ; soit la version 2 de la Licence, ou ( votre discrtion) une version ultrieure quelconque. Ce programme est distribu dans l'espoir qu'il sera utile, mais SANS AUCUNE GARANTIE ; sans mme une garantie implicite de COMMERCIABILITE ou DE CONFORMITE A UNE UTILISATION PARTICULIERE. Voir la Licence Publique Gnrale GNU pour plus de dtails. Vous devriez avoir reu un exemplaire de la Licence Publique Gnrale GNU avec ce programme ; si ce n'est pas le cas, crivez la Free Software Foundation Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Copyright (C) 2006-2007 par Julien Lemoine et Simon Viennot.


Kitsune est un logiciel qui permet de rsoudre des problmes de calcul du type d'une clbre mission de tlvision franaise. Le code source est disponible sur le site.

Contact : lapinot@tuxfamily.org

kitsune2.0/txt/licence-ja.html0000644000175000017500000000353410624335024015511 0ustar cyrilcyril Aide

Kitsuneは、GPL v.2のライセンスで公開されている。

このプログラムはフリーソフトウェアです。あなたはこれを、フリーソフトウェア財団によって発行された GNU 一般公衆利用許諾契約書(バージョン2か、希望によってはそれ以降のバージョンのうちどれか)の定める条件の下で再頒布または改変することができます。

このプログラムは有用であることを願って頒布されますが、*全くの無保証* です。商業可能性の保証や特定の目的への適合性は、言外に示されたものも含め全く存在しません。詳しくはGNU 一般公衆利用許諾契約書をご覧ください。

あなたはこのプログラムと共に、GNU 一般公衆利用許諾契約書の複製物を一部受け取ったはずです。もし受け取っていなければ、フリーソフトウェア財団まで請求してください(宛先は the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA)。

Copyright (C) 2006 par Julien Lemoine et Simon Viennot.


Kitsuneは、有名なクイズ番組の問題に回答するフリーソフトウェアです。選ばれた問題を解いたり、乱数の問題を作ったりします。ソースコードはサイトでダウンロードできます。

メール: lapinot@tuxfamily.org