├── Mine-Riddancer.ppt ├── sp1.txt ├── .gitattributes ├── sp.txt ├── .gitignore ├── MS 2.CPP └── MR 3.0.CPP /Mine-Riddancer.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vspandan/MineRiddancer/master/Mine-Riddancer.ppt -------------------------------------------------------------------------------- /sp1.txt: -------------------------------------------------------------------------------- 1 | 2 | Press 'f' to flag a box or to defag a box 3 | Press 's' to open a box 4 | Press esc key to terminate the game 5 | Use arrow keys to move the selector -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /sp.txt: -------------------------------------------------------------------------------- 1 | PATTERNS AND SOLVING: 2 | 1.SINGLE-SQUARE ANALYSIS: 3 | 4 | There are two special cases that are of extra interest when solving board canbe solved using analysis of only one square and its surrounding squares[1] 5 | If the number of unclicked(blank/flagged)squares adjacent to numbered square is equaltonumber on that square,all these unclicked squares must be mines. 6 | For any numbered square,if the number of mines you've found adjacent to that square is equal to number of the square,all other squares adjacent to numbered square must be 'safe' (eg. If you know the square to the right of a 1 is a mine,then you can deduce that all other squares next to that 1 do not contain mines.) 7 | 8 | 2.MULTIPLE SQUARE ANALYSIS: 9 | 10 | To solve more complex puzzles, one needs to consider more than one square at a time.Some strategies that involve considering more than one number at a time. If you have two adjacent numbers, the difference between those numbers is equal to the difference in the amount of mines for the 3 squares adjacent to each thatare not adjacent to the other number. 11 | For example: if these numbers differ by 3, all of the adjacent squares to thehigher number not shared by the other are mines, and all the opposite ones are safe. 12 | In similar method, sometimes it can be known that there are a certain number of mines in a certain number of squares (without necessarily knowing which are mines and which are safe)and you can often utilise this information to find out information about other squares. 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | 46 | [Dd]ebug/ 47 | [Rr]elease/ 48 | x64/ 49 | build/ 50 | [Bb]in/ 51 | [Oo]bj/ 52 | 53 | # MSTest test Results 54 | [Tt]est[Rr]esult*/ 55 | [Bb]uild[Ll]og.* 56 | 57 | *_i.c 58 | *_p.c 59 | *.ilk 60 | *.meta 61 | *.obj 62 | *.pch 63 | *.pdb 64 | *.pgc 65 | *.pgd 66 | *.rsp 67 | *.sbr 68 | *.tlb 69 | *.tli 70 | *.tlh 71 | *.tmp 72 | *.tmp_proj 73 | *.log 74 | *.vspscc 75 | *.vssscc 76 | .builds 77 | *.pidb 78 | *.log 79 | *.scc 80 | 81 | # Visual C++ cache files 82 | ipch/ 83 | *.aps 84 | *.ncb 85 | *.opensdf 86 | *.sdf 87 | *.cachefile 88 | 89 | # Visual Studio profiler 90 | *.psess 91 | *.vsp 92 | *.vspx 93 | 94 | # Guidance Automation Toolkit 95 | *.gpState 96 | 97 | # ReSharper is a .NET coding add-in 98 | _ReSharper*/ 99 | *.[Rr]e[Ss]harper 100 | 101 | # TeamCity is a build add-in 102 | _TeamCity* 103 | 104 | # DotCover is a Code Coverage Tool 105 | *.dotCover 106 | 107 | # NCrunch 108 | *.ncrunch* 109 | .*crunch*.local.xml 110 | 111 | # Installshield output folder 112 | [Ee]xpress/ 113 | 114 | # DocProject is a documentation generator add-in 115 | DocProject/buildhelp/ 116 | DocProject/Help/*.HxT 117 | DocProject/Help/*.HxC 118 | DocProject/Help/*.hhc 119 | DocProject/Help/*.hhk 120 | DocProject/Help/*.hhp 121 | DocProject/Help/Html2 122 | DocProject/Help/html 123 | 124 | # Click-Once directory 125 | publish/ 126 | 127 | # Publish Web Output 128 | *.Publish.xml 129 | *.pubxml 130 | 131 | # NuGet Packages Directory 132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 133 | #packages/ 134 | 135 | # Windows Azure Build Output 136 | csx 137 | *.build.csdef 138 | 139 | # Windows Store app package directory 140 | AppPackages/ 141 | 142 | # Others 143 | sql/ 144 | *.Cache 145 | ClientBin/ 146 | [Ss]tyle[Cc]op.* 147 | ~$* 148 | *~ 149 | *.dbmdl 150 | *.[Pp]ublish.xml 151 | *.pfx 152 | *.publishsettings 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | App_Data/*.mdf 166 | App_Data/*.ldf 167 | 168 | ############# 169 | ## Windows detritus 170 | ############# 171 | 172 | # Windows image file caches 173 | Thumbs.db 174 | ehthumbs.db 175 | 176 | # Folder config file 177 | Desktop.ini 178 | 179 | # Recycle Bin used on file shares 180 | $RECYCLE.BIN/ 181 | 182 | # Mac crap 183 | .DS_Store 184 | 185 | 186 | ############# 187 | ## Python 188 | ############# 189 | 190 | *.py[co] 191 | 192 | # Packages 193 | *.egg 194 | *.egg-info 195 | dist/ 196 | build/ 197 | eggs/ 198 | parts/ 199 | var/ 200 | sdist/ 201 | develop-eggs/ 202 | .installed.cfg 203 | 204 | # Installer logs 205 | pip-log.txt 206 | 207 | # Unit test / coverage reports 208 | .coverage 209 | .tox 210 | 211 | #Translations 212 | *.mo 213 | 214 | #Mr Developer 215 | .mr.developer.cfg 216 | -------------------------------------------------------------------------------- /MS 2.CPP: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | static int c,flag2,mark[16][16],mark1[16][16]; 8 | int minx,miny,maxx,maxy,mines,grid,flag1; 9 | int count=0,a[30][2]; 10 | void flag(int,int); 11 | void minegen(); 12 | void open(int,int); 13 | int numgen(int,int,int); 14 | int check(int,int,int); 15 | void main() 16 | { char c,ch,ch1; 17 | FILE *ssa; 18 | int gdriver=DETECT,gmode,errorcode,x,y; 19 | initgraph(&gdriver,&gmode,"c:\\turboc3\\bgi"); 20 | setbkcolor(18); 21 | for(int k=0;k<25;k++) 22 | { setcolor(3); 23 | delay(40); 24 | ellipse(320,240,0,360,200+k,50); 25 | } 26 | settextstyle(GOTHIC_FONT,0,5); 27 | outtextxy(170,210,"MINESWEEPER"); 28 | getch(); 29 | setcolor(15); 30 | print:clearviewport(); 31 | settextstyle(TRIPLEX_FONT,0,2); 32 | setcolor(3); 33 | rectangle(80,130,570,240); 34 | rectangle(85,135,565,235); 35 | outtextxy(100,140," BEGINNER LEVEL1: 9X9 GRID 10 MINES"); 36 | outtextxy(100,170,"INTERMEDIATE LEVEL2:10X10 GRID 16 MINES"); 37 | outtextxy(100,200," ADVANCED LEVEL3:13X13 GRID 30 MINES"); 38 | settextstyle(DEFAULT_FONT,0,1); 39 | outtextxy(250,250,"ENTER THE LEVEL:"); 40 | outtextxy(100,380,"PRESS ESCAPE TO QUIT"); 41 | outtextxy(100,410,"PRESS F1 FOR HELP"); 42 | outtextxy(100,440,"PRESS F2 FOR CONTROLS"); 43 | c=getche(); 44 | clearviewport(); 45 | if (c=='1') { x=minx=140;y=miny=120;mines=flag1=10;grid=9; } 46 | else if(c=='2') { x=minx=120;y=miny=110;flag1=mines=16;grid=10; } 47 | else if(c=='3') { x=minx=60;y=miny=70;mines=flag1=30;grid=13; } 48 | else if(c==27) exit(1); 49 | else if(c==';'||c=='<') 50 | { clearviewport(); 51 | if(c==';') 52 | ssa=fopen("c:\\turboc3\\sp.txt","r"); 53 | if(c=='<') 54 | ssa=fopen("c:\\turboc3\\sp1.txt","r"); 55 | while((ch1=fgetc(ssa))!= EOF) 56 | printf("%c",ch1); 57 | printf("\nPRESS ANY KEY TO EXIT"); 58 | getch(); 59 | rewind(ssa); 60 | goto print; 61 | } 62 | else goto print; 63 | maxx=minx+(grid-1)*40; 64 | maxy=miny+(grid-1)*30; 65 | setbkcolor(15); 66 | setcolor(8);//box colour 67 | for(int i=0;iminy) 93 | y=y-30; 94 | break; 95 | case 80:if(yminx) 99 | x=x-40; 100 | break; 101 | case 77:if(x=minx&&x<=maxx&&y>=miny&&y<=maxy) 158 | { int c=0; 159 | if(mark[(x-minx)/40][(y-miny)/30]==1) 160 | mark1[(x-minx)/40][(y-miny)/30]=1; 161 | if(mark1[(x-minx)/40][(y-miny)/30]==0&&mark[(x-minx)/40][(y-miny)/30]==0)//correction made 162 | { for(int i=0;i 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | union REGS in,out; 8 | int c,mark[16][16],mark1[16][16],minx,miny,maxx,maxy,mines,grid,flag1,flag2=0,count,a[30][2],xpos=100,ypos=100,click; 9 | char ch,ch1; 10 | void callmouse() 11 | { in.x.ax=1; 12 | int86(51,&in,&out); 13 | } 14 | void mousepos(int &xpos,int &ypos,int &click) 15 | { in.x.ax=3; 16 | int86(51,&in,&out); 17 | click=out.x.bx; 18 | xpos=out.x.cx; 19 | ypos=out.x.dx; 20 | } 21 | void setpos(int x,int y) 22 | { in.x.ax=4; 23 | in.x.cx=x; 24 | in.x.dx=y; 25 | int86(51,&in,&out); 26 | } 27 | void hide() 28 | { in.x.ax=2; 29 | int86(51,&in,&out); 30 | } 31 | void restrict() 32 | { in.x.ax=7; 33 | in.x.cx=0; 34 | in.x.dx=640; 35 | int86(51,&in,&out); 36 | in.x.ax=8; 37 | in.x.cx=0; 38 | in.x.dx=640; 39 | int86(51,&in,&out); 40 | } 41 | void minegen() 42 | { count=0; 43 | randomize(); 44 | while(count=minx&&x<=maxx&&y>=miny&&y<=maxy) 92 | { int c=0; 93 | if(mark[(x-minx)/40][(y-miny)/30]==1) 94 | mark1[(x-minx)/40][(y-miny)/30]=1; 95 | if(mark1[(x-minx)/40][(y-miny)/30]==0&&mark[(x-minx)/40][(y-miny)/30]==0)//correction made 96 | { for(int i=0;i=minx&&x<=maxx&&y>=miny&&y<=maxy) 131 | { if(mark[(x-minx)/40][(y-miny)/30]==0&&mark1[(x-minx)/40][(y-miny)/30]==0) 132 | { mark[(x-minx)/40][(y-miny)/30]=1; 133 | mark1[(x-minx)/40][(y-miny)/30]=1; 134 | setfillstyle(SOLID_FILL,14); 135 | bar(x+7,y+7,x+33,y+23); 136 | outtextxy(x+15,y+10,"*"); 137 | flag1--; 138 | for(int i=0;i105&&xpos<510&&ypos>95&&ypos<135&&click==1) 203 | { minx=140;miny=120;mines=flag1=10;grid=9; 204 | break; 205 | } 206 | else if(xpos>80&&xpos<570&&ypos>185&&ypos<225&&click==1) 207 | { minx=120;miny=110;flag1=mines=16;grid=10; 208 | break; 209 | } 210 | else if(xpos>100&&xpos<540&&ypos>265&&ypos<3055&&click==1) 211 | { minx=60;miny=70;mines=flag1=30;grid=13; 212 | break; 213 | } 214 | printf("%d,%d",t1,t2); 215 | setpos(t1,t2); 216 | }while(1); 217 | setpos(0,0); 218 | clearviewport(); 219 | maxx=minx+(grid-1)*40; 220 | maxy=miny+(grid-1)*30; 221 | setbkcolor(9); 222 | setcolor(8);//box colour 223 | for(int i=0;i=minx&&ypos>=miny&&click==2) 252 | flag(x,y,(int)difftime(b,a)); 253 | else if(xpos>=minx&&ypos>=miny&&click==1) 254 | open(x,y); 255 | callmouse(); 256 | setpos(t1,t2); 257 | delay(100); 258 | }while(1); 259 | } 260 | void game(int f) 261 | { delay(2000); 262 | setpos(0,0); 263 | clearviewport(); 264 | setbkcolor(9); 265 | outtextxy(200,200,"RESTART GAME"); 266 | settextstyle(0,0,1); 267 | rectangle(250,260,300,280); 268 | outtextxy(265,265,"YES"); 269 | rectangle(330,260,380,280); 270 | outtextxy(350,265,"NO"); 271 | printf("YOUR TIME: %d",f); 272 | do 273 | { callmouse(); 274 | int m=xpos,n=ypos; 275 | mousepos(xpos,ypos,click); 276 | if(click==0) 277 | continue; 278 | if(xpos>250&&xpos<300&&ypos>260&&ypos<280&&click==1) 279 | { for(int i=0;i<=grid;i++) 280 | { for(int j=0;j<=grid;j++) 281 | mark[i][j]=mark1[i][j]=0; 282 | for(int k=0;k<2;k++) 283 | a[i][k]=0; 284 | } 285 | flag2=0; 286 | main(); 287 | } 288 | else if(xpos>330&&xpos<380&&ypos>260&&ypos<280&&click==1) 289 | exit(1); 290 | setpos(m,n); 291 | }while(1); 292 | } --------------------------------------------------------------------------------