Description

提交答案题,写个2048 AI 告诉你随机数生成方式.

Sol

xjblg+A*.

首先我写了个模拟,2048.

然后自己YY就可以啦...各种乱搞...

因为随机数,一个最好的状态一定只由一种状态得到,但最初的状态可能转移到多个价值差不多的状态,需要多搜几个..

于是我用队列来卡队列大小...剩下的就是估价函数了.

写估价函数的时候一个蛇形递增的序列权值必然需要很高.

最大权值也有一定权值,因为毕竟要合起来,但是合起来又不一定是最优的,价值适当.

我自己还乱搞了几个,比如空格子个数,相邻相同数字的个数,这个多了可以一步全部合起来来获得更多的空格子.

然后把2048的大模拟封装成结构体写头文件里,表示一个状态.

最后就是跑了...32768应该都可以跑出来,而且比较快,开 O2 跑的更快.

某ISA还把数据加强了,要求跑出65534,我说这个也是可以的,不确定每个种子都能跑出来,不过大部分应该是可以跑出来的.

剩下的就是贴代码了...

Code

2048.cpp

  1. #include<cstdio>
  2. #include<conio.h>
  3. #include<cstring>
  4. #include<cstdlib>
  5. #include<iostream>
  6. using namespace std;
  7.  
  8. const int N = 4;
  9. const int M = 16;
  10. const int MUL = 8221;
  11.  
  12. int seq;
  13. int w[M];
  14. FILE *fout=fopen("log.out","w");
  15.  
  16. void initSeed(int seed){ seq = seed; }
  17. int GetRand(){ return (seq = (seq * MUL) + (seq >> 16)) & 15; }
  18. //1 w 2 s 3 a 4 d
  19. int Read(char ch=getch()){
  20. if(isascii(ch)){
  21. switch(ch){
  22. case 'w':case 'W':return 1;
  23. case 's':case 'S':return 2;
  24. case 'a':case 'A':return 3;
  25. case 'd':case 'D':return 4;
  26. }
  27. }else{
  28. ch=getch();
  29. switch(ch){
  30. case 72:return 1;
  31. case 75:return 3;
  32. case 77:return 4;
  33. case 80:return 2;
  34. }
  35. }return -1;
  36. }
  37. void GetW(int x=GetRand()){ for(;w[x];x=GetRand());w[x]=2; }
  38. void Up(int a[]){
  39. int u[5],b[5];
  40. for(int i=0,j,c,t;i<4;i++){
  41. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  42. for(c=0,j=i;j<16;j+=4) if(a[j]) b[++c]=a[j],a[j]=0;
  43. for(j=1;j<=c;j++) if(!u[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  44. for(j=1,t=i;j<=c;j++) if(!u[j]) a[t]=b[j],t+=4;
  45. }
  46. }
  47. void Down(int a[]){
  48. int u[5],b[5];
  49. for(int i=0,j,c,t;i<4;i++){
  50. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  51. for(c=0,j=i+12;j>=0;j-=4) if(a[j]) b[++c]=a[j],a[j]=0;
  52. for(j=1;j<=c;j++) if(!u[j] && b[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  53. for(j=1,t=i+12;j<=c;j++) if(!u[j]) a[t]=b[j],t-=4;
  54. }
  55. }
  56. void Left(int a[]){
  57. int u[5],b[5];
  58. for(int i=0,j,c,t;i<16;i+=4){
  59. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  60. for(c=0,j=i;j<i+4;j++) if(a[j]) b[++c]=a[j],a[j]=0;
  61. for(j=1;j<=c;j++) if(!u[j] && b[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  62. for(j=1,t=i;j<=c;j++) if(!u[j]) a[t]=b[j],t++;
  63. }
  64. }
  65. void Right(int a[]){
  66. int u[5],b[5];
  67. for(int i=0,j,c,t;i<16;i+=4){
  68. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  69. for(c=0,j=i+3;j>=i;j--) if(a[j]) b[++c]=a[j],a[j]=0;
  70. for(j=1;j<=c;j++) if(!u[j] && b[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  71. for(j=1,t=i+3;j<=c;j++) if(!u[j]) a[t]=b[j],t--;
  72. }
  73. }
  74.  
  75. void Copy(int a[],int b[]){ for(int i=0;i<16;i++) b[i]=a[i]; }
  76. int check(int a[],int b[]){ for(int i=0;i<16;i++) if(a[i]!=b[i]) return 1;return 0; }
  77.  
  78. void Out(){
  79. system("cls");
  80. for(int i=1;i<=8;i++) putchar('\n');
  81. for(int i=0;i<M;i++){
  82. if(!w[i]) printf(" -%c"," \n"[(i+1)%4 == 0]);
  83. else printf("%5d%c",w[i]," \n"[(i+1)%4 == 0]);
  84. }
  85. }
  86. int Over(){
  87. int t[M];
  88. Copy(w,t),Up(t);if(check(w,t)) return 0;
  89. Copy(w,t),Down(t);if(check(w,t)) return 0;
  90. Copy(w,t),Left(t);if(check(w,t)) return 0;
  91. Copy(w,t),Right(t);if(check(w,t)) return 0;
  92. return 1;
  93. }
  94. void Print(char c){ fprintf(fout,"%c",c); }
  95. void Play(int x){
  96. initSeed(x),GetW(),GetW(),Out();
  97. int cp[M];
  98. for(;;){
  99. int od=Read(),f=0;
  100. switch(od){
  101. case 1:Copy(w,cp),Up(cp);if(check(w,cp)) Up(w),f=1,Print('U');break;
  102. case 2:Copy(w,cp),Down(cp);if(check(w,cp)) Down(w),f=1,Print('D');break;
  103. case 3:Copy(w,cp),Left(cp);if(check(w,cp)) Left(w),f=1,Print('L');break;
  104. case 4:Copy(w,cp),Right(cp);if(check(w,cp)) Right(w),f=1,Print('R');break;
  105. }
  106. if(f) GetW();
  107. if(!Over()) Out();
  108. else{ puts("You lose!");return; }
  109. }
  110. }
  111. int main(){
  112. for(int x;;){
  113. cin>>x;
  114. Play(x);
  115. }return 0;
  116. }

  

_2048.h

  1. #include<cstdio>
  2. #include<conio.h>
  3. #include<cstring>
  4. #include<cstdlib>
  5. #include<iostream>
  6. using namespace std;
  7.  
  8. #define G(i,j) ((i-1)*4+j-1)
  9. const int N = 4;
  10. const int M = 16;
  11. const int MUL = 8221;
  12. const double SmoothVal = 17;
  13. const double MonoVal = 100;
  14. const double SpaceVal = 5;
  15. const double MaxVal = 3;
  16.  
  17. struct S{
  18. int seq,maxn,lst;double val;
  19. int w[M];
  20. //1 w 2 s 3 a 4 d
  21. void initSeed(int seed){ seq = seed;memset(w,0,sizeof(w)); }
  22. int GetRand(){ return (seq = (seq * MUL) + (seq >> 16)) & 15; }
  23. void GetW(){ int x=GetRand();for(;w[x];x=GetRand());w[x]=2; }
  24. void Up(int a[]){
  25. int u[5],b[5];
  26. for(int i=0,j,c,t;i<4;i++){
  27. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  28. for(c=0,j=i;j<16;j+=4) if(a[j]) b[++c]=a[j],a[j]=0;
  29. for(j=1;j<=c;j++) if(!u[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  30. for(j=1,t=i;j<=c;j++) if(!u[j]) a[t]=b[j],t+=4;
  31. }
  32. }
  33. void Down(int a[]){
  34. int u[5],b[5];
  35. for(int i=0,j,c,t;i<4;i++){
  36. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  37. for(c=0,j=i+12;j>=0;j-=4) if(a[j]) b[++c]=a[j],a[j]=0;
  38. for(j=1;j<=c;j++) if(!u[j] && b[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  39. for(j=1,t=i+12;j<=c;j++) if(!u[j]) a[t]=b[j],t-=4;
  40. }
  41. }
  42. void Left(int a[]){
  43. int u[5],b[5];
  44. for(int i=0,j,c,t;i<16;i+=4){
  45. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  46. for(c=0,j=i;j<i+4;j++) if(a[j]) b[++c]=a[j],a[j]=0;
  47. for(j=1;j<=c;j++) if(!u[j] && b[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  48. for(j=1,t=i;j<=c;j++) if(!u[j]) a[t]=b[j],t++;
  49. }
  50. }
  51. void Right(int a[]){
  52. int u[5],b[5];
  53. for(int i=0,j,c,t;i<16;i+=4){
  54. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  55. for(c=0,j=i+3;j>=i;j--) if(a[j]) b[++c]=a[j],a[j]=0;
  56. for(j=1;j<=c;j++) if(!u[j] && b[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1;
  57. for(j=1,t=i+3;j<=c;j++) if(!u[j]) a[t]=b[j],t--;
  58. }
  59. }
  60. void Find(){
  61. maxn=lst=0;
  62. for(int i=0;i<M;i++) if(w[i]) lst++,maxn=max(w[i],maxn);
  63. }
  64. void Copy(int a[],int b[]){ for(int i=0;i<M;i++) b[i]=a[i]; }
  65. int check(int a[],int b[]){ for(int i=0;i<M;i++) if(a[i]!=b[i]) return 1;return 0; }
  66. int Over(){
  67. int t[M];
  68. Copy(w,t),Up(t);if(check(w,t)) return 0;
  69. Copy(w,t),Down(t);if(check(w,t)) return 0;
  70. Copy(w,t),Left(t);if(check(w,t)) return 0;
  71. Copy(w,t),Right(t);if(check(w,t)) return 0;
  72. return 1;
  73. }
  74. void Order(int x){
  75. switch(x){
  76. case 1:Up(w);break;
  77. case 2:Down(w);break;
  78. case 3:Left(w);break;
  79. case 4:Right(w);break;
  80. }
  81. }
  82. void Print(){
  83. for(int i=0;i<M;i++)
  84. if(!w[i]) printf(" -%c"," \n"[(i+1)%4 == 0]);
  85. else printf("%5d%c",w[i]," \n"[(i+1)%4 == 0]);
  86. putchar('\n');
  87. }
  88. int abs(int x){ return x<0?-x:x; }
  89. int Smooth(){
  90. int res=0x7fffffff,tmp=0;
  91. int b1[]={ 0,1,2,3,7,6,5,4,8,9,10,11,15,14,13,12 };
  92. int b2[]={ 3,2,1,0,4,5,6,7,11,10,9,8,12,13,14,15 };
  93. int b3[]={ 12,13,14,15,11,10,9,8,4,5,6,7,3,2,1,0 };
  94. int b4[]={ 15,14,13,12,8,9,10,11,7,6,5,4,0,1,2,3 };
  95. int b5[]={ 0,4,8,12,13,9,5,1,2,6,10,14,15,11,7,3 };
  96. int b6[]={ 12,8,4,0,1,5,9,13,14,10,6,2,3,7,11,15 };
  97. int b7[]={ 3,7,11,15,14,10,6,2,1,5,9,13,12,8,4,0 };
  98. int b8[]={ 15,11,7,3,2,6,10,14,13,9,5,1,0,4,8,12 };
  99.  
  100. for(int i=0;i<M-1;i++) if(w[b1[i]] && w[b1[i+1]]) tmp+=abs(w[b1[i]]-w[b1[i+1]]*2);
  101. if(w[b1[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  102. for(int i=0;i<M-1;i++) if(w[b2[i]] && w[b2[i+1]]) tmp+=abs(w[b2[i]]-w[b2[i+1]]*2);
  103. if(w[b2[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  104. for(int i=0;i<M-1;i++) if(w[b3[i]] && w[b3[i+1]]) tmp+=abs(w[b3[i]]-w[b3[i+1]]*2);
  105. if(w[b3[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  106. for(int i=0;i<M-1;i++) if(w[b4[i]] && w[b4[i+1]]) tmp+=abs(w[b4[i]]-w[b4[i+1]]*2);
  107. if(w[b4[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  108. for(int i=0;i<M-1;i++) if(w[b5[i]] && w[b5[i+1]]) tmp+=abs(w[b5[i]]-w[b5[i+1]]*2);
  109. if(w[b5[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  110. for(int i=0;i<M-1;i++) if(w[b6[i]] && w[b6[i+1]]) tmp+=abs(w[b6[i]]-w[b6[i+1]]*2);
  111. if(w[b6[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  112. for(int i=0;i<M-1;i++) if(w[b7[i]] && w[b7[i+1]]) tmp+=abs(w[b7[i]]-w[b7[i+1]]*2);
  113. if(w[b7[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  114. for(int i=0;i<M-1;i++) if(w[b8[i]] && w[b8[i+1]]) tmp+=abs(w[b8[i]]-w[b8[i+1]]*2);
  115. if(w[b8[0]] == maxn) tmp-=maxn;res=min(res,tmp),tmp=0;
  116. return res;
  117. // for(int i=1;i<=4;i++) for(int j=1;j<=3;j++) if(w[G(i,j)] && w[G(i,j+1)] && w[G(i,j)] > w[G(i,j+1)]) tmp+=w[G(i,j)]-w[G(i,j+1)]*2;
  118. // res=min(res,tmp),tmp=0;
  119. // for(int i=1;i<=4;i++) for(int j=1;j<=3;j++) if(w[G(i,j)] && w[G(i,j+1)] && w[G(i,j)] < w[G(i,j+1)]) tmp+=w[G(i,j+1)]-w[G(i,j)]*2;
  120. // res=min(res,tmp),tmp=0;
  121. // for(int j=1;j<=4;j++) for(int i=1;i<=3;i++) if(w[G(i,j)] && w[G(i+1,j)] && w[G(i,j)] > w[G(i+1,j)]) tmp+=w[G(i,j)]-w[G(i+1,j)]*2;
  122. // res=min(res,tmp),tmp=0;
  123. // for(int j=1;j<=4;j++) for(int i=1;i<=3;i++) if(w[G(i,j)] && w[G(i+1,j)] && w[G(i,j)] < w[G(i+1,j)]) tmp+=w[G(i+1,j)]-w[G(i,j)]*2;
  124. // return min(res,tmp);
  125. }
  126. int Mono(){
  127. int res=0,tmp=0;
  128. for(int i=1;i<=4;i++) for(int j=1;j<=3;j++) if(w[G(i,j)] < w[G(i,j+1)]) tmp++;
  129. for(int i=1;i<=4;i++) for(int j=1;j<=3;j++) if(w[G(i,j)] > w[G(i,j+1)]) tmp--;
  130. if(tmp < 0) tmp*=-1;
  131. for(int j=1;j<=4;j++) for(int i=1;i<=3;i++) if(w[G(i,j)] < w[G(i+1,j)]) res++;
  132. for(int j=1;j<=4;j++) for(int i=1;i<=3;i++) if(w[G(i,j)] > w[G(i+1,j)]) res--;
  133. if(res < 0) res*=-1;
  134. return max(res,tmp);
  135. }
  136. int Space(){
  137. int cnt=0;double r=0,h=0,sr=0,sh=0;
  138. for(int i=1;i<=4;i++) for(int j=1;j<=4;j++) if(!w[G(i,j)]) sr+=i,sh+=j,cnt++;
  139. sr=sr/cnt,sh=sh/cnt;
  140. for(int i=1;i<=4;i++) for(int j=1;j<=4;j++) if(!w[G(i,j)]) r+=(sr-i)*(sr-i),h+=(sh-j)*(sh-j);
  141. return (int)(r+h)*(16-lst);
  142. }
  143. void GetVal(){
  144. val = 0;
  145. val -= Smooth() * SmoothVal;
  146. val += Mono() * MonoVal;
  147. val -= Space() * SpaceVal;
  148. val += maxn * MaxVal;
  149. /* int u[5],b[5];
  150. for(int i=0,j,c;i<4;i++){
  151. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  152. for(c=0,j=i;j<16;j+=4) if(w[j]) b[++c]=w[j];
  153. for(j=1;j<=c;j++) if(!u[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1,tmp+=b[j];
  154. }
  155. val=max(val,tmp),tmp=0;
  156. for(int i=0,j,c;i<4;i++){
  157. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  158. for(c=0,j=i+12;j>=0;j-=4) if(w[j]) b[++c]=w[j];
  159. for(j=1;j<=c;j++) if(!u[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1,tmp+=b[j];
  160. }
  161. val=max(val,tmp),tmp=0;
  162. for(int i=0,j,c;i<16;i+=4){
  163. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  164. for(c=0,j=i;j<i+4;j++) if(w[j]) b[++c]=w[j];
  165. for(j=1;j<=c;j++) if(!u[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1,tmp+=b[j];
  166. }
  167. val=max(val,tmp),tmp=0;
  168. for(int i=0,j,c;i<16;i+=4){
  169. memset(u,0,sizeof(u)),memset(b,0,sizeof(b));
  170. for(c=0,j=i+3;j>=i;j--) if(w[j]) b[++c]=w[j];
  171. for(j=1;j<=c;j++) if(!u[j]) if(b[j] == b[j+1]) b[j]+=b[j+1],u[j+1]=1,tmp+=b[j];
  172. }*/
  173. return;
  174. }
  175. };

main.cpp

  1. #include "_2048.h"
  2. #include<utility>
  3. #include<vector>
  4. #include<windows.h>
  5. #include<queue>
  6. #include<stack>
  7. #include<algorithm>
  8. using namespace std;
  9.  
  10. #define mpr(a,b) make_pair(a,b)
  11. const int Q = 2048;
  12.  
  13. queue<S> q;
  14. vector<pair<int,int> > f;
  15. int cnt;
  16.  
  17. void Out(int x){
  18. stack<int> stk;
  19. // cout<<x<<endl;
  20. for(pair<int,int> y=f[x];;y=f[y.first]){
  21. stk.push(y.second);
  22. // cout<<y.second<<endl;
  23. if(y.first == 0) break;
  24. }
  25. for(;!stk.empty();stk.pop()){
  26. switch(stk.top()){
  27. case 1:putchar('U');break;
  28. case 2:putchar('D');break;
  29. case 3:putchar('L');break;
  30. case 4:putchar('R');break;
  31. }
  32. }
  33. }
  34. void BFS(S &a){
  35. q.push(a);int tmp=0;
  36. f.push_back(mpr(0,0));
  37. for(S t,s[5];!q.empty();++tmp){
  38. // Sleep(120);
  39. t=q.front(),q.pop();
  40. // t.Print();
  41. if(t.Find(),t.maxn >= 60000){ Out(tmp);return; }
  42. if(t.Over()) continue;
  43.  
  44. vector<pair<double,int> > A;
  45.  
  46. for(int i=1;i<=4;i++){
  47. s[i].initSeed(t.seq);
  48. s[i].Copy(t.w,s[i].w);
  49. s[i].Order(i);
  50. if(!s[i].check(s[i].w,t.w)){ continue; }
  51. s[i].Find();
  52. // if(s[i].maxn >= 60000){ Out(tmp);cout<<i<<endl;return; }
  53. if(s[i].Over()) continue;
  54. s[i].GetW();
  55. if(s[i].Over()) continue;
  56. s[i].GetVal();
  57. A.push_back(mpr(s[i].val,i));
  58. // s[i].Print();
  59. // q.push(s[i]);
  60. // f.push_back(mpr(tmp,i));
  61. }
  62.  
  63. sort(A.begin(),A.end());
  64. for(int i=A.size()-1;i>=0 && q.size()<Q && i+3>A.size();i--){
  65. q.push(s[A[i].second]);
  66. // s[A[i].second].Print(),printf("%lf\n",s[A[i].second].val);
  67. f.push_back(mpr(tmp,A[i].second));
  68. }
  69. // cout<<"***********"<<endl;
  70. // for(int i=A.size()-1;i>=0;i--) s[A[i].second].Print(),printf("%lf\n",s[A[i].second].val);
  71. // cout<<"***********"<<endl;
  72. }
  73. }
  74.  
  75. int main(){
  76. freopen("204820.out","w",stdout);
  77. S fff;
  78. fff.initSeed(20);
  79. fff.GetW(),fff.GetW();
  80. // fff.Print();
  81. BFS(fff);
  82. return 0;
  83. }

  

ZJOI2014 2048的更多相关文章

  1. ZJOI2017 Day1

    私のZJOI Day1 2017-3-21 07:52:53 有人在暴力膜 苟-- 富贵 无相忘 ZJOI2017交流群 133135071 如果你足够厉害 如果你足够厉害 如果你足够厉害 其实完全可 ...

  2. jQuery实践-网页版2048小游戏

    ▓▓▓▓▓▓ 大致介绍 看了一个实现网页版2048小游戏的视频,觉得能做出自己以前喜欢玩的小游戏很有意思便自己动手试了试,真正的验证了这句话-不要以为你以为的就是你以为的,看视频时觉得看懂了,会写了, ...

  3. android 模拟2048

    利用节日休息时间在ANDROID上进行学习并模拟2048游戏. 效果如下图: 制作思路: 1.画出2048游戏主界面,根据手机屏幕宽高度进行计算并画出每个方块的大小. @Override protec ...

  4. 2048游戏_QT实现

    #ifndef GAMEWIDGET_H #define GAMEWIDGET_H #include <QWidget> #include <QMouseEvent> #inc ...

  5. BZOJ 2048 题解

    2048: [2009国家集训队]书堆 Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1076  Solved: 499[Submit][Status ...

  6. flash跨域访问,crossdomain.xml,error #2048

    最近遇到了flash的万年老梗,跨域访问的问题.之前一直没有处理过这类问题,是因为做项目的时候别人已经处理好了.真到自己遇到的时候,还是很费脑筋的. 1遇到的问题 客户端发布到网页的时候,socket ...

  7. 用javascript实现一个2048游戏

    早就想自己写一个2048游戏了,昨晚闲着没事,终于写了一个 如下图,按方向键开始玩吧. 如果觉得操作不方便,请直接打开链接玩吧: http://gujianbo.1kapp.com/2048/2048 ...

  8. <2048>调查报告心得与体会

    老师这次给我们布置了一个任务,就是让我们写一份属于自己的调查报告,针对这个任务,我们小组的六个人通过积极的讨论,提出了一些关于我们产品的问题,当然这些问题并不是很全面,因为我们是从自己的角度出发,无法 ...

  9. 【水】基于ege的2048

    不要问我ege怎么装 http://tieba.baidu.com/p/2227018541 好,现在我们装好了ege 开始写2048吧 没有算法,单纯模拟,不用讲解——这才叫[水]的含义 界面极度简 ...

随机推荐

  1. 自定义JSP标签入门

    1.编写一个实现Tag接口的java类 package TagDemo; import javax.servlet.http.HttpServletRequest; import javax.serv ...

  2. jQuery 取值、赋值的基本方法

    转载:http://www.cnblogs.com/huanhuan86/archive/2012/06/13/2548071.html 获取元素的value值: /*获得TEXT.AREATEXT的 ...

  3. 【转】apache kafka监控系列-KafkaOffsetMonitor

    apache kafka监控系列-KafkaOffsetMonitor 时间 2014-05-27 18:15:01  CSDN博客 原文  http://blog.csdn.net/lizhitao ...

  4. linux环境下给文件加密/解密的方法

      原文地址:linix环境下给文件加密/解密的方法 作者:oracunix 一. 利用 vim/vi 加密:优点:加密后,如果不知道密码,就看不到明文,包括root用户也看不了:缺点:很明显让别人知 ...

  5. Java中为什么有abstract interface 修饰类?

    如果有人问你为什么有abstract interface 修饰类,答案一定是他看到的这种方式一定是反编译出来的结果.实际中abstract interface和interface修饰的类没有区别. 下 ...

  6. PHP从零开始-笔记-面向对象编程的概念

    面向对象变成的概念 需要一一种不同的方式来考虑如何构造应用程序.通过对象可以在对应用程序所处理的显示任务.过程和思想进行编码是,实施更贴切的建模.OOP方法并不是将应用程序考虑成一个将大量数据从一个函 ...

  7. ASP.NET 5与MVC 6中的新特性

    差点忘了提一句,MVC 6中默认的渲染引擎Razor也将得到更新,以支持C# 6中的新语法.而Razor中的新特性还不只这一点. 在某些情况下,直接在Web页面中嵌入某些JSON数据的方式可能比向服务 ...

  8. ThinkPHP 修改,删除数据,全部显示

    1,修改数据 //数据修改 function Update() { $model = D("info"); /* //1,数组方式 $attr = array( "Cod ...

  9. html 图像映射

    个人先做而一个例子 <body> <img src="图像映射/enterdesk.com-D69055E2B422567CB273963EA05FF7D4.jpg&quo ...

  10. 1.交通聚类:编辑距离 (Levenshtein距离)Java实现

    1.最近工作中要实现用户车辆的行驶路线的聚类,由于所给的数据只有用户一天中交通卡口所监视的卡口名称 :即青岛路-威海路-济阳路 . 要通过聚类实现车辆路线的规律分析,首先要解决的是相似度问题,我们知道 ...