📄 maincanvas.java
字号:
words[ 14]="they"; words[ 15]="from"; words[ 16]="how"; words[ 17]="have"; words[ 18]="change"; words[ 19]="the"; words[ 20]="inn"; words[ 21]="which"; words[ 22]="people"; words[ 23]="smoke"; words[ 24]="week"; words[ 25]="them"; words[ 26]="appear"; words[ 27]="first"; words[ 28]="free"; words[ 29]="news"; words[ 30]="that"; words[ 31]="send"; words[ 32]="out"; words[ 33]="by"; words[ 34]="email"; words[ 35]="every"; words[ 36]="mouse"; words[ 37]="to"; words[ 38]="water"; words[ 39]="world"; words[ 40]="get"; words[ 41]="repeat"; words[ 42]="select"; words[ 43]="mail"; words[ 44]="list"; words[ 45]="link"; words[ 46]="on"; words[ 47]="any"; words[ 48]="page"; words[ 49]="also"; words[ 50]="has"; words[ 51]="link"; words[ 52]="issue"; words[ 53]="cat"; words[ 54]="if"; words[ 55]="dog"; words[ 56]="sub"; words[ 57]="you"; words[ 58]="use"; words[ 59]="same"; words[ 60]="update"; words[ 61]="or"; words[ 62]="send"; words[ 63]="strict"; words[ 64]="pray"; words[ 65]="policy"; words[ 66]="chose"; words[ 67]="supply"; words[ 68]="jewel"; words[ 69]="gotten"; words[ 70]="rather"; words[ 71]="large"; words[ 72]="denied"; words[ 73]="into"; words[ 74]="six"; words[ 75]="solar"; words[ 76]="each"; words[ 77]="with"; words[ 78]="its"; words[ 79]="own"; words[ 80]="theme"; words[ 81]="index"; words[ 82]="see"; words[ 83]="sector"; words[ 84]="left"; words[ 85]="hand"; words[ 86]="cobb"; words[ 87]="column"; words[ 88]="seven"; words[ 89]="lost"; words[ 90]="moon"; words[ 91]="pond"; words[ 92]="may"; words[ 93]="also"; words[ 94]="see"; words[ 95]="find"; words[ 96]="desk"; words[ 97]="apple"; words[ 98]="seat"; words[ 99]="chair"; words[ 100]="cup"; words[ 101]="paper"; words[ 102]="map"; words[ 103]="truck"; words[ 104]="trunk"; words[ 105]="left"; words[ 106]="right"; words[ 107]="over"; words[ 108]="under"; words[ 109]="close"; words[ 110]="paint"; words[ 111]="draw"; words[112]="muscle"; words[113]="camel"; words[114]="taste"; words[115]="toast"; words[116]="health"; words[117]="coffee"; words[118]="java"; words[119]="france"; words[120]="spain"; words[121]="africa"; words[121]="europe"; words[122]="asia"; words[123]="japan"; words[124]="italy"; words[125]="china"; words[126]="russia"; words[127]="web"; words[128]="gnat"; words[129]="bee"; words[130]="flea"; words[131]="beetle"; words[132]="spider"; words[133]="fly"; words[134]="cicada"; words[135]="porshe"; words[136]="chevy"; words[137]="dodge"; words[138]="ford"; words[139]="india"; words[140]="kia"; words[141]="lexus"; words[142]="impala"; words[143]="charge"; words[144]="king"; words[145]="queen"; words[146]="lord"; words[147]="knight"; words[148]="horse"; words[149]="bishop"; words[150]="castle"; words[151]="serf"; words[152]="peanut"; words[153]="job"; words[154]="boar"; words[155]="clock"; words[156]="earth"; words[157]="mars"; words[158]="saturn"; words[159]="venus"; words[160]="uranus"; words[161]="pluto"; words[162]="ring"; words[163]="lark"; words[164]="quail"; words[165]="bird"; words[166]="jay"; words[167]="robin"; words[168]="meadow"; words[169]="dove"; words[170]="finch"; words[171]="wren"; words[172]="flute"; words[173]="bass"; words[174]="horn"; words[175]="oboe"; words[176]="tuba"; words[177]="pipe"; words[178]="piano"; words[179]="bone"; }private final void loadImages () {int p=0;Graphics letsG; try { if (res==0) { lets=Image.createImage ("/icons/LRfont.png"); letsBlue=Image.createImage ("/icons/LRfontBlue.png"); splash=Image.createImage ("/icons/LRSplash.png"); } if (res==1) { lets=Image.createImage ("/icons/MRfont.png"); letsBlue=Image.createImage ("/icons/MRfontBlue.png"); splash=Image.createImage ("/icons/MRSplash.png"); }if (res==2) { lets=Image.createImage ("/icons/HRfont.png"); letsBlue=Image.createImage ("/icons/HRfontBlue.png"); splash=Image.createImage ("/icons/HRSplash.png"); }if (res==3) { lets=Image.createImage ("/icons/240font.png"); letsBlue=Image.createImage ("/icons/240Blue.png"); splash=Image.createImage ("/icons/240Splash.png");}for (p=0;p<26;p++) {letsAlpha[p]=Image.createImage (letWidth,letHeight);letsG=letsAlpha[p].getGraphics ();letsG.drawImage (lets,0-(letWidth*p),0,0);letsAlphaBlue[p]=Image.createImage (letWidth,letHeight);letsG=letsAlphaBlue[p].getGraphics ();letsG.drawImage (letsBlue,0-(p*letWidth),0,0);}myImagesLoaded=true; } catch (Exception e) {System.out.println ("Error loading images: "+e);} }private final void setBoard () { int index; String letter; String word; int gg; int directionAddition; boolean foundPlace; // Class c = this.getClass(); int p,t,h,i; for (p=0;p<150;p++) boardLetSel[p]=false; lettersSel=0; int wordsToRead[] = new int [14]; for (p=0;p<10;p++) { wordsToRead[p]=getRandomInt (178); for (t=0;t<p;t++) if (wordsToRead[t]==wordsToRead[p]) p-=1; } for (p=0;p<10;p++) { wordsRead[p]=words[wordsToRead[p]]; for (t=0;t<words[wordsToRead[p]].length();t++) Cwords [p] [t] = words[wordsToRead[p]].charAt(t); lettersPerWord[p]=words[wordsToRead[p]].length(); } // p boolean killer=false; do { killer=false; for (p=0;p<150;p++) board[p]= ( (char) (getRandomInt(25)+97)); // set color of chars // put words to board /////////////////////////////////////////////// directionAddition=0; // find place to put words for (p=0;p<10;p++) { int k=0; foundPlace=false; while (foundPlace==false) { wordDirection[p]=getRandomInt (7); if (wordDirection[p]==2) wordDirection[p]=3; wordPlace[p] = getRandomInt (130); if (wordDirection[p]==0 && (int) (wordPlace[p]/13)-lettersPerWord[p]>=0) foundPlace=true; //up if (wordDirection[p]==1 && (int) (wordPlace[p]/13)+lettersPerWord[p]<=11) foundPlace=true; //down if (wordDirection[p]==2 && wordPlace[p]%13-lettersPerWord[p]>=0) foundPlace=true; // left if (wordDirection[p]==3 && wordPlace[p]%13+lettersPerWord[p]<=12) foundPlace=true; // right if (wordDirection[p]==4 && (int) (wordPlace[p]/13)-lettersPerWord[p]>=0) if (wordPlace[p]%13-lettersPerWord[p]>=0) foundPlace=true; // up left if (wordDirection[p]==5 && (int) (wordPlace[p]/13)-lettersPerWord[p]>=0) if (wordPlace[p]%13+lettersPerWord[p]<=12) foundPlace=true; //up right if (wordDirection[p]==6 && (int) (wordPlace[p]/13)+lettersPerWord[p]<=11) if (wordPlace[p]%13-lettersPerWord[p]>=0) foundPlace=true; //down left if (wordDirection[p]==7 && (int) (wordPlace[p]/13)+lettersPerWord[p]<=11) if (wordPlace[p]%13+lettersPerWord[p]<=12) foundPlace=true; //down right //check if char already written doesnt match if (foundPlace==true) for (gg=0;gg<lettersPerWord[p];gg++) { if (wordDirection[p]==0) directionAddition = -13; if (wordDirection[p]==1) directionAddition = +13; if (wordDirection[p]==2) directionAddition = -1; if (wordDirection[p]==3) directionAddition = +1; if (wordDirection[p]==4) directionAddition = -14; if (wordDirection[p]==5) directionAddition = -12; if (wordDirection[p]==6) directionAddition = +12; if (wordDirection[p]==7) directionAddition = +14; if ((boardColor[wordPlace[p]+(gg*directionAddition)] == true) && (board[wordPlace[p]+(gg*directionAddition)])!= ((char) Cwords[p] [gg])) foundPlace=false; }//for g k=k+1; if (k>1300) { killer=true; p=9; foundPlace=true; } } // while //put word chars to board array of chars if (killer==false) { for (t=0;t<lettersPerWord[p];t++) { if (wordDirection[p]==0) directionAddition = -13; if (wordDirection[p]==1) directionAddition = +13; if (wordDirection[p]==2) directionAddition = -1; if (wordDirection[p]==3) directionAddition = +1; if (wordDirection[p]==4) directionAddition = -14; if (wordDirection[p]==5) directionAddition = -12; if (wordDirection[p]==6) directionAddition = +12; if (wordDirection[p]==7) directionAddition = +14; wordFoundFirstPlaceX[p]=wordPlace[p]-((wordPlace[p]/13)*13); wordFoundFirstPlaceY[p]=wordPlace[p]/13; int kl=wordPlace[p]+(directionAddition*(lettersPerWord[p]-1)); wordFoundLastPlaceX[p]=kl-((kl/13)*13); wordFoundLastPlaceY[p]=kl/13; boardColor[wordPlace[p]+(t*directionAddition)] = true; board[wordPlace[p]+(t*directionAddition)]=(char) Cwords[p] [t]; }//t }// if killler }// p } while (killer==true); // while killer for (p=0;p<150;p++) { boardColor[p]=false; } for (p=0;p<20;p++) wordFound[p]=false;}private final void boardToN () {// for (p=0;p<150;p++) board[p]= ( (char) (getRandomInt(25)+97));int p,t;for (p=0;p<150;p++) for (t=0;t<26;t++) {if (board[p]==((char) (t+97))) boardN[p]=t;}}public final void newGame () { int p;for (p=0;p<10;p++) wordFound[p]=false; squareX=1; squareY=1; letStart=0; lettersSel=0;setBoard ();}}//class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -