Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program project1;
- uses
- crt, sysutils;
- var
- myBoard : Array[1..3,1..3] of string;
- response, name1, name2: string;
- textcol: integer;
- function Center(S: String): String;
- var
- i: integer;
- begin
- for i := 1 to (80 - Length(S)) div 2 do
- S := ' ' + S;
- end;
- procedure cwriteln(S: String);
- begin
- GotoXY((80 - Length(S)) div 2, WhereY);
- WriteLn(S);
- end;
- procedure header;
- begin
- textcolor(textcol);
- cwriteln(' _________ .___ __ ');
- cwriteln(' / _____/__ __ __| _/____ | | ____ __ ');
- cwriteln(' \_____ \| | \/ __ |/ _ \| |/ / | \ ');
- cwriteln(' / \ | / /_/ ( <_> ) <| | / ');
- cwriteln('/_______ /____/\____ |\____/|__|_ \____/ ');
- cwriteln(' \/ \/ \/ ');
- end;
- procedure instructions;
- begin
- clrscr;
- header;
- textcolor(textcol);
- cwriteln('The Classic Sudoku is a number placing puzzle based on a 9x9 grid');
- cwriteln('with several given numbers. The object is to place the numbers ');
- cwriteln('1 to 9 in the empty squares so that each row, each column and ');
- cwriteln('each 3x3 box contains the same number only once.');
- writeln;
- writeln;
- cwriteln('Press ''Enter'' to return to the menu');
- readln();
- end;
- procedure credits;
- begin
- clrscr;
- header;
- writeln;
- writeln;
- cwriteln('This game was brought to you by, Bailey Crouch and Thomas Gayner.');
- cwriteln('Copyright Disclaimer Under Section 107 of the Copyright Act');
- cwriteln('1976, allowance is made for "fair use" for purposes such as criticism,');
- cwriteln('comment, news reporting, teaching, scholarship, and research. Fair');
- cwriteln('use is a use permitted by copyright statute that might otherwise be');
- cwriteln('infringing. Non-profit, educational or personal use tips the balance');
- cwriteln('in favor of fair use.');
- writeln;
- writeln;
- cwriteln('Press ''Enter'' to return to the menu');
- readln();
- end;
- procedure textcolchange;
- begin
- ClrScr;
- header;
- writeln();
- cwriteln('Enter the code for the number that you would like to change the text to');
- writeln();
- cwriteln('1 - Blue 9 - Light Blue ');
- cwriteln('2 - Green 10 - Light Green ');
- cwriteln('3 - Cyan 11 - Light Cyan ');
- cwriteln('4 - Red 12 - Light Red ');
- cwriteln('5 - Magenta 13 - Light Magenta ');
- cwriteln('6 - Brown 14 - Yellow ');
- cwriteln('7 - White 15 - High-Intensity White ');
- cwriteln('8 - Grey ');
- readln(textcol);
- TextColor(textcol);
- end;
- Procedure menu;
- begin
- response:='m';
- while (response <> 'P') do
- begin
- ClrScr;
- header;
- writeln();
- cwriteln('Welocome to the Sudoku game!');
- cwriteln('----------------------------');
- CWriteLn('(P) Play Game ');
- CWriteLn('(R) Rules ');
- CWriteln('(A) Acknowledgements ');
- CWriteln('(T) Text Appearance ');
- response:= readkey;
- case response of
- 'R' : instructions;
- 'r' : instructions;
- 'A' : credits;
- 'a' : credits;
- 'T' : textcolchange;
- 't' : textcolchange;
- 'p' : response:='P';
- end;//case
- end;
- end;
- procedure drawboard;
- begin
- write(myBoard[1,1]); write('__');
- write(myBoard[1,2]); write('__');
- write(myBoard[1,3]); write('__');
- write(myBoard[1,4]); write('__');
- write(myBoard[1,5]); write('__');
- write(myBoard[1,6]); write('__');
- write(myBoard[1,7]); write('__');
- write(myBoard[1,8]); write('__');
- writeln(myBoard[1,9]);
- write(myBoard[2,1]); write('__');
- write(myBoard[2,2]); write('__');
- write(myBoard[2,3]); write('__');
- write(myBoard[2,4]); write('__');
- write(myBoard[2,5]); write('__');
- write(myBoard[2,6]); write('__');
- write(myBoard[2,7]); write('__');
- write(myBoard[2,8]); write('__');
- writeln(myBoard[2,9]);
- write(myBoard[3,1]); write('__');
- write(myBoard[3,2]); write('__');
- write(myBoard[3,3]); write('__');
- write(myBoard[3,4]); write('__');
- write(myBoard[3,5]); write('__');
- write(myBoard[3,6]); write('__');
- write(myBoard[3,7]); write('__');
- write(myBoard[3,8]); write('__');
- writeln(myBoard[3,9]);
- end;
- begin
- textcol:=(1);
- menu;
- clrscr;
- header;
- writeln('Welcome to Sudoku!');
- writeln;
- writeln;
- writeln('You are Player 1, please enter your name');
- readln(name1);
- writeln('Welcome, ', name1);
- readln();
- clrscr;
- header;
- writeln('You are Player 2, please enter your name');
- readln(name2);
- writeln('Welcome, ', name2);
- readln();
- clrscr;
- header;
- writeln(name1, '''s turn is first, please enter a number between 1 and 9 in the row of your reference');
- readln();
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement