Home
Add Document
Sign In
Register
Sudoku Game [c++]
Home
Sudoku Game [c++]
Full description...
Author:
jsaddam709
10 downloads
232 Views
49KB Size
Report
DOWNLOAD .PDF
Recommend Documents
Game C++
code C++ for game
Sudoku
Jocuri de divertisment intelectual pentru toate varstele .
Snake Game In C
Full description
Sudoku Complicados
Descripción: Intenta resolverlos!
Sudoku - 100 Ejercicios
Sudoku Musical Reglas - Copia Experimentar
ghbDescripción completa
Synopsis on Sudoku
sudoku
Bases Concurso Sudoku
BASES SUDOKU JOSE GABRIEL CONDORCANQUI YANAOCA CANAS CUSCO
Sudoku Sant Jordi
Descripción: http://calaixetderecursos.blogspot.com/ Alicia Paíno
Sudoku Gimnasia para Tu Cerebro.pdf
Descripción completa
C++ source code for Hangman Game
Working code of game, just include words.txt of 4000 words and compile it..
Game Genre Fighting Game
A thorough analysis on Fighting Games Genre
61194450 SuDoKu Project Report for Minor Project
it is very niceFull description
cc c c c c c c c c c c c c c c c c c c c c c c c c c
Descripción completa
c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c
Full description
c c c c
Deskripsi lengkap
Dice Game
game-strauss.pdf
Game is all it is
Mafia Game
Opis igre MafiaDescrição completa
Game Theory
Game TheoryFull description
game school
game school requirements
Day Game
Game Programmer
How to be a Game Programmer
Wicked Game
Descripción: Wicked Game Transcription piano
//Programmer:HarshGupta //Program:HarshSudokuGame //Email:
[email protected]
#include
#include
#include
usingnamespacestd; inti,j; charboard[9][9]; charplayer[9][9]; voidfilling(); voidexcept(); voidspaces(intrun); voiddisplay(); voidturn(); boolerror(introw,intcolumn,charuserturn); boolcheck(); voidwon(); voiderrormsg(); voidclear_screen(); intmain(void) { intlevel,run; charback='y'; while(back=='y'||back=='Y'){ clear_screen(); cout<<"WelcomeToHarshSudokuGame\n" <<"Chooseyourlevel(1-3):"; cin>>level; switch(level) { case1: run=35; break; case2: run=45; break; case3: run=55; break; default: run=55; break; } filling();//FillingandExceptwillf filling();//F illingandExceptwillfillthewholeboardwith illthewholeboardwithcorrectd correctd igits except(); spaces(run);//Thiswillmakespacesdep spaces(run);//T hiswillmakespacesdependinguponuser'sdiffic endinguponuser'sdifficultyleve ultyleve l
turn();//Thiswilllettheusergetintotherealgame cout<<endl; cout<<"Wanttoplaysudokuagain(y/n)?"; cin>>back; } } voidturn() { for(i=0;i<9;i++) for(j=0;j<9;j++){ player[i][j]=board[i][j]; } charuserturn; introw,column; boolgamewin=false; while(!gamewin){ clear_screen(); display();//NiceDisplayBoard cout<<"\nEnterrow,columnnumber&yournumberwithspaceinbetweenth em:"; cin>>row>>column>>userturn; if(!(error(row,column,userturn))){//ErrorChecking errormsg(); continue; } player[row-1][column-1]=userturn; if(board[row-1][column-1]!=''){//Usercan'teditthenumbersgivenby computeralready errormsg(); player[row-1][column-1]=board[row-1][column-1]; continue; } if(check()){//Checkingthewinningconditionforuser won(); gamewin=true; } } } voidfilling() { chark='0'; //Filling1stLineofalltheBoxes for(j=0;j<9;j++){ board[0][j]=k+1; board[3][j]=k+2; board[6][j]=k+3; k++; } //Filling2ndLineofalltheBoxes k='0'; for(j=0;j<6;j++){
board[1][j]=k+4; board[4][j]=k+5; board[7][j]=k+6; k++; } k='6'; for(j=6;j<9;j++){ board[1][j]=k-5; board[4][j]=k-4; board[7][j]=k-3; k++; } //Filling3rdLineofalltheBoxes k='0'; for(j=0;j<3;j++){ board[2][j]=k+7; board[5][j]=k+8; board[8][j]=k+9; k++; } k='3'; for(j=3;j<9;j++){ board[2][j]=k-2; board[5][j]=k-1; board[8][j]=k; k++; } } voidexcept() { board[3][8]='1'; board[4][5]='1'; board[5][2]='1'; board[7][4]='1'; board[7][5]='2'; board[8][1]='1'; board[8][2]='2'; board[6][7]='1';board[6][8]='2'; } voidspaces(intrun) { time_tt; time(&t); srand(t); for(inta=1;a<=run;a++){ i=0+rand()%8; j=0+rand()%8; board[i][j]=''; } } voiddisplay() { cout<<"123|456|789\n" <<"--------------------------------\n\n"; for(intk=3;k<=9;k+=3){ for(i=k-3;i
cout<<i+1<<"|"; for(j=0;j<3;j++){ cout<<player[i][j]<<""; } cout<<"|"; for(j=3;j<6;j++){ cout<<player[i][j]<<""; } cout<<"|"; for(j=6;j<9;j++){ cout<<player[i][j]<<""; } cout<<"|"; cout<<endl; } cout<<endl<<"--------------------------------\n\n"; } } boolerror(introw,intcolumn,charuserturn) { if(!(row<=9&&row>=1)||!(column<=9&&column>=1)) returnfalse; for(intj=0;j<9;j++){//Errorifusertrytowritenumberalreadyexist inthesameline if(j!=column-1){ if(userturn==board[row-1][j]){ returnfalse; break; }}} for(inti=0;i<9;i++){ if(i!=row-1){ if(userturn==board[i][column-1]){ returnfalse; break; }}} returntrue; } boolcheck() { for(i=0;i<9;i++){ for(j=0;j<9;j++){ if(player[i][j]=='') returnfalse; }} returntrue; } voidwon() { cout<<"\nCongratulation,YouhavecompletedtheSudokuGame"; }
voiderrormsg() { cout<<"\nIncorrectMove\n"; system("pause"); } voidclear_screen() { HANDLEoutput_handle=GetStdHandle(STD_OUTPUT_HANDLE); DWORDbytes_write,size; COORDcoord={0,0}; CONSOLE_SCREEN_BUFFER_INFOcsbi; GetConsoleScreenBufferInfo(output_handle,&csbi); size=csbi.dwSize.X*csbi.dwSize.Y; FillConsoleOutputCharacter(output_handle,'',size,coord,&bytes_write ); SetConsoleCursorPosition(output_handle,coord); }
×
Report "Sudoku Game [c++]"
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
×
Sign In
Email
Password
Remember me
Forgot password?
Sign In
Our partners will collect data and use cookies for ad personalization and measurement.
Learn how we and our ad partner Google, collect and use data
.
Agree & close