'21 days' game added

git-svn-id: svn://kolibrios.org@5299 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
igevorse 2014-12-30 22:24:30 +00:00
parent a2cfd98d12
commit d6631a482a
15 changed files with 3798 additions and 0 deletions

339
programs/games/21days/COPYING Executable file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

5
programs/games/21days/Makefile Executable file
View File

@ -0,0 +1,5 @@
OUTFILE = 21days
OBJS = main.o game.o interface.o sys.o
CPPFLAGS += -Wno-write-strings -D _KOS32
include $(MENUETDEV)/makefiles/Makefile_for_cpp_program

View File

@ -0,0 +1,26 @@
OUTFILE = bin/21days
CXX = g++
OBJS = obj/main.o obj/game.o obj/interface.o obj/sys.o
CXXFLAGS = -Wno-write-strings
all: $(OUTFILE)
dirs:
test -d bin || mkdir -p bin
test -d obj || mkdir -p obj
$(OUTFILE): dirs $(OBJS)
$(CXX) -o $(OUTFILE) $(OBJS)
obj/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) $(OUTFILE)
rm -rf bin
rm -rf obj
rebuild: clean $(OUTFILE)
.PHONY: dirs clean rebuild

View File

@ -0,0 +1,27 @@
OUTFILE = bin\21days
CXX = g++
OBJS = obj/main.o obj/game.o obj/interface.o obj/sys.o
CXXFLAGS = -Wno-write-strings -D _WIN32
all: $(OUTFILE)
dirs:
if not exist "bin" mkdir bin
if not exist "obj" mkdir obj
$(OUTFILE): dirs $(OBJS)
$(CXX) -o $@ $(OBJS)
obj/%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
if exist "obj\*.o" del /Q obj\*.o
if exist "bin\21days.exe" del /Q bin\21days.exe
if exist "bin" rd bin
if exist "obj" rd obj
rebuild: clean $(OUTFILE)
.PHONY: dirs clean rebuild

79
programs/games/21days/README Executable file
View File

@ -0,0 +1,79 @@
# 21 days: a game for programmers
## Features
* You start as a helpdesker.
* Work in a big company.
* Join a startup and launch a popular game (or not).
* Study new courses.
* Help your friends to repair their computer.
* With the help of quantum spacetime folder you can do all of this in 21 days!
* Jump in time to change your choice and collect all achievements!
## License
21 days is licensed under GPL version 2.0. See COPYING in the same directory.
## Author
This program developed by Maxim Grishin (igevorse)
## Installation
This program does not require installation.
See "Run" section below.
## Run
Open your favourite file manager and run the executable file.
You can also use your shell:
* KolibriOS:
21days
* Windows:
cd bin
21days
* Linux (you have to use a terminal supporting IBM866 code page(CP866)):
cd bin
./21days
## Building from sources
If you want to build game from sources, you have to install GCC (Linux) and MinGW (Windows).
* KolibriOS
You have to install menuetlibc: see "Compilers GCC, G++." section at diamond.kolibrios.org/hll/hll_eng.htm.
To build a binary file for KolibriOS under Linux type in a terminal:
make
Binary file would appear in current directory.
* Linux
To build a Linux binary file:
make -f Makefile.linux
Binary files would appear in bin directory.
* Windows
To build a Windows binary file you have to install MinGW (http://sourceforge.net/projects/mingw/files/) with mingw32-base, mingw32-gcc and mingw-gcc-g++ packages.
Don't forget to add a path to a folder containing MinGW binary files to the Path environment variable ("C:\MinGW\bin" for me).
* If you don't have MSYS installed:
mingw32-make -f Makefile.win
* If you have MSYS installed:
make -f Makefile.linux
Binary files would appear in bin directory.
Have fun!

View File

@ -0,0 +1,7 @@
if tup.getconfig("NO_GCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
tup.include(HELPERDIR .. "/use_menuetlibc.lua")
CFLAGS = CFLAGS .. " -D _KOS32 "
compile_gcc{"main.cpp", "game.cpp", "interface.cpp", "sys.cpp"}
link_gcc("21days")

1584
programs/games/21days/game.cpp Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,345 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
#include "sys.h"
#ifndef _KOS32
#include <stdio.h> // printf()
#include <stdarg.h>
#define printf2 printf
#endif
#include <cstring> // strlen
#include <string>
using std::string;
char getAnswer(char a1, char a2) {
while(1) {
if (kbhit()) {
char ch = getch();
#ifdef _KOS32
if (ch == 0)
ch = getch();
#endif
if (ch == a1 || ch == a2)
return ch;
}
}
}
char getAnswer(char a1, char a2, char a3) {
while(1) {
if (kbhit()) {
char ch = getch();
#ifdef _KOS32
if (ch == 0)
ch = getch();
#endif
if (ch == a1 || ch == a2 || ch == a3)
return ch;
}
}
}
char getAnswer(char a1, char a2, char a3, char a4) {
while(1) {
if (kbhit()) {
char ch = getch();
#ifdef _KOS32
if (ch == 0)
ch = getch();
#endif
if (ch == a1 || ch == a2 || ch == a3 || ch == a4)
return ch;
}
}
}
void wait(char a = ENTER_KEY, char b = ENTER_KEY) {
getAnswer(a, b);
}
char getKey() {
#ifdef _KOS32
while(1) {
if (kbhit()) {
char ch = getch();
if (ch == 0)
ch = getch();
return ch;
}
}
#else
return getch();
#endif
}
void blankline(int line, int width) {
printf2("º ");
consoleGoto(line, width);
printf2("º\n");
}
void drawHBorder(int line, int left, int right, char l = 'É',
char c = 'Í', char r = '»', char e = '\n') {
consoleGoto(line, left);
printf2("%c", l);
for (int i = 0; i< right - left; i++)
printf2("%c", c);
consoleGoto(line, right);
printf2("%c%c", r, e);
}
void drawStringLine(int line, int left, int right, const char* str,
int pos = -1, char border = 'º', bool shadow = false) {
consoleGoto(line, left);
if (pos == -1)
printf2("%c %s", border, str);
else {
printf2("%c ", border);
consoleGoto(line, pos);
printf2("%s", str);
}
consoleGoto(line, right);
if (shadow)
printf2("%cÛ", border);
else
printf2("%c\n", border);
}
void drawModalWindow(const char* content, const char* title, const char* buttons) {
cls();
int winWidth, winHeight;
getWinWH(winWidth, winHeight);
int lines = winHeight/3;
int msgWidth = strlen(content)+2;
if (msgWidth >= winWidth-4)
msgWidth = winWidth-5;
int msgLeft = winWidth/2 - msgWidth/2;
int msgRight = winWidth/2 + msgWidth/2+1;
if (msgWidth%2!=0)
msgRight++;
int titleWidth = 0;
if (title != 0)
titleWidth = strlen(title)+2;
drawHBorder(lines, msgLeft, msgRight,'Õ','Í', '¸');
// title
if (title != 0) {
consoleGoto(lines, msgLeft+msgWidth/2-titleWidth/2);
printf2(" %s ", title);
}
lines++;
drawHBorder(lines, msgLeft, msgRight, '³',' ','³','Û');
lines++;
//======Splitting content into pieces=========================
int maxTextWidth = msgRight-msgLeft; // 2 borders + 2 spaces
int start = 0;
int len = strlen(content);
for (int i = 0; i < len; i++) {
if (content[i] == '\n') {
string tmp = content;
string t1 = tmp.substr(start, i-start+1);
drawStringLine(lines, msgLeft, msgRight, t1.c_str(), -1, '³', true);
start = i+1;
lines++;
}
else if (i - start >= maxTextWidth-3) {
string tmp = content;
string t1 = tmp.substr(start, i-start);
t1+="\n";
drawStringLine(lines, msgLeft, msgRight, t1.c_str(), -1, '³', true);
start = i;
lines++;
}
}
if (start != len) {
string tmp = content;
string t1 = tmp.substr(start, len-start);
drawStringLine(lines, msgLeft, msgRight, t1.c_str(), -1, '³', true);
lines++;
}
//===============================
drawHBorder(lines, msgLeft, msgRight, '³',' ','³','Û');
lines++;
consoleGoto(lines, msgLeft);
printf2("³");
if (!buttons) {
for (int q = 0; q< msgWidth/2-4;q++)
printf2(" ");
printf2("[Enter]");
for (int i = 0; i< msgWidth/2-2; i++)
printf2(" ");
}
else {
int buttonsLen = strlen(buttons);
for (int i = 0; i < msgWidth/2-buttonsLen/2; i++)
printf2(" ");
printf2("%s", buttons);
}
consoleGoto(lines, msgRight);
printf2("³Û");
lines++;
drawHBorder(lines, msgLeft, msgRight,'À', 'Ä', 'Ù','Û');
lines++;
consoleGoto(lines, msgLeft+1);
for (int i = 0; i< msgWidth+2; i++)
printf2("ß");
printf2(" ");
}
void drawWindow(string content, const char* title, string topline , string bottomline, bool usePagesForLongText = false) {
cls();
int winWidth, winHeight;
getWinWH(winWidth, winHeight);
#ifdef _WIN32
int deltaX = 0;
#else
int deltaX = 1;
#endif
// Total lines
#ifdef _WIN32
int lines = 0;
#else
int lines = 1;
#endif
// Top
drawHBorder(lines, deltaX, winWidth);
lines++;
if (topline != "") {
drawStringLine(lines, deltaX, winWidth, topline.c_str());
lines++;
}
// Title
if (title != 0) {
if (topline != "") {
blankline(lines, winWidth);
lines++;
}
drawStringLine(lines, deltaX, winWidth, title, (int)(winWidth/2.0-strlen(title)/2.0));
lines++;
blankline(lines, winWidth);
lines++;
}
//==========Splitting content into pieces=====================
int maxTextWidth = winWidth-4; // 2 borders + 2 spaces
int start = 0;
unsigned int i = 0;
// Let's split content into pieces if it too long or doesn't fit the screen
while (i < content.length()) {
if (usePagesForLongText && lines > winHeight-3) {
consoleGoto(lines, 0);
blankline(lines, winWidth);
lines++;
drawStringLine(lines, deltaX, winWidth, "<EFBFBD> ¦¬¨â¥ [Enter] ¤«ï ¯à®¤®«¦¥­¨ï...");
// Bottom line
drawHBorder(winHeight, deltaX, winWidth,'È','Í','¼');
wait();
// Print next page
cls();
lines = 0;
// Top line
drawHBorder(lines, deltaX, winWidth);
#ifdef _WIN32
lines = 1;
#else
lines = 2;
#endif
}
// Use <c> tag to place text in the center
if (content[i] == '<') {
// Checking for the <c> tag. <c> tag should be prepended with '\n'
if (i+2 < content.length()) {
if (content[i+1] == 'c' && content[i+2] == '>') {
// Tag found. Looking for the end of a string
int cLineEnd = content.length()-1;
for (unsigned int j = i; j < content.length(); j++)
if (content[j] == '\n') {
cLineEnd = j;
break;
}
int cLineWidth = cLineEnd - i-1;
drawStringLine(lines, deltaX, winWidth,
content.substr(i+3, cLineWidth-2).c_str(), winWidth/2-cLineWidth/2);
i = cLineEnd+1;
start = i;
lines++;
continue;
}
}
}
else if (content[i] == '\n') {
consoleGoto(lines, 0);
string t1 = content.substr(start, i-start+1);
drawStringLine(lines, deltaX, winWidth, t1.c_str());
start = i+1;
lines++;
}
else if ((int)i - start >= maxTextWidth-1) {
consoleGoto(lines, 0);
string t1 = content.substr(start, i-start);
t1+="\n";
drawStringLine(lines, deltaX, winWidth, t1.c_str());
start = i;
lines++;
}
i++;
}
if (start <= (int)content.length()) {
consoleGoto(lines, 0);
string t1 = content.substr(start, content.length()-start);
drawStringLine(lines, deltaX, winWidth, t1.c_str());
lines++;
}
//===============================
for (int i = lines; i< winHeight; i++) {
blankline(lines, winWidth);
lines++;
}
if (!bottomline.empty()) {
///Fix for long bottomline
if ((int)bottomline.length() >= winWidth) {
drawStringLine(winHeight-2, deltaX, winWidth, bottomline.substr(0, winWidth-4).c_str());
drawStringLine(winHeight-1, deltaX, winWidth, bottomline.substr(winWidth-4).c_str());
}
else {
drawStringLine(winHeight-1, deltaX, winWidth, bottomline.c_str());
}
}
// Bottom
drawHBorder(winHeight, deltaX, winWidth,'È','Í','¼');
}

View File

@ -0,0 +1,53 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
#ifndef H_INTERFACE
#define H_INTERFACE
#include <string>
char getAnswer(char a1, char a2);
char getAnswer(char a1, char a2, char a3);
char getAnswer(char a1, char a2, char a3, char a4);
char getKey();
void clearBuffer();
#ifdef _KOS32
using std::string;
string itos(int n);
string txt(string s, int d);
string txt(string s, string s2);
string txt(string s, string s2, string s3);
string txt(string s, char c);
string txt(string s, char ch, string s2);
string txt(string s, char ch, string s2, char ch2);
string txt(string s, int d1, int d2);
string txt(string s, int d1, int d2, int d3);
string txt(string s, int d1, int d2, int d3, int d4);
#else
std::string txt(const char* s, ...);
#endif
void wait(char a = ENTER_KEY, char b = ENTER_KEY);
void drawWindow(std::string content, const char* title = 0, std::string topline = "", std::string bottomline = "", bool usePagesForLongText = false);
void drawModalWindow(const char* content , const char* title = 0, const char* buttons = 0);
#endif

View File

@ -0,0 +1,91 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
* This file contains a part of file "/include/vector" from menuetlibc
* adapted to the developer's needs.
* Changes:
* 1. "*__cdecl" replaced with "* __attribute__((cdecl))" in order
* to compile a C++ project.
* 2. Added front() methods with the following code:
* T& front() {return data[0];}
* 3. Code reformatted
*
********************************************************************/
#ifndef KOS_VECTOR_H
#define KOS_VECTOR_H
extern void * __attribute__((cdecl)) operator new(size_t);
inline void * __attribute__((cdecl)) operator new(size_t, void *_P) {
return (_P);
}
template<class T> class vector21 {
unsigned length;
unsigned allocated;
T* data;
public:
typedef unsigned size_type;
typedef T* iterator;
vector21():length(0),allocated(0),data(NULL) {}
~vector21() {for (unsigned i=length;i--;)data[i].~T();free(data);}
unsigned size() const {return length;}
void clear() {length=0;}
T& operator[](unsigned pos) {return data[pos];}
T* begin() {return data;}
T* end() {return data+length;}
void push_back(const T& x) {
if (length==allocated){
allocated+=16;
data=(T*)realloc(data,allocated*sizeof(T));
}
new (data+length++) T(x);
}
bool empty() const {return length==0;}
void pop_back() {data[--length].~T();}
T& back() {return data[length-1];}
T& front() {return data[0];}
iterator erase(iterator it) {
T* a=it;
while (++a != data+length) {
a[-1] = *a;
}
length--;
return it;
}
/*iterator*/T* insert(iterator where, const T& what = T()) {
int z=where-data;
if (length==allocated) {
allocated+=16;
data=(T*)realloc(data,allocated*sizeof(T));
}
T* a=data+length;
T* b=data+z;
length++;
while (a != b) {
*a = a[-1];
--a;
}
*a = what;
return /*iterator*/a;
}
};
#endif

45
programs/games/21days/main.cpp Executable file
View File

@ -0,0 +1,45 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
#include "sys.h"
#ifndef _KOS32
#include <stdio.h> // printf()
#define printf2 printf
#endif
#include <stdlib.h> // srand()
#include <time.h> // time()
int showMainMenu();
int main() {
initConsole();
hideCursor();
srand(time(NULL));
showMainMenu();
showCursor();
#ifdef _KOS32
// Close console window and kill the main thread
con_exit(true);
kol_exit();
#endif
return 0;
}

204
programs/games/21days/pq.h Executable file
View File

@ -0,0 +1,204 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
#ifndef H_PQ
#define H_PQ
#define LETTER_RETURN_TO_DAY_21 100001
#define LETTER_WEBMASTER_CHECK_UNNAMEDSTUDIO 100002
#define LETTER_BORING_WORK 100003
#define LETTER_PERSISTENT_AND_PATIENT 100004
#define LETTER_BORING_DEFAULT_PATH 100005
#define LETTER_TEST_OF_KNOWLEDGE 100006
#define LETTER_KNOWLEDGE_QUESTION 100007
#ifdef _KOS32
#include "kos_vector.h"
#define vector vector21
#else
#include <vector>
#include <algorithm> // std::sort
#define printf2 printf
using std::vector;
#endif
enum Letter { LETTER_SHITCODE_1 = 0, LETTER_SHITCODE_2, LETTER_SHITCODE_3,
LETTER_BOTSMANN, LETTER_ASTRA, LETTER_UNNAMEDSTUDIO_1, LETTER_UNNAMEDSTUDIO_2,
LETTER_UNNAMEDSTUDIO_3, LETTER_UNNAMEDSTUDIO_4, LETTER_UNNAMEDSTUDIO_5,
LETTER_ANGRYBOSS_1, LETTER_ANGRYBOSS_2, NO_POPULARITY_HINT, LETTER_FINALPATH_DEF,
LETTER_FINALPATH_STARTUP, LETTER_FINALPATH_WORK, LETTER_FINALPATH_NOMONEY, LETTER_FINALPATH_NOPOPULARITY};
enum EventType { COURSE = 1000, SPECIAL_LETTER, MESSAGE, NEWS, INCREASEPOPULARITY,
CHANGEPATH, CHANGESALARY, CHANGESALARYFIRSTDAY, NOPOPULARITY};
class event {
public:
double time;
EventType type;
int idata;
event() : time(0.0), idata(-1) {}
event(double t,EventType ty, int data = -1) : time(t), type(ty), idata(data) {}
bool operator>(const event a) const {
return this->time > a.time;
}
bool operator<(const event ev) const {
return time < ev.time;
}
};
#ifdef _KOS32
static void exch (event* A, event* B) {
event t = *A;
*A = *B;
*B = t;
}
#endif
static void sort21(vector<event>* v, bool desc = false) {
#ifdef _KOS32
// Sorry for the bubble sort
for (unsigned int i = 0; i < v->size()-1; i++)
for (unsigned int j = 0; j < v->size()-i-1; j++) {
if (desc && (*v)[j] < (*v)[j+1])
exch(&((*v)[j]), &(*v)[j+1]);
else if (!desc && (*v)[j] > (*v)[j+1])
exch(&(*v)[j], &(*v)[j+1]);
}
#else
if (desc)
std::sort(v->begin(), v->end(), std::greater<event>());
else
std::sort(v->begin(), v->end());
#endif
}
class PQ3 {
private:
vector<event> v;
bool sorted;
public:
void sort() {
sort21(&v, true);
sorted = true;
}
PQ3() : sorted(false) {}
int n() {
return v.size();
}
bool empty() const {
return v.empty();
}
void insert(event item) {
v.push_back(item);
sorted = false;
}
event delMin() {
if (empty())
return event();
if (!sorted)
sort();
event e = v.back();
v.pop_back();
return e;
}
event* getMin() {
if (empty())
return 0;
if (!sorted)
sort();
return &v.back();
}
event* get(int i) {
if (empty() || i >= (int)v.size())
return 0;
if (!sorted)
sort();
return &v[i];
}
bool hasCourse(int c) {
for(unsigned int i = 0; i < v.size(); i++)
if (v[i].type == COURSE && v[i].idata == c)
return true;
return false;
}
bool hasCourses() {
for(unsigned int i = 0; i < v.size(); i++)
if (v[i].type == COURSE)
return true;
return false;
}
bool containsType(int et) {
for (int i = v.size()-1; i >= 0; i--)
if (v[i].type == et)
return true;
return false;
}
bool containsType(int et, int data) {
for (int i = v.size()-1; i >= 0; i--)
if (v[i].type == et && v[i].idata == data)
return true;
return false;
}
};
class Undo2 {
private:
vector<event> v;
public:
Undo2() {}
int n() {
return v.size();
}
bool empty() const {
return v.empty();
}
void insert(event item) {
if (item.type == MESSAGE)
return;
v.push_back(item);
}
event delMax() {
if (empty())
return event();
event e = v.back();
v.pop_back();
return e;
}
event getMax() {
if (empty())
return event();
return v.back();
}
event* get(int i) {
if (empty() || i >= (int)v.size())
return 0;
return &v[i];
}
void prepareForUndo() {
sort21(&v, false);
}
bool containsTypeBefore(EventType et, int data, long double t) {
for (unsigned int i = 0; i < v.size(); i++)
if (v[i].type == et && v[i].idata == data && v[i].time <= t)
return true;
return false;
}
};
#endif

540
programs/games/21days/strings.h Executable file
View File

@ -0,0 +1,540 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
#ifndef H_STRINGS
#define H_STRINGS
/*************************************************************************
* Messages from friends
*************************************************************************/
const unsigned int levelYesAnswerNumber = 10;
const char* levelYesAnswer[levelYesAnswerNumber] = {
"‚륧¦ î!",
"„ , ᥩç á 㤠«ñ­­® ᤥ« î.",
"<EFBFBD> §ë¢ ©  ¤à¥á.",
"“¦¥ ¥¤ã.",
"Š®ä¥ ¨ ¯¥ç¥­ìª¨ ¡ã¤ãâ? “¦¥ ¥¤ã!",
"Š®­¥ç­®!",
"„«ï ⥡ï - ¢ «î¡®¥ ¢à¥¬ï",
"Ÿ ª ª à § ᢮¡®¤¥­.",
"‡  ¬¨­ãâ ¤¥áïâì ᤥ« î.",
"<EFBFBD>¥§ ¯à®¡«¥¬."
};
const unsigned int levelNoAnswerNumber = 10;
const char* levelNoAnswer[levelNoAnswerNumber] = {
"<EFBFBD>à®áâ¨, ᥣ®¤­ï ­¥ ᬮ£ã.",
"<EFBFBD>¥, ï § ­ïâ.",
"Ÿ ­  à ¡®â¥ ¡¥§¢ë« §­®, ¯®§¢®­¨-ª  ç¥à¥§ ¬¥áïæ.",
"Š ª-­¨¡ã¤ì ¢ ¤à㣮© à §.",
"Ÿ ¯® á। ¬ ­¥ í­¨ª¥©áâ¢ãî.",
"Ÿ â ª®£® ­¥ 㬥î.",
"‚ë ®è¨¡«¨áì ­®¬¥à®¬ :D",
"’ë ªâ® ¢®®¡é¥?",
"<EFBFBD>¥ ¬®£ã, ¨§¢¨­¨.",
"<EFBFBD>¥â."
};
const unsigned int level1TasksNumber = 6;
const char* level1Task [level1TasksNumber] = {
"<EFBFBD>ਢ¥â! Œ®¦¥èì ¯®á¬®âà¥âì ¬®© ª®¬¯ìîâ¥à? Š ¦¥âáï, ã ¬¥­ï ­¥ à ¡®â ¥â %s.",
"<EFBFBD>¨£¤¥ ­¥ ¬®£ã â¥¡ï ­ ©â¨. “ ¬¥­ï âãâ %s ¡ à å«¨â, ¯¥à¥ãáâ ­®¢¨èì ¢¨­¤ã?",
"Š â áâà®ä ! <20> ¡®â  ¢áâ « ! <20>¥ à ¡®â ¥â %s. <20>®¬®¦¥èì?",
"‘«ãè ©, ã ¬®¥£® ¤à㣠 ­¥ à ¡®â ¥â %s, ­¥ §­ î, çâ® ¤¥« âì. ’ë ᢮¡®¤¥­?",
"‘âà ­­®, ­¥ § ¯ã᪠¥âáï %s, ¢áñ ¯¥à¥¯à®¡®¢ « - ­¨ç¥£® ­¥ ¯®¬®£ ¥â.",
"„ à®ä! Ÿ âãâ ª®ä¥ ­  ª®¬¯ ¯à®«¨«, ⥯¥àì %s ­¥ à ¡®â ¥â. ¬¥­ï ª®ä¥ ¨ ¯¥ç¥­ìª¨."
};
const unsigned int level1TaskWordNumber = 11;
const char* level1TaskWords[level1TaskWordNumber] = {
" ã¤¨®ª àâ ",
"¡«®ª ¯¨â ­¨ï",
"¡à ã§¥à",
"¢¨¤¥®ª àâ ",
"¦¥á⪨© ¤¨áª",
"ª« ¢¨ âãà ",
"¬®¤¥¬",
"¬®­¨â®à",
"¬ëèì",
"®¤¨­ ­ ãè­¨ª",
"¯à®¥ªâ®à"
};
const unsigned short programmingTaskNumber = 5;
const char* programmingTasks[programmingTaskNumber] = {
"<EFBFBD>ਢ¥â! Œ­¥ âãâ « ¡®à â®à­ãî ­ ¤® ­ ¯¨á âì ­  Pascal, ­¥ §­ î, ª ª®¬ã ®¡à â¨âìáï. “¬¥¥èì?",
" ã­¨¢¥à¥ § ¯ à¨«¨ á § ¤ ­¨ï¬¨ ­  Basic, ᤥ« ¥èì?",
"<EFBFBD>㦭  â¢®ï ¯®¬®éì, § ¢âà  á¤ ¢ âì « ¡®à â®à­ãî ­  Turbo Pascal,   ï ¢¯¥à¢ë¥ á«ëèã, çâ® íâ®. ‚ëàãç ©!",
"„ «¨ ­  à ¡®â¥ § ¤ ­¨¥... ¢§ï«, ­¥ ¯®á¬®â५,   â ¬ ­ ¤® ¯¨á âì ­  QBASIC,   ï ­¥ 㬥î. <20>®á®¢¥âã¥èì ª®£®?",
"‘«ëè «, âë ¯¨è¥èì ­  Pascal? “ ­ á âãâ ¯ à  ¯à®¥ªâ®¢ ­¥¤®¯¨á ­­ëå, ï ®â¢¥âá⢥­­®£® 祫®¢¥ª  ¨éã. <20> ¡®âë - ­  ¯ àã ç á®¢."
};
const unsigned short webProgrammingTaskNumber = 4;
const char* webProgrammingTasks[webProgrammingTaskNumber] = {
"<EFBFBD>ਢ¥â, âë á ©â ¬¨-¢¨§¨âª ¬¨ § ­¨¬ ¥èìáï? „¥«® ¥áâì.",
"‘«ãè ©, ­ è¥© ª®¬¯ ­¨¨ ­ã¦¥­ á ©â ¯® ¤¥èñ¢ª¥. <20>à®áâ® áâà ­¨æ  á ¨­ä®à¬ æ¨¥© ® ª®¬¯ ­¨¨. <20>â® ¦¥ ¯à®áâ® ¤«ï ⥡ï, ¤ ?",
" ­ è¥© á®æ. á¥â¨ ¯ àã ä¨è¥ª ¤®¤¥« âì ­ã¦­®, ¬­¥ â¥¡ï ¯®à¥ª®¬¥­¤®¢ «¨. <20> ¯¨è¨, ª ª ®á¢®¡®¤¨èìáï.",
"• ©, ¬ë âãâ ¡®«ì让 á ©â-¯®àâ « ¯¨è¥¬, ­ ¬ áà®ç­® ­ã¦¥­ ª®¤¥à ­  ¯ àã ¤­¥©. ƒ®ã?",
};
const unsigned short systemProgrammingTaskNumber = 3;
const char* systemProgrammingTask[systemProgrammingTaskNumber] = {
"‘«ëè « ®¡ Arduino? Œë âãâ ­   á¬¥ ¯¨è¥¬, ¯ à  § ¤ ­¨© ¥áâì.",
"Œ­¥ ᪠§ «¨, âë ­   á¬¥ ¯¨è¥èì? „ ¢­® äਫ ­á¥à  ¨é¥¬, à ¡®â  á ¬¨ªà®ª®­â஫«¥à ¬¨, ¤ã¬ î, ⥡¥ ¯®­à ¢¨âáï.",
"’ãâ ¨£àã ¤«ï ª®­ªãàá  ¯®¤ KolibriOS ­ ¤® ­ ¯¨á âì,   ï  á¬ ­¥ §­ î. <20> ¯¨è¥èì?"
};
const unsigned short adminTasksNumber = 4;
const char* adminTasks[adminTasksNumber] = {
"‘¥à¢¥à  ­®¢ë¥ § ¢¥§«¨, ­ áâà ¨¢ âì ­¥ª®¬ã. Ž¯« â¨¬ ¢¤¢®©­¥! <20>¥à¥§¢®­¨.",
"€ âë Apache + nginx ᬮ¦¥èì ¯®áâ ¢¨âì ¨ ­ áâநâì? <20>¥ á¯à è¨¢ ©, § ç¥¬ :).",
"<EFBFBD>¥ ¯®¢¥à¨èì, âãâ ¬ è¨­ã ¯à¨¢¥§«¨ ­  Windows Server 2003, çâ® ¤¥« âì á ­¥©, ­¥ §­ ¥¬. ‚ëàãç ©!",
"<EFBFBD>à®áâ¨â¥, ª ª ¬­¥ ¯à®¯ âç¨âì KDE2 ¯®¤ FreeBSD?"
};
const unsigned short mobileTaskNumber = 3;
const char* mobileTasks[mobileTaskNumber] = {
"Œë âãâ ࠧࠡ®âªã ­  Swift ¯à®¤¢¨£ ¥¬, ¬®¦¥èì ¯ àã ¤¥¬®ª ­ ¯¨á âì?",
"•®â¨¬ ­ ¯¨á âì ¬®¡¨«ì­®¥ ¯à¨«®¦¥­¨¥ ­  Java, £®¢®àïâ, ᥩç á íâ® ªàãâ®. ’ë 㬥¥èì?",
"’ãâ ­¨ªâ® ­  C++ ­¥ å®ç¥â ­ â¨¢­ë¥ ¯à¨«®¦¥­¨ï ¯®¤ Android ¤¥« âì, âë ¢®§ì¬¥èìáï?"
};
/*************************************************************************
* Courses
*************************************************************************/
const unsigned int coursesNumber = 8;
const char* courses[coursesNumber] = {
"<EFBFBD>­¨ª¥©á⢮",
"€§ë ¯à®£à ¬¬¨à®¢ ­¨ï",
"<EFBFBD>த¢¨­ã⮥ ¯à®£à ¬¬¨à®¢ ­¨¥:",
"<EFBFBD> §à ¡®âª  ¬®¡¨«ì­ëå ¯à¨«®¦¥­¨©",
"Žá­®¢ë ¤¨§ ©­ ",
"‘®§¤ ­¨¥ ᠩ⮢",
"‘¨á⥬­®¥ ¯à®£à ¬¬¨à®¢ ­¨¥",
"€¤¬¨­¨áâà¨à®¢ ­¨¥ á¥à¢¥à®¢",
};
bool coursesUnlocked[coursesNumber] = {1, 0, 0, 0, 0, 0, 0, 0};
const unsigned short advancedProgrammingCourses = 5;
char* advProgCourses[advancedProgrammingCourses] = {
"C++",
"Java",
"Assembler",
"C#",
"Delphi"
};
bool coursesFinished[coursesNumber] = {1, 0, 0, 0, 0, 0, 0, 0};
bool advProgCoursesFinished[advancedProgrammingCourses] = {0, 0, 0, 0, 0};
unsigned int learningTime[coursesNumber] = {0, 10, 80, 30, 45, 35, 45, 50}; // in days
unsigned int advProgLearningTime[advancedProgrammingCourses] = { 10, 10, 15, 10, 10}; // in days
int learningCost[coursesNumber] = {0, 100, 125, 100, 125, 120, 130, 120};
int advProgLearningCost[advancedProgrammingCourses] = {125, 120, 150, 123, 100};
unsigned short finishedCoursesCount = 1;
/*************************************************************************
* Probability of getting a message from friend related to course 0,
* 1, 2, etc. (courses). Prob. of getting a simple work is higher
* than getting a hard one.
*************************************************************************/
double probability[coursesNumber] = { 0.7, 0.5, 0.25, 0.6, 0.25, 0.4, 0.3, 0.4};
int taskReward[coursesNumber] = {2, 5, 10, 13, 19, 25, 30, 35};
int taskCount[coursesNumber] = {level1TasksNumber, programmingTaskNumber,
programmingTaskNumber, mobileTaskNumber, mobileTaskNumber,
webProgrammingTaskNumber, systemProgrammingTaskNumber, adminTasksNumber};
/*************************************************************************
* News
*************************************************************************/
const unsigned short newsCount = 4;
const char* news[newsCount] = {
"<EFBFBD>ணࠬ¬¨à®¢ ­¨¥ ­ ç¨­ ¥â § å¢ â뢠âì ¬¨à! ‘ª®à¥¥ ­ ç­¨â¥ ãç¨âìáï ¯à®£à ¬¬¨à®¢ ­¨î!\n",
"<EFBFBD>® ¨­ä®à¬ æ¨¨ á hh.ru ¢áª®à¥ ¯®¢ëá¨âáï á¯à®á ­  Java - ¯à®£à ¬¬¨á⮢\n",
"<EFBFBD>¥¢¥à®ïâ­®! ˆ­¤¨-¨£à  ®¤­®£® äà ­æã§áª®£® ࠧࠡ®â稪  Frappy Perd ¯®¡¨«  ¢á¥ ४®à¤ë ¨ ¯à¨­¥á«  ¥¬ã $50 000 ¢ ¯¥à¢ë© ¦¥ ¤¥­ì! <20> ¢¥à­®¥, ¢á¥ ᥩç á ª¨­ãâáï ¯¨á âì ᢮¨ ¬®¡¨«ì­ë¥ ¨£àë.\n",
"Ž¤­®§­ ç­®, ᥩç á à á梥⠨­¤¨-¨£à. Žç¥à¥¤­ ï ãá¯¥è­ ï ¨£à , ­  íâ®â à § ®â Unnamed Studio, ­  ¯¥à¢®¬ ¬¥á⥠¢ ⮯¥ ¨£à. “ ¨£àë 㦥 ¬¨««¨®­ë ä ­ â®¢ ¨ ¯®ª«®­­¨ª®¢, «î¤¨ ¯à®áâ® á室ïâ á 㬠!\n"
};
bool newsShowed[newsCount] = {0, 0, 0, 0};
/*************************************************************************
* Special letters
*************************************************************************/
const unsigned short specialLetterCount = 30;
const char* specialLetters[specialLetterCount] = {
"<EFBFBD>ਢ¥â. “ ­ á âãâ ¬¥£ ªàã⮩ ¯à®¥ªâ ­  C++ ¨ Java, ­¨ªâ® ­¥ ¡¥à¥âáï, ᤥ« ¥èì?",
"—â® íâ® â ª®¥? „  «ãçè¥ ¡ë ᮢᥬ ­¥ ¡à «áï. <20>â® ¦¥ £®¢­®ª®¤! ˆ¤¨-ª  ¯®ãç¨ C++,   § ®¤­® ¨ Java.",
"Ÿ á«ëè «, âë ¯à®£à ¬¬¨à®¢ ­¨¥¬ ­  Assembler § ­¨¬ ¥èìáï? ’ãâ á㯥àá«®¦­ë© ¬¨ªà®ª®­â஫«¥à ¥áâì ®¤¨­, ­¨ªâ® ­¥ ¡¥à¥âáï. ‚®§ì¬¥èìáï?",
"ˆ íâ® âë ­ §ë¢ ¥èì ¢ë¯®«­¥­­®© à ¡®â®©? „  ¬®© è¥á⨫¥â­¨© áë­ ­  Assembler «ãçè¥ ¯¨è¥â, 祬 âë! Šã¯¨ ª­¨£ã ¯® Asm, ­¥ ¯®§®àìáï.",
"<EFBFBD>ਢ¥â! Š ­ ¬ âãâ § ª § ¯®áâ㯨«, ­ã¦­® ï¤à® ¡ §ë ¤ ­­ëå ­  C# ­ ¯¨á âì. Œë á ¬¨ ­¥ ¬®¦¥¬ - ®ç¥­ì á«®¦­ë© ¯à®¥ªâ. “¬¥¥èì?",
"<EFBFBD>íí, ¤  âë ᮢᥬ, ®ª §ë¢ ¥âáï, ¯à®£à ¬¬¨à®¢ âì ­¥ 㬥¥èì. <20>ன¤¨ ¯ àã ªãàᮢ çâ®-«¨, ­¥ ¯®§®àìáï.",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n ‡¤à ¢áâ¢ã©â¥! <20> ¬ ¯®á®¢¥â®¢ «¨ ‚ á, ª ª ᯥ樠«¨áâ  ¢ ®¡« á⨠¯à®£à ¬¬¨à®¢ ­¨ï. Œë § ­¨¬ ¥¬áï ࠧࠡ®âª®© ¬®¡¨«ì­ëå ¯à¨«®¦¥­¨©, ¨ ᥩç á ¤¥«¨¬ àë­®ª á ŽŽŽ '€áâà '. „«ï § å¢ â  àë­ª  ­ ¬ ­ã¦­ë ¨­â¥à¥á­ë¥ «î¤¨ ¨ ª¢ «¨ä¨æ¨à®¢ ­­ë¥ ᯥ樠«¨áâë. Œë ¯à¥¤« £ ¥¬ ¨­â¥à¥á­ãî à ¡®âã ¨ ®ª« ¤ $800 ¢ ¬¥áïæ. <20>®¤ã¬ ©â¥, ¬ë á¢ï¦¥¬áï á ‚ ¬¨ ¯®§¦¥.",
"<EFBFBD>¨á쬮 ®â ŽŽŽ '€áâà '<astra@botsmann.com>\n „®¡àë© ¤¥­ì! Œë - ª®¬ ­¤  ࠧࠡ®â稪®¢ ¬®¡¨«ì­ëå ¯à¨«®¦¥­¨©, ã ­ á ¥áâì £¥­¨ «ì­ë¥ ¨¤¥¨ ¨ ¬ë å®â¨¬ ¨§¬¥­¨âì ¬¨à! Œë ¨é¥¬ â « ­â«¨¢ëå ࠧࠡ®â稪®¢ ¨ ¯à¥¤« £ ¥¬ $1000 ¢ ¬¥áïæ. <20> ¬ ­ã¦¥­ ⢮© áà®ç­ë© ®â¢¥â, âë á ­ ¬¨?",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n Š ᮦ «¥­¨î, ¢ë ­¥ ®¯à ¢¤ «¨ ­ è¨å ­ ¤¥¦¤. <20>â® ­ è¨ HR-ᯥ樠«¨áâë ®â¯à ¢¨«¨ ¢ ¬ ¯¨á쬮 ®â ¨¬¥­¨ ­ è¨å ª®­ªã७⮢. <20> ¬ ­¥ ­ã¦­ë «î¤¨, £®â®¢ë¥ ã©â¨ ¢ ¤àã£ãî ª®¬¯ ­¨î ¨§-§  $200.",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n ‡¤à ¢áâ¢ã©â¥! ˆ§¢¨­¨â¥, íâ® ­ è¨ HR-ᯥ樠«¨áâë ®â¯à ¢¨«¨ ‚ ¬ ¯¨á쬮 ®â ¨¬¥­¨ ­ è¨å ª®­ªã७⮢ ¢ ª ç¥á⢥ ¯à®¢¥àª¨. Œë à¥è¨«¨, çâ® ¢ë ­ ¬ ¯®¤å®¤¨â¥! …᫨ ‚ë ¥é¥ ­¥ ¯¨á «¨ ¯®¤ ¬®¡¨«ì­ë¥ ¯« âä®à¬ë, ¬ë ‚ á ­ ã稬.",
"•í©, ¯à¨¢¥â! Œë - ¬®«®¤ ï ª®¬ ­¤  ¯®¤ ­ §¢ ­¨¥¬ Unnamed Studio ¨ ¬ë ®ç¥­ì «î¡¨¬ ¨£à âì,   â ª¦¥ ᮧ¤ ¢ âì ¨£àë. Œë ¢¨¤¥«¨ ⢮¨ à ¡®âë, ®­¨ ॠ«ì­® ªàãâë¥! ®â«¨ç¨¥ ®â ªà㯭ëå ª®¬¯ ­¨© ã ­ á ¬¥­ìè¥ ª®­âà®«ï ¨ ¡®«ìè¥ ¢®§¬®¦­®á⥩ ¤«ï á ¬®à¥ «¨§ æ¨¨. Œë ¢áñ à ááç¨â «¨, ¨ 㦥 ᪨­ã«¨áì. â¥¡ï ¯®ª  ¤¥­¥£ ¡à âì ­¥ ¡ã¤¥¬, ®áâ ¢¨¬ ­  ä®àá-¬ ¦®à. <20>® ã ­ á ¦¥ ¢áñ ¡ã¤¥â £« ¤ª®, ¢¥à­®? <20>®«ìè¥ âà â ­¥ ¯à¥¤¢¨¤¨âáï. ‘®®¡é¨, ¥á«¨ ᮣ« á¥­. ",
/*11*/ "<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n ‘«ãè ©, ï â¥à¯¥« ¢áñ íâ® ¢à¥¬ï, ­® ¢á¥¬ã ¥áâì ¯à¥¤¥«. ’ë ®â¢«¥ª ¥èìáï ®â ®á­®¢­®© à ¡®âë ­  äਫ ­á ¨ ¯®¤à ¡®âªã. ’ë ®¯à¥¤¥«¨áì, ç⮠⥡¥ ¡®«ìè¥ ¯® ¤ãè¥ ¨ ¡à®á © íâ®â äਫ ­á. <20> ¡®âã ­ ¤® ¤¥« âì ª ç¥á⢥­­®. \n‘ªãç­® ­  à ¡®â¥? Ÿ ¯®¤­¨¬ã ®ª« ¤ ¤® $1200 ¨ ¯®è«î â¥¡ï ­  ¤®¯®«­¨â¥«ì­ë¥ ªãàáë. <20>ã, ¯à®¤®«¦ ¥¬ à ¡®â âì?",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n Ÿ â¥¡ï ¯à¥¤ã¯à¥¦¤ «: ª®­æ¥­âà¨àã©áï ­  à ¡®â¥! „㬠«, ï ­¥ 㧭 î ® ⢮¥© ¯®¤à ¡®âª¥?! ’ë 㢮«¥­!",
"Œë à ¤ë, çâ® âë ¯à¨á®¥¤¨­¨«áï ª ­ ¬, ⥯¥àì âë ç«¥­ ª®¬ ­¤ë Unnamed Studio! ‘¥©ç á à ¡®â  ¯®©¤ñâ à §  ¢ âਠ¡ëáâ॥! <20> § âë á ­ ¬¨, ­ ¤® ¡ë ­ ãç¨âìáï à¨á®¢ âì. ",
"’¢®¨ à ¡®âë ¯à®áâ® ¢¯¥ç â«ïîâ! <20>â® ­¥ ¯à®áâ® ¬®¨ á«®¢ , ¢á¥ ॡïâ  ¢ Unnamed Studio â ª ¤ã¬ îâ! ...§­ ¥èì, ã ­ á âã⠯஡«¥¬ . <20> è ¢â®à®© ¯à®£à ¬¬¨á⠯ய¨« ç áâì ¤¥­¥£ ¨§ ä®­¤ , ¤® ५¨§  ­¨ª ª ­¥ 墠â¨â ⥯¥àì :(. Œë ᮡ¨à ¥¬ ¯® $%d. Ž¡¥é î, íâ® ¢ ¯®á«¥¤­¨© à §! ‡  ¨¤¥î!",
"<EFBFBD>¨á쬮 ®â Unnamed Studio:\n Š â áâà®ä ! —¥à¥§ 40 ¤­¥© ५¨§,   ã ­ á á ©â  ¤® á¨å ¯®à ­¥â! Œë ¨§­ ç «ì­® ª ª-â® ¨ ­¥ ¤ã¬ «¨ ®¡ í⮬, ⮫쪮 ᥩç á 㧭 «¨, çâ® íâ® - ¢ ¦­ ï ç áâì ४« ¬ë. ",
"<EFBFBD>¨á쬮 ®â Unnamed Studio:\n —â®? <20>¥à¥®æ¥­¨« ᥡï? ’ë £®¢®à¨«, ãᯥ¥èì ᤥ« âì á ©â ¢®¢à¥¬ï! ˆ§-§  â¥¡ï ¢áñ ¯®è«® ª ç¥àâï¬, ¬ë ¬®£«¨ ¡ë ¢ëàãç¨âì ¢ 1000 à § ¡®«ìè¥! ‚®â ⢮¨ $1000 ¨§ ®¡é¥£® ¤®å®¤  ¨ 㡨ࠩáï!",
"<EFBFBD>¨á쬮 ®â Unnamed Studio:\n —㢠ª, âë ᬮâ५ ­®¢®áâ¨? <20>Ž ‚ˆ„…‹?! „  ­ èã ¨£àã à á墠â뢠îâ, ª ª £®àï稥 ¯¨à®¦ª¨! <20>â® ãᯥå! <20>â® á« ¢ ! Ÿ âãâ ¤® ¯®â®«ª  ¯à룠î! <20>¥à¥¢®¦ã ⥡¥ $200 000 - â¢®ï ¤®«ï. ’¥¯¥àì ¯à®¥ªâ § ¢¥àèñ­, ¬ë ¢á¥ ¢ ®â¯ã᪠! ˆ ⥡¥ ­ ¤® ®â¤®å­ãâì. ‹®¢¨ ª ©ä.",
"‘ªãç­®? € âë çâ® ¤ã¬ «! <20>  à ¡®â¥ ᨤïâ ¨ § à ¡ â뢠îâ ¤¥­ì£¨, í⮠⥡¥ ­¥ íªè¥­. …᫨ ­ã¦­ë ¤¥­ì£¨ - ¯à®¤®«¦ © à ¡®â âì, ­® ¤ «ìè¥ ã¦¥ ­¨ç¥£® ¨­â¥à¥á­®£® ­¥ ¡ã¤¥â. Œ¨««¨®­ âë â ª, ª®­¥ç­®, ­¥ § à ¡®â ¥èì, ­® ¯®¤ª®¯¨âì ¤¥­¥£ ­  ¯ àã ¯à릪®¢ ¢® ¢à¥¬¥­¨ ¬®¦­®.",
"‘ªãç­®, ¤ ? Š®­¥ç­®, ®â á ¬ëå ¨­â¥à¥á­ëå ¯à¥¤«®¦¥­¨© ® à ¡®â¥ âë ®âª § «áï,   ­®¢ëå 㦥 ­¥ ¡ã¤¥â. —â®, ­¥à¥ «¨áâ¨ç­®? ¦¨§­¨ ­¥ ¢á¥¬ ª ¦¤ë© ¤¥­ì ¯à¥¤« £ îâ à ¡®âã. „ , ¡ã¤¥èì ¯¥à¥¡¨¢ âìáï §¢®­ª ¬¨ §­ ª®¬ëå ¨ ¯¥à¥ãáâ ­ ¢«¨¢ âì ¨¬ ¢¨­¤ã. ˆ ªãàᮢ ­®¢ëå ⮦¥ ­¥ ¡ã¤¥â, § ç¥¬ ®­¨ ⥡¥, ¥á«¨ ¢áñ à ¢­® âë ⮫쪮 <20><>ˆŠ…‰™ˆŠ. <20>å, ¡ë«® ¡ë ªàãâ®, ¥á«¨ ¡ë ¬®¦­® ¡ë«® ¢áñ ®â¬®â âì ­ § ¤ ¨ ®¤­ ¦¤ë ᤥ« âì ¤à㣮© ¢ë¡®à!",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n ‡¤à ¢áâ¢ã©. ‘®¢¥â ¤¨à¥ªâ®à®¢ à¥è¨« âà â¨âì ¬¥­ìè¥ á।á⢠­  ¤®¯®«­¨â¥«ì­®¥ ®¡ã祭¨¥ ­®¢ëå à ¡®â­¨ª®¢. ’ ª¦¥ ᮪à é ¥¬ à áå®¤ë ­  ¯à®¢¥àªã §­ ­¨© ®¯ëâ­ëå á®âà㤭¨ª®¢. <20>¥è¨«¨ ®¡ê¥¤¨­¨âì íâ® ¢áñ ¢ ®¤­®. ’ë §­ ¥èì, ¬ë ᥩç á ¡ãª¢ «ì­® ­  ¢áñ¬ íª®­®¬¨¬. ®¡é¥¬, à¥è¥­®, çâ® 'áâ à襥' ¯®ª®«¥­¨¥ ¡ã¤¥â ¯¥à¥¤ ¢ âì ®¯ëâ '¬« ¤è¥¬ã'. ’ë 㦥 ãᯥ« § à¥ª®¬¥­¤®¢ âì á¥¡ï ª ª ®¯ëâ­ë© á®âà㤭¨ª, â ª ç⮠⥡¥ ¯®àãç ¥âáï ­ ¯ãâá⢮¢ âì Junior'®¢ ¨ ®â¢¥ç âì ­  ¢á¥ ¨å £«ã¯ë¥ ¢®¯à®áë. <20>¥ ¡¥á¯« â­®, ª®­¥ç­®. ‡  ª ¦¤ë¥ 5 ¯à ¢¨«ì­ëå ®â¢¥â®¢ ¬ë ­ ç¨á«ï¥¬ ¯à¥¬¨î. € ¥á«¨ ­ ¡¥à¥èì 5 ­¥¯à ¢¨«ì­ëå, â® áç¨â ¥¬, çâ® ¯à®¢¥àªã §­ ­¨© ­¥ ¯à®èñ«, ¨ ⮣¤  ¬¥áâ® ®á¢®¡®¦¤ ¥èì. Ÿ ¢ ⥡¥ ­¥ ᮬ­¥¢ îáì, ¯à®áâ® ¤®«¦¥­ ¡ë« ⥡¥ à á᪠§ âì ® ­®¢®¬ à¥è¥­¨¨. Ÿ-â® §­ î, çâ® âë á¯à ¢¨èìáï!",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n Š ª ¨ ®¡¥é «, â¢®ï ¯à¥¬¨ï §  ¯à ¢¨«ì­ë¥ ®â¢¥âë: $400",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n ’ë ­¥ ¯à®èñ« ¯à®¢¥àªã §­ ­¨©. <20>ã çâ® ¦¥ âë â ª, ï ¢ ⥡¥ ­¥ ᮬ­¥¢ «áï! € âë, ®ª §ë¢ ¥âáï, ¯à®áâ® ¬¥áâ® ­  à ¡®â¥ ¯à®á¨¦¨¢ ¥èì. •®âì âë ¬­¥ ¨ ¯®­à ¢¨«áï, ­® 㢮«¨âì ï â¥¡ï ®¡ï§ ­. <20>¥§ ®¡¨¤.",
"<EFBFBD>¨á쬮 ®â ŽŽŽ 'Botsmann'<corp@botsmann.com>\n Š ª ï ¨ ¤ã¬ «, íâã áâà ­­ãî ¯à®æ¥¤ãà㠯஢¥àª¨ §­ ­¨© ®â¬¥­¨«¨: Junior'ë ᮢᥬ ®¡­ £«¥«¨, á ¬¨ ­¨ç¥¬ã ãç¨âìáï ­¥ å®âïâ, ⮫쪮 á¯à è¨¢ îâ ã áâ àè¨å. <20>« â¨âì ®¯ëâ­ë¬ á®âà㤭¨ª ¬ §  ᮢ¥âë ®ª § «®áì ­¥¢ë£®¤­®. ®¡é¥¬, ⥯¥àì ¬®¦¥èì ᯮª®©­® à ¡®â âì, ­¨ªâ® â¥¡ï ®â¢«¥ª âì ­¥ ¡ã¤¥â.",
"‘«ãè ©, ¤  íâ® ¦¥ ¯à®áâ® ¨¤¥ «ì­ë© ª®¤! <20>¥ ¯®¢¥à¨« ¡ë, çâ® âë §  %d ¤­¥© ­ ã稫áï í⮬ã! “ ⥡ï ᪮«ìª® ç á®¢ ¢ áã⪠å? „¥à¦¨ ᢮¨ $%d, § á«ã¦¨«.",
"<EFBFBD>¨á쬮 ®â Andrew Johnson <andrew@botsmann.com>\n •í©, ç㢠ª, ï ¨§ á®á¥¤­¥£® ®â¤¥« . Œ­¥ ¡®áá ⮦¥ ãáâà ¨¢ « ¯à®¢¥àªã ¨ âë ¯à ¢¨«ì­® ¤¥« ¥èì, çâ® ­¥ äਫ ­á¨èì ­  áâ®à®­¥. <20>®, ¯®¢¥àì, ⢮© ⥫¥ä®­ ­  ¯à®á«ã誥,   â ¬ ¢áñ ¥éñ ¥áâì ­¥¯à®ç¨â ­­ë¥ ¯¨á쬠. <20>ë«® ¡ë «ãçè¥ ¨§¡ ¢¨âìáï ®â ­¨å,   â® ¡®áá ¬®¦¥â ¯®¤ã¬ âì, çâ® âë ¢áñ ¥é¥ ¯®¤¤¥à¦¨¢ ¥èì ª®­â ªâ á ¤à㣨¬¨ § ª §ç¨ª ¬¨.",
/*un2 var1*/ "’ë ¯®­¨¬ ¥èì, ­ á ¬ «®, ¢á¥ § £à㦥­ë... „¥­¥£ ­¥â, ¯®í⮬㠯®¬®çì ¬®¦¥¬ ⮫쪮 ᮢ¥â®¬: ¡ë«® ¡ë ­¥¯«®å® ¯à®©â¨ ª ª®©-­¨¡ã¤ì ªãàá ®¡ ®á­®¢ å ¤¨§ ©­ .",
/*un2 var2*/ "—â®? “¦¥ 㬥¥èì? Š ª ¦¥ ­ ¬ á ⮡®© ¯®¢¥§«®! Žª¥©, ⮣¤  âë §­ ¥èì, çâ® ¤¥« âì. Œë ­¥ ¡ã¤¥¬ ®£à ­¨ç¨¢ âì ⢮î ä ­â §¨î.",
/*un4 var1*/ "Œë à¥è¨«¨ ᪨­ãâìáï ¯® $%d ­  ¢¥¡-¬ áâ¥à , ¢¥¤ì ¢á¥ ­ è¨ ¯à®£¥àë § ­ïâë.",
/*un4 var2*/ "<EFBFBD>® ⥡¥ áࠧ㠢¨¤­®, çâ® âë ⮫ª®¢ë© ᯥ樠«¨áâ. „㬠î, ᮧ¤ ­¨¥ ᠩ⮢ ¤«ï ⥡ï - áã騩 ¯ãáâïª."
};
bool unnamedStudioLettersSent[3] = {0,0,0,};
bool knowledgeLetterSent = false;
short nextKnowledgeLetterIndex = 0;
short klowledgeCorrectAnswers = 0;
short klowledgeUncorrectAnswers = 0;
const unsigned short knowledgeQuestionsCount = 10*3;
const char* knowledgeCheck[knowledgeQuestionsCount] = {
"Ÿ âãâ ¢®®¡é¥ ­®¢¨ç®ª, ª ª®© ï§ëª ¯à®£à ¬¬¨à®¢ ­¨ï «ãçè¥, C++ ¨«¨ Delphi?", "<EFBFBD>â® § ¢¨á¨â ®â ¯®áâ ¢«¥­­®© § ¤ ç¨", "Š®­¥ç­® C++, ­  Delphi 㦥 ­¨ªâ® ­¥ ¯¨è¥â",
"Œ­¥ âãâ ®¤¨­ ¨§ ¯à®£à ¬¬¨á⮢ ᪠§ «, çâ® èã⪠ ¯à® UDP ­¥ ¤®è« ...çâ® ®­ ¨¬¥« ¢ ¢¨¤ã?", "UDP - íâ® ¯à®â®ª®«, ­¥ £ à ­â¨àãî騩 ¤®áâ ¢ªã ¯ ª¥â®¢.", "UDP - ­ ¤ñ¦­ë© ¯à®â®ª®«, £ à ­â¨àãî騩 ¤®áâ ¢ªã ¤ ­­ëå, ¢ í⮬ ¨ èã⪠.",
"Œ­¥ § ¤ ­¨¥ ¤ «¨, á ©â ­  C++ ­ ¯¨á âì, íâ® ¢®®¡é¥ ¢®§¬®¦­® ¨«¨ ®­¨ ¯à®áâ® ¨§¤¥¢ îâáï ­ ¤ ­®¢¨çª®¬?", " ¯à¨­æ¨¯¥, ­¥ ¢ ¦­®, ­  ª ª®© ï§ëª¥ £¥­¥à¨à®¢ âì HTML-áâà ­¨æë.", "<EFBFBD>¥â, íâ® ¯à¨ª®«. ‘ ©âë ¯¨èãâ ­  PHP, Python, ASP.Net ¨ ¤à㣨å",
"Œë âãâ ¯®á¯®à¨«¨, ï £®¢®àî, çâ® á ¨á¯®«ì§®¢ ­¨¥¬ JavaScipt á ©âë ¯¨èãâáï,   ­¥ ­  Java. Java - ¤«ï ¬®¡¨«ì­ëå ¯à¨«®¦¥­¨©. ‚¥à­®?", "’ë ¯à®¨£à «.", "<EFBFBD>ã ¤ , ¯®ç⨠¢á¥ ¯à¨«®¦¥­¨ï ¤«ï ⢮¥£® €­¤à®¨¤  ­  Java ­ ¯¨á ­ë ¢¥¤ì.",
"Š®««¥£  ­  ¯¥à¥ªãॠ᪠§ «, çâ® ®­ ¤® à ¡®âë ¢ ­ è¥© ª®¬¯ ­¨¨ § à ¡ â뢠« ­  opensource-¯à®¥ªâ å. <20>â® ¢®§¬®¦­®?","„ , ®­ ¬®£ § ­¨¬ âìáï ¯« â­®© ¯®¤¤¥à¦ª®©.", "• , ¯®¢ñ«áï!. Opensource-¯à®¥ªâë ¦¥ ¡¥á¯« â­ë¥.",
"<EFBFBD> §£à¥¡ î ª®¤ ®¤­®£® ¯à®¥ªâ  ¯®¤ iOS. <20>¨ª ª ­¥ ¯®©¬ã, ¢ 祬 à §­¨æ  ¬¥¦¤ã #include ¨ #import?", "#import £ à ­â¨àã¥â, çâ® ä ©« ¡ã¤¥â ¢ª«îçñ­ ®¤¨­ à §, ¢ ®â«¨ç¨¥ ®â #include", "’ë ¯ãâ ¥èì, #include ¨á¯®«ì§ã¥âáï ¢ ª®¤¥ ­  C,   'import' - ¢  áᥬ¡«¥à­ëå ¢áâ ¢ª å.",
"‘®¡¨à îáì ¯¨á âì ¯à®¥ªâ ­  Ruby on Rails. ‘«ëè «, íâ®â ï§ëª ¨­â¥à¯à¥â¨àã¥¬ë© ¨ ¢ë᮪®ã஢­¥¢ë©, íâ® â ª?","•¬... „  íâ® ¨ ­¥ ï§ëª ¢®¢á¥,   ä३¬¢®àª.", "<EFBFBD>¥â, íâ® ª®¬¯¨«¨àã¥¬ë© ï§ëª,   ­¥ ¨­â¥à¯à¥â¨à㥬ë©.",
"Ÿ ⥯¥àì ¡ã¤ã ¯¨á âì ¯®¤ Linux, ¬®¦­® ¥£® ¯®áâ ¢¨âì ­  NTFS-à §¤¥«? <20>¬ã«ïæ¨î live cd ­¥ ¯à¥¤« £ âì.", "<EFBFBD>¥â, ï¤à® á ­¥£® § £à㧨âìáï ­¥ ᬮ¦¥â.", " ¯à¨­æ¨¯¥, ¤ , ­® ­ã¦­® ¯ âç¨âì ï¤à®, áâ ¢¨âì ¤®¯®«­¨â¥«ì­ë¥ ã⨫¨âë... ®­® ⥡¥ ­ ¤®?",
"‚ç¥à  ¯®§¢®­¨«¨ ¨§ ª®¬¯ ­¨¨ ª®­ªã७⮢, ᪠§ «¨, çâ® ¯¨èãâ ­  ®¡à¥§ ­­®¬ PHP ¡¥§ ŽŽ<C5BD> ¨ eval(). <20>।« £ «¨ à ¡®âã, ï ®âª § «. <20>à ¢¨«ì­® ᤥ« «? ", "<EFBFBD>®§¤à ¢«ïî, íâ® ¡ë«  ª®¬¯ ­¨ï '‚ª®­â ªâ¥'.", "<EFBFBD>à ¢¨«ì­®, ­  í⮬ ¦¥ ­¥¢®§¬®¦­® ­¨ç¥£® áâ®ï饣® ­ ¯¨á âì",
"‡ å®¦ã ­  㤠«ñ­­ë© á¥à¢¥à, ­ã¦­® 㧭 âì, ᪮«ìª® áâப ¢ ä ©«¥ log.txt. € â ¬, ª ª ­ §«®, Linux ¨ ⮫쪮 ª®­á®«ì...—â® ¢¢®¤¨âì?", "wc -l log.txt", "ls -l log.txt"
};
/*************************************************************************
* Tips for users when waiting for an input
*************************************************************************/
const char* ae_advanced_courses = "—â® ¢ë ¢¢®¤¨â¥? „«ï ⮣®, çâ®¡ë ¢ë¡à âì ®¤¨­ ¨§ '¯à®¤¢¨­ãâëå' ªãàᮢ, ­ ¦¬¨â¥ ª« ¢¨è¨ 'a'-'e'";
const char* bottomLineCourses = "Šãàáë[C] ";
const char* bottomLineMsgAchieves = "‘®®¡é¥­¨ï[M] „®á⨦¥­¨ï[A] <20>à릮ª ¢ ¯à®è«®¥[U] ";
const char* bottomLineSpeedAndExit = "‘ª®à®áâì[S] ‚ë©â¨[Esc]\n";
const char* changeSpeedButtons = "ˆ§¬¥­¨âì[+][-] <20>ਭïâì[Y]";
const char* enter = "<EFBFBD> ¦¬¨â¥ [Enter] ¤«ï ¯à®¤®«¦¥­¨ï...";
const char* escToBreakReading = ", ¯à¥à¢ âì ç⥭¨¥ [Esc]";
const char* number_or_enter = "‚¢¥¤¨â¥ ­®¬¥à ªãàá  ¨«¨ [Enter] çâ®¡ë ¢ë©â¨";
const char* one_or_two = "‚ à¨ ­âë ®â¢¥â®¢: [1] ¨«¨ [2]";
const char* one_two_or_three = "‚ à¨ ­âë ®â¢¥â®¢: [1], [2] ¨«¨ [3]";
const char* pressF = "<EFBFBD> ¦¬¨â¥ [F] ¤«ï ¯à®¤®«¦¥­¨ï...";
const char* pressP = "<EFBFBD> ¦¬¨â¥ [P] ¤«ï ¯à®¤®«¦¥­¨ï...";
const char* yesNoDialog = "„ [Y] <20>¥â[N]";
/*************************************************************************
* Windows' title
*************************************************************************/
const char* achievementsTitle = "„®á⨦¥­¨ï";
const char* breaking_news = "Œ¨à®¢ë¥ ­®¢®áâ¨";
const char* changeSpeedTitle = "‘ª®à®áâì ¨£àë";
const char* coursesTitle = "Šãàáë";
const char* courseAlreadyPassed = "Šãàá 㦥 ¯à®©¤¥­!";
const char* finalCard = "ŠŽ<EFBFBD>";
const char* gameOverTitle = "‚ë ¯à®¨£à «¨!";
const char* introTitle = "‚áâ㯫¥­¨¥";
const char* new_letter = "<EFBFBD>®¢®¥ ¯¨á쬮";
const char* newAchievement = "<EFBFBD>®¢®¥ ¤®á⨦¥­¨¥!";
const char* notEnoughMoney = "“ ¢ á ­¥¤®áâ â®ç­® á।á⢠:(";
const char* playerStatsTitle = "‘â â¨á⨪  ¨£à®ª \n\n\n";
const char* unread_message = "<EFBFBD>¥¯à®ç¨â ­­®¥ á®®¡é¥­¨¥";
/*************************************************************************
* Windows' text
*************************************************************************/
const char* coursesFinishedText = "\nŠãàᮢ ¯à®©¤¥­®: %d/%d\n \n";
const char* finalCardsUnlockedText = "\nŠ®­æ®¢®ª ®âªàëâ®: %d/%d\n";
const char* gameName = "21 days";
const char* gameOverText = "\n<c><3E>â® ¡ë« ¥¤¨­á⢥­­ë© ᯮᮡ ¯à®¨£à âì, ¨ ¢ë ­ è«¨ ¥£®!\n<c><3E>  ¥¤ã ¤¥­¥£ ­¥â, ¢ è  ९ãâ æ¨ï â ª ­¨§ª , çâ® ­¨ªâ® ­¥ §¢®­¨â ¨ ­¥ ¯à¥¤« £ ¥â à ¡®âã.\n\n<c>Š®­¥æ!\n";
const char* helpDesker = "í­¨ª¥©é¨ª";
const char* mainMenuText = "\n\n<c>1.<2E>®¢ ï ¨£à \n\n<c>2.‚ë室\n";
const char* noCurrentCurses = "\t‚ë ­¨ç¥¬ã ­¥ ®¡ãç ¥â¥áì...\n";
const char* playerStatsEnd = "\n\n<c><3E>¥ § ¡ã¤ì⥠¯®¤¥«¨âìáï áªà¨­è®â®¬ áâ â¨á⨪¨ á ¤àã§ìﬨ!\n\n<c><3E> ¦¬¨â¥ [Esc] ¤«ï ¢ë室 .\n";
const char* playerStatus = "‚ è áâ âãá: ";
const char* pseudoEqual = "Í";
const char* selectCourseText = "‚ë¡¥à¨â¥ ®¤­ã ¨§ á«¥¤ãîé¨å ª â¥£®à¨©, ª®â®à®© ¢ë ¡ë å®â¥«¨ ­ ãç¨âìáï:\n";
const char* startupper = "áâ àâ ¯¥à";
const char* takeCourseCost = ", ¯à®©â¨ ªãàá: $%d\n";
const char* takingThisCourse = "\t‚ë ᥩç á ®¡ãç ¥â¥áì í⮬㠪ãàáã..\n";
const char* worker = "âà㤮ãáâ஥­­ë©";
const char* days21 =
"\n<c> .oooo. .o .o8 \n"
"<c>.dP\"\"Y88b o888 \"888 \n"
"<c> ]8P' 888 .oooo888 .oooo. oooo ooo .oooo.o \n"
"<c> .d8P' 888 d88' `888 `P )88b `88. .8' d88( \"8 \n"
"<c> .dP' 888 888 888 .oP\"888 `88..8' `\"Y88b. \n"
"<c>.oP .o 888 888 888 d8( 888 `888' o. )88b \n"
"<c>8888888888 o888o `Y8bod88P\" `Y888\"\"8o .8' 8\"\"888P' \n"
"<c> .o..P' \n"
"<c> `Y8P' \n";
const char* youWin =
"\n<c>.___________. __ __ _______ _______ .__ __. _______ \n"
"<c>| || | | | | ____| | ____|| \\ | | | \\ \n"
"<c>`---| |----`| |__| | | |__ | |__ | \\| | | .--. |\n"
"<c> | | | __ | | __| | __| | . ` | | | | |\n"
"<c> | | | | | | | |____ | |____ | |\\ | | '--' |\n"
"<c> |__| |__| |__| |_______| |_______||__| \\__| |_______/ \n\n\n";
const char* gameOverLogo =
"<c> __ _ __ _ _ __ ___ ___ _____ _____ _ __ \n"
"<c> / _` |/ _` | '_ ` _ \\ / _ \\ / _ \\ \\ / / _ \\ '__|\n"
"<c>| (_| | (_| | | | | | | __/ | (_) \\ V / __/ | \n"
"<c> \\__, |\\__,_|_| |_| |_|\\___| \\___/ \\_/ \\___|_| \n"
"<c> |___/ \n\n";
const char* playerStats[9] = {
"<c>ˆ£à  ¡ë«  ¡ë ¯à®©¤¥­  ¡¥§ ¯à릪®¢ ¢® ¢à¥¬¥­¨ §  %d ",
"<c><3E>®âà ç¥­® ­ áâ®ïé¨å, ­¥ ¨£à®¢ëå ¬¨­ãâ ­  ¯à®å®¦¤¥­¨¥ ¨£àë: %d\n",
"<c><3E>à®ç¨â ­® á®®¡é¥­¨©: %d\n",
"<c><3E>®¬®£ §­ ª®¬ë¬ à §®¡à âìáï á ª®¬¯ìîâ¥à®¬: %d ",
"<c><3E>¥ ¯®¬®£: %d ",
"<c>„¥­¥£ § à ¡®â ­®: $%d\n",
"<c>„¥­¥£ ¯®âà ç¥­®: $%d\n",
"<c>ˆ§ ­¨å ­  ¡« £®â¢®à¨â¥«ì­®áâì: $%d\n",
"<c>‘®¢¥à襭® ¯à릪®¢ ¢® ¢à¥¬¥­¨: %d\n"};
/*const char* gameIntro = "\n “àà  ! „¨¯«®¬ ãᯥ譮 ¯®«ã祭 ¨ 㦥 ª ª ­¥áª®«ìª® ­¥¤¥«ì ¯ë«¨âáï ­  ¯®«ª¥. ƒ®«®¢  ¤® á¨å ¯®à à áª «ë¢ ¥âáï ®â ®£à®¬­®© à ¤®áâ¨... ­¥ á⮨«® ¢áñ ¦¥ â ª ¡ãà­® ®â¬¥ç âì ®ª®­ç ­¨¥ ã­¨¢¥à . Š áç áâìî, íâ®â '¢ë¯ã᪭®© ¢¥ç¥à', ¤«ï騩áï 㦥 ­¥¤¥«¨ ¤¢¥, § ª®­ç¨«áï.\n —â® â ¬ ã ­ á ¢ 宫®¤¨«ì­¨ª¥? <20>ãáâ®. •¬. ‹ ¤­®, ¯®§¢®­î ‚ «¥à¥.\n\n\
<âàïáã騬¨áï ¯ «ìæ ¬¨ ­ ¡¨à ¥â ­®¬¥à>\n-í©,  «¥à, ã â¥¡ï ¥áâì çâ®?\n-  « ¤­®, ­¥ã¦¥«¨ âë ¯à®á¯ «áï!\n-<EFBFBD>¥ ­ ¤® «ï-«ï, ï á ¬ë¬ â१¢ë¬ ¡ë«.\n-<EFBFBD>ã ¤ , ª®­¥ç­®, à á᪠§ë¢ © âãâ! ®â®£à ä¨¨ ¯®§¦¥ ᪨­ã, ª ª á à ¡®âë ¯à¨¤ã.\n-Žâªã¤ ?\n- , ¬¥­ï ¤ï¤ï ¡ëáâ७쪮 ãáâந«. <EFBFBD>ணࠬ¬¨á⮬.\n-Šàãâ®,   ®­ ¬®¦¥â ¬¥­ï ⮦¥ ãáâநâì?\n-<EFBFBD>ã... ¢àï¤ «¨, âã⠢ᥠ¬¥áâ  § ­ïâë.\n-<EFBFBD>® ¢¥¤ì âë ª ª-â® ãáâந«áï!\n-<EFBFBD>à®áâ¨, ­¨ç¥¬ ¯®¬®çì ­¥ ¬®£ã. <EFBFBD>®¯à®¡ã© ãáâநâìáï ªã¤ -­¨¡ã¤ì.\n-  ï ¦¥ ­¨ç¥£® ­¥ 㬥î!\n-å å , ᬥ譮 á«ëè âì íâ® ®â ¢ë¯ã᪭¨ª   ... ¬, å®âï ï ¨ á ¬ ­¨ç¥£® ­¥ 㬥î. <EFBFBD>ਤñâáï á ¬®¬ã ¯à®¡¨¢ âìáï. Ÿ ¢¨¤¥« ¢ ¬ £ §¨­¥ ª­¨£¨ á § £®«®¢ª ¬¨ 'C++ §  21 ¤¥­ì', 'Java §  ¤¢¥ ­¥¤¥«¨' ¨ â.¯., ¯®¯à®¡ã© ¯®ç¨â âì çâ®-­¨¡ã¤ì, ¡ëáâ७쪮 ¢ëãç¨áì ¨ ®â¯à ¢«ï© १ ªã¤ -­¨¡ã¤ì. ®«ìª® ­¥ ¢ ­ èã ª®¬¯ ­¨î.\n-<EFBFBD>®ç¥¬ã?.\n-<EFBFBD>ã ï-â® §­ î, ª ª®© âë à §¤®«¡ ©.  ç¥¬ âë âãâ, ¥á«¨ âë ­  á ¬®¬ ¤¥«¥ ­¨ç¥£® ­¥ 㬥¥èì?\n-â®?!   ï ᬮâàî, âë â ª®© ã¬­ë© áà §ã áâ «, ª ª à ¡®âã ­ èñ«. <EFBFBD>¥ ¡ë«® ¡ë ¤ï¤¨, âë ᥩç á ¡ë ¤¢®à­¨ª®¬ ¡ë«!\n-  ¯®èñ« âë, ­¥ ⥡¥ à¥è âì!\n\n\
ñàâ! ¥­ì£¨ ª®­ç îâáï,   ªãè âì å®ç¥âáï. ®à®è®, çâ® å®âì ¢¨­¤ã ã¬¥î ¯¥à¥ãáâ ­ ¢«¨¢ âì - §­ ª®¬ëå ¬­®£®, ª ª-­¨¡ã¤ì ¯à®¤¥à¦ãáì. í⮬㠭 å «ã ï ¥éñ ¯®ª ¦ã, 祬㠬®¦­® ¢ëãç¨âìï §  21 ¤¥­ì! ˆ ¯ãáâì íâ®â £ ¤ñ­ëè à ¡®â ¥â ­  ᢮¥£® ¤ï¤î, ¯®ª  ï áâà®î á¢®î ª®¬¯ ­¨î. ˆ­â¥à¥á­®, ¤¥¤ã誨­ ª¢ ­â®¢ë© ᢮à ç¨¢ â¥«ì ¯à®áâà ­á⢠ ¨ ¢à¥¬¥­¨ ¥éñ à ¡®â ¥â? Ž­ ¬­¥ ¯à¨£®¤¨âáï. å å , ï 㦥 ¯à¥¤áâ ¢«ïî «¨æ® í⮣® ¯à¨¤ãઠ, ª®£¤  ®­ ¬¥­ï 㢨¤¨â! Ž­ ¦¥ ®áâ ­¥âáï â ª¨¬ ¦¥ âã¯ë¬ ¡®«¢ ­®¬!\n\n";*/
/*const char* gameIntroPlan = " <20>®¯à®¡ãî ¢ëãç¨âìáï ¢á¥¬ã, 祬㠬®¦­®, ¤®á⨣­ãâì ¢á¥£®, ® çñ¬ ¬®¦­® ⮫쪮 ¯®¤ã¬ âì,   ¥éñ,   ¥éñ... § à ¡®â âì Œˆˆ<CB86>„! •¬, « ¤­®, í⮠㦥 ᫨誮¬. <20>ãáâì ¡ã¤¥â ¬¨««¨®­. € ¯®â®¬ ¢áâà¥çãáì á ‚ «¥à®© ¨ ¯®á¬®âਬ, ªâ® 祣® ¤®¡¨«áï.\n\n ˆâ ª, æ¥«ì ¯®áâ ¢«¥­ , ®âáçñ⠢६¥­¨ ¯®èñ«!\n —â® ®­ â ¬ ¯¨á «? C++ §  21 ¤¥­ì? ƒ¤¥-â® ¢ 誠äã ¥áâì â ª ï ª­¨£ , ­ ¤® ¯®¨áª âì. Ÿ ¦¥ ª®£¤ -â® ­ ç¨­ « ¥ñ ç¨â âì... §  21 ¤¥­ì ¥ñ â®ç­® ­¥ ¯à®©â¨. \n<>ਤñâáï ãá¥à¤­® § ­¨¬ âìáï ¨ ç¥à¥§ ¯ àã-âனªã «¥â ï ¥£® ¢ëãçã. € ¯®â®¬ ¢®§ì¬ã ¤¥¤ã誨­ ª¢ ­â®¢ë© ᢮à ç¨¢ â¥«ì ¯à®áâà ­á⢠ ¨ ¢à¥¬¥­¨ ¨ ¢¥à­ãáì ¢ ¯à®è«®¥, ¤® 21-£® ¤­ï, ¯ãáâì ¢á¥ ¤ã¬ îâ, çâ® ï ¤®¡¨«áï ¢á¥£® §  3 ­¥¤¥«¨. ˆ¬¥­­® â ª ï ¨ ᤥ« î!";*/
const char* gameIntroPlan = "–¥«¨:\n\nŽâªàëâì ¢á¥ 9 ¤®á⨦¥­¨©\n<EFBFBD>ன⨠12 ªãàᮢ ®¡ã祭¨ï\nŽâªàëâì 5 ª®­æ®¢®ª:\n 3 ¨§ ­¨å á¢ï§ ­ë á ¢ë¡®à®¬ ᢮¥£® ¯ã⨠(í­¨ª¥©á⢮, à ¡®â  ¢ ª®¬¯ ­¨¨, ᢮© áâ àâ ¯)\n 2 ¨§ ­¨å á¢ï§ ­ë á ¨§¬¥­¥­¨¥¬ ¢ è¥£® ¯®«®¦¥­¨ï ¢ ®¡é¥á⢥ (ª à¬  / ª®«¨ç¥á⢮ ¤¥­¥£)\n\n‚ è¥ ¨£à®¢®¥ ¯à®áâà ­á⢮ - ¢à¥¬ï. <20>® áà ¢­¥­¨î á ¤à㣨¬¨ ¨£à ¬¨, £¤¥ ¢ë ¨áá«¥¤ã¥â¥ ¨£à®¢®¥ ¯à®áâà ­á⢮, §¤¥áì ­¥®¡å®¤¨¬® ¨áá«¥¤®¢ âì ¢à¥¬ï.\n\n‚ë¡à ¢ ¯ãâì, ¢ë ¬®¦¥â¥ ¢¥à­ãâìáï ¢ ¯à®è«®¥ ¨ ¢ë¡à âì ¤à㣮©: í⮬ ¢ ¬ ¯®¬®¦¥â ª¢ ­â®¢ë© ᢮à ç¨¢ â¥«ì ¯à®áâà ­á⢠ ¨ ¢à¥¬¥­¨.\n\n<EFBFBD>®á«¥ ¢ë¯®«­¥­¨ï ¢á¥å § ¤ ­¨© ¢¥à­¨â¥áì ª ­ ç «ì­®© â®çª¥: ª 21 ¤­î. <20>®¤ã¬ ©â¥ å®à®è¥­ìª®, ¯®à®© ¢¥à­ãâìáï ­¥ â ª ¯à®áâ®: ¬®¦¥â ­¥ 墠â¨âì á।áâ¢.\n\nˆ£à  áç¨â ¥âáï § ª®­ç¥­­®©, ª®£¤  ¢ë 㢨¤¨â¥ ­ ¤¯¨áì 'The End'(¢ë ¢ë¨£à «¨) «¨¡® 'game over'(¯à®¨£à «¨, ­¥ ¢ë¯®«­¨«¨ § ¤ ­¨¥).";
const char* yourAnswer = "\n\n‚ è ®â¢¥â:\n\t1:%s\n\t2:%s\n";
const char* shitCodeYourAnswer = "\n\n‚ è ®â¢¥â:\n\t1:„ , ª®­¥ç­®.\n\t2:<3A>¥, ï â ª®£® ­¥ 㬥î.\n";
const char* statusLine = "„¥­ì: %d, $: %d, ª à¬ : %d, á®®¡é¥­¨ï: %d";
const char* statusLineCoursesNotFinished = ", ­¥¯à®©¤¥­­ëå ªãàᮢ: %d";
const char* unnamedStudio1Answer = "‘¬®âà¨, ¢â®à®© à § ¯à¥¤« £ âì ­¥ ¡ã¤¥¬.\n\n‚ è ®â¢¥â:\n\t1:„ , ॡïâ, ï ᮣ« á¥­!\n\t2:•¬..ï ­¥ â ª®© ᬥ«ë©, çâ®¡ë ¢ª« ¤ë¢ âì ¯®á«¥¤­¨¥ ¤¥­ì£¨.\n";
const char* unnamedStudio3Answer = "\n\n‚ è ®â¢¥â:\n\t1:„ , ®â á¥à¤æ  ®âà뢠î!\n\t2:<3A>¥â, ­ã ᪮«ìª® ¬®¦­® ª«ï­ç¨âì ¤¥­ì£¨?\n";
const char* unnamedStudio4Answer = "\n\n‚ è ®â¢¥â:\n\t1:„ , ¤ ¢ ©â¥ ­ ©¬ñ¬ ¢¥¡-¬ áâ¥à .\n\t2:<3A>¥â, ¤ ¢ ©â¥ ï «ãçè¥ á ¬ ¡ëáâ७쪮 ¢ëãçãáì ¨ ᤥ« î ­ ¬ á ©â, ¬?\n\t3:—â®, ®¯ïâì âà â¨âì ¤¥­ì£¨? „  ¯®è«¨ ¢ë!\n";
const char* angryBossAnswer = "\n\n‚ è ®â¢¥â:\n\t1:„ , ï ¡®«ìè¥ ­¥ ¡ã¤ã äਫ ­á¨âì.\n\t2:<3A>¥â, ¢áñ ¦¥ íâ® ­¥ ¯® ¬­¥. Ÿ á«¥¤ãî §  ¤ã宬 ᢮¡®¤ë.\n";
/*************************************************************************
* Modal windows' text
*************************************************************************/
const char* answerLetter = "Žâ¢¥â­®¥ ¯¨á쬮";
const char* cantStopDuringKnowledgeCheck= "<EFBFBD>¥â, ¢ë ­¥ ¬®¦¥â¥ ¯¥à¥¬¥áâ¨âìáï ¢ á¥à¥¤¨­ã ¯à®¢¥àª¨ §­ ­¨©. <20>à®å®¤¨â¥ § ­®¢®!";
const char* charityTitle = "<EFBFBD>« £®â¢®à¨â¥«ì­®áâì";
const char* charityQuestion = "‚ë ¤¥©á⢨⥫쭮 å®â¨â¥ ¯®¦¥à⢮¢ âì ¯®«®¢¨­ã ¢ è¨å ¤¥­¥£ ­  ¡« £®â¢®à¨â¥«ì­®áâì?";
const char* congratsMsg = "<EFBFBD>®§¤à ¢«ï¥¬!";
const char* courseSuccessfullyFinished = "Šãàá '%s' ãᯥ譮 § ¢¥à襭! ’¥¯¥àì ¢ë ¬®¦¥â¥ ¢ë¯®«­ïâì § ¤ ­¨ï ¯® ¢ë¡à ­­®¬ã ­ ¯à ¢«¥­¨î.";
const char* daysPerSecond = "ˆ£à®¢ëå ¤­¥© ¢ ᥪ㭤ã: %d";
const char* doYouReallyWantToExit = "‚ë ¤¥©á⢨⥫쭮 å®â¨â¥ ¢ë©â¨?";
const char* errorMsg = "Žè¨¡ª !";
const char* failMsg = "<EFBFBD>¥ã¤ ç !";
const char* need100ForUndo = "<EFBFBD>à릪¨ ¢® ¢à¥¬¥­¨ ¤®à®£¨. ‚ ¬ ­¥®¡å®¤¨¬® ¨¬¥âì å®âï ¡ë $100!";
const char* notEnoughMoneyForCharity = "‚ ¬ ­¥ç¥£® ¦¥à⢮¢ âì ­  ¡« £®â¢®à¨â¥«ì­®áâì!";
const char* noUnreadMessages = "<EFBFBD>¥â ­¥¯à®ç¨â ­­ëå á®®¡é¥­¨©!";
const char* prepareForTimeJump = "‘¥©ç á ¡ã¤¥â ¯à®¨§¢¥¤ñ­ ¯à릮ª ¢ ¯à®è«®¥, ¯à¨£®â®¢ìâ¥áì!";
const char* pressRForCharity = "’¥¯¥àì, ¨¬¥ï ¤®áâ â®ç­® á।áâ¢, ¢ë ¬®¦¥â¥ âà â¨âì ¤¥­ì£¨ ­  ¡« £®â¢®à¨â¥«ì­®áâì!";
const char* returnToDay21 = "‚ë ¢ëã稫¨áì ¢á¥¬ã, ¨ ¤®¡¨«¨áì ¢á¥£®, çâ® å®â¥«¨. <20>¥ § ¡ã¤ì⥠¢¥à­ãâìáï ¢ ¯à®è«®¥ ª 21-¬ã ¤­î, çâ®¡ë ¤®áâ¨çì ¯®áâ ¢«¥­­®© 楫¨. <20>®¤ã¬ ©â¥ å®à®è¥­ìª®, ¯®à®© í⮠ᤥ« âì ­¥ â ª ¯à®áâ®.";
const char* rightAnswer = "<EFBFBD>à ¢¨«ì­ë© ®â¢¥â!";
const char* startupFailedTip = "‚ë § ¢ «¨«¨ áâ àâ ¯ :(. ‹ãçè¥ ¢¥à­ãâìáï ¢ ¯à®è«®¥ ¨ ¢áñ ¨á¯à ¢¨âì. „ «ìè¥ ­¨ç¥£® ¨­â¥à¥á­®£® 㦥 ­¥ ¡ã¤¥â, íâ® â㯨ª.";
const char* successfullyEnrolled = "‚ë ãᯥ譮 § ¯¨á ­ë ­  ªãàá '%s'!";
const char* wrongAnswer = "<EFBFBD>¥¢¥à­ë© ®â¢¥â :(";
/*************************************************************************
* Achievements
*************************************************************************/
const unsigned int achievesNumber = 9;
char* achieves[achievesNumber] = {
"ƒãà㠯ணࠬ¬¨à®¢ ­¨ï: ¢ë¯®«­¨âì âਠá㯥à-á«®¦­ëå ¯à®¥ªâ .",
"Žâ¢¥à¦¥­­ë©: ¢ è  ª à¬  ®¯ãá⨫ áì ­¨¦¥ ­ã«ï!",
"“ᯥè­ë© áâ àâ ¯¥à: § ¯ãáâ¨âì ¯à¨¡ë«ì­ë© áâ àâ ¯.",
"Œ¨««¨®­¥à: ­ ª®¯¨âì $1000 000.",
"<EFBFBD>¥¯®á¥¤ : á«¥¤®¢ âì §  ¤ã宬 ᢮¡®¤ë.",
"<EFBFBD>¥ ⢮© ¤¥­ì: ¯à®¬¥­ïâì ¯à¥á⨦­ãî à ¡®âã ­  áâ àâ ¯ ¨ ­¥ ¢§«¥â¥âì.",
"‡­ î騩 ᢮ñ ¤¥«®: ãᯥ譮 ¯à®©â¨ ¯à®¢¥àªã §­ ­¨©.",
"<EFBFBD> áâ®©ç¨¢ë© ¨ â¥à¯¥«¨¢ë©: áªãç­®© à ¡®âë ­¥ çãà ¥âáï.",
"<EFBFBD>ãâ¥è¥á⢥­­¨ª ¢® ¢à¥¬¥­¨: ᮢ¥àè âì ¯à릪¨, ­¥ à á¯ ¤ ïáì ­  ¬®«¥ªã«ë."
};
bool achievesPicked[achievesNumber] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
bool achievesShowed[achievesNumber] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
/*************************************************************************
* Final cards
*************************************************************************/
const char* defaultFinalCard = " ®¡é¥¬, íâ® ¢áñ. ’ë, ª®­¥ç­®, ¬®¦¥èì ¯à®¤®«¦ âì ¨ ¤ «ìè¥, ­® ­¨ª ª¨å ®á®¡ëå \
ᮡë⨩ ­¥ ¯à¥¤¢¨¤¨âáï: âë ¯à®áâ® ¢áî ¦¨§­ì ¡ã¤¥èì ¯¥à¥ãáâ ­ ¢«¨¢ âì ¢¨­¤ã ¨ § ¬¥­ïâì ¯¥à¥£®à¥¢è¨¥ ¢¨¤¥®ª àâë.  ! \
­ ¥èì,   â ª®© ®¡à § ¦¨§­¨ ª®¬ã-â® ¤ ¦¥ ­à ¢¨âáï: ¬¥­ìè¥ ®â¢¥âá⢥­­®á⨠¨ à ¡®â  ­¥¯ë«ì­ ï. <EFBFBD>  ¥¤ã 墠⠥â, \
­  ¨­â¥à­¥â ⮦¥.  ç¥¬ ­ ¬ í⨠áâ àâ ¯ë ¨ à ¡®â  ¢ ªà㯭ëå ª®¬¯ ­¨ïå? <EFBFBD>ää, âë ᤥ« « ᢮© ¢ë¡®à. â® ¥éñ ­ã¦­®? \
ˆ­®£¤ , ¯à ¢¤ , ­¨ªâ® ­¥ §¢®­¨â, ¯à¨å®¤¨âáï âà®ï­ë áâ ¢¨âì ­¥ª®â®àë¬, çâ®¡ë ¯®ç é¥ §¢®­¨«¨,   â® â ª ¨ á £®«®¤ã \
¯®¬¥à¥âì ¬®¦­®! ®«ìª® âááá, ­¨ª®¬ã, á«ëè¨èì?\n";
const char* workFinalCard = "Ÿ ᬮâàî, âë â¥à¯¥«¨¢ë©. ‘¨¤¨èì, à ¡®â ¥èì. ‚¨¦ã ¦¥, çâ® áªãç ¥èì. € âë ¢áñ à ¢­® \
à ¡®â ¥èì, ­  áâ®à®­¥ § ª §®¢ ­¥ ¡¥àñèì. ¥­ì£¨ ­¥ ­ã¦­ë? ˆ«¨ ¡®¨èìáï, 㢮«ïâ?   ­¥ ¢ ¦­®! ®, çâ® âë â ª®© - \
íâ® ¯®å¢ «ì­®. ®â â ª¨¥ ¨ ¢ëà뢠îâáï ¢¯¥àñ¤ - ᨤïâ ᥡ¥ ¬®«ç , à ¡®â îâ, à ¡®â îâ,   ¯®â®¬ «¥â ç¥à¥§ ¯ïâì <EFBFBD><EFBFBD> -\
¨ áâ ­®¢ïâáï £¥­¥à «ì­ë¬¨ ¤¨à¥ªâ®à ¬¨ ª®¬¯ ­¨¨, ¢ ª®â®à®© à ¡®â îâ. ®â â ª ï ã â¥¡ï ¯¥àᯥªâ¨¢ , ¤à㦨é¥. Š®¬ã-â® \
¡®«ìè¥ ­à ¢¨âáï áâ ¡¨«ì­®¥ ¬¥áâ® ¢ ª®¬¯ ­¨¨, 祬 ᢮© áâ àâ ¯, ª®â®àë© § ¡¨à ¥â ªãçã ᨫ ¨ ¬®¦¥â ­¥ ¢§«¥â¥âì. \
â®, å®ç¥èì ᢮© áâ àâ ¯? <EFBFBD>ã, §­ ¥èì, ­ ¤® ¡ë«® à ­ìè¥ ¤¥« âì ¤à㣮© ¢ë¡®à!\n";
const char* startupFinalCard = "‘®£« á¨áì, íâ® ¡ë«® ªàãâ®! ’ ª¨¥ ¡ ¡ª¨ ᪮«®â¨âì... å®âï §­ ¥èì, íâ® ­¥ á ¬®¥ £« ¢­®¥. \
ƒ« ¢­®¥ ¢¥¤ì â®, çâ® â® ¢à¥¬ï, ª®â®à®¥ âë ¯®âà â¨« ­  íâ®â áâ àâ ¯, ¯®âà ç¥­® ­¥ §àï.   ¨ ­¥ íâ® £« ¢­®¥, çñàâ ¢®§ì¬¨! \
¢®î ¨£àã ᪠稢 îâ ¬¨««¨®­ë. ŒˆˆŽ<EFBFBD>, ˜ˆ˜œ? ®â íâ® £« ¢­®¥ - â®, ç⮠⢮© ¯à®¤ãªâ ­ã¦¥­ «î¤ï¬. ®, ç⮠⥡ï 業ïâ. \
<EFBFBD>®â®¬ã ¢¥¤ì âë ¨ ãèñ« ¢ áâ àâ ¯, çâ® ­¥ å®ç¥èì ¡ëâì á¥à®© ¬ëèìî ¢ ⮫¯¥ ¯à®£à ¬¬¨á⮢ ¢ ª ª®©-â® ªà㯭®© ª®¬¯ ­¨¨, £¤¥ \
⢮ñ ¢¨¤¥­¨¥ ­¨ª®£® ­¥ ¨­â¥à¥áã¥â. ®§¬®¦­®áâì á ¬®à¥ «¨§ æ¨¨ ¨ ¯®«ñâ ¬ë᫨ - ¢®â ®­ , Ž<EFBFBD>Ž! Š®­¥ç­®, § ¢¨áâ­¨ª¨ \
᪠¦ãâ, ç⮠⥡¥ ¯à®áâ® ¯®¢¥§«®, ­® ¬ë-â® §­ ¥¬, ᪮«ìª® âà㤠 ¡ë«® ¢«®¦¥­®! ë ¯à¥ªà á­® §­ «, ­  çâ® ¨¤ñèì, ¨­ ç¥ \
¢ë¡à « ¡ë çâ®-â® ¤à㣮¥. <EFBFBD>® âë ᤥ« « ¯à ¢¨«ì­ë© ¢ë¡®à. ®âï §­ ¥èì, ­¥â ­¥¯à ¢¨«ì­®£® ¢ë¡®à . áâì ¯à ¢¨«ì­ë©, ¯à®áâ® ¤à㣮©.";
const char* zeroKarmaFinalCard = "‚ë ­ á⮫쪮 ¨á¯®à⨫¨ ®â­®è¥­¨ï á «î¤ì¬¨, çâ® ¤ ¦¥ ­¥§­ ª®¬ë¥ «î¤¨ ­¥ å®âïâ ¨¬¥âì á ¢ ¬¨ ¤¥« . ‚ ¬ ­¨ªâ® ­¥ §¢®­¨â. <20>â® ª®­¥æ :(.\n\n<EFBFBD>  á ¬®¬ ¤¥«¥ ­¥â :D. <20>®áâ à ©â¥áì «î¡ë¬¨ ᯮᮡ ¬¨ ¯®¤­ïâì ª à¬ã, ¨­ ç¥, ª®£¤  ª®­ç âáï ¤¥­ì£¨, ¯à®¨£à ¥â¥.\n";
const char* noMoneyFinalCard = "“ ¢ á ­¥â ¤¥­¥£, çâ®¡ë ¤®âï­ãâì ¤® á«¥¤ãî饣® §¢®­ª  á ¯à¥¤«®¦¥­¨¥¬ ® à ¡®â¥. Š ª ¢ à¨ ­â - ­ ç­¨â¥ ¯à®¤ ¢ âì ª ¯ãáâã, ¬®¦¥â ¡ëâì, íâ® ã ¢ á «ãçè¥ ¯®«ãç¨âáï.\n\n<EFBFBD>  á ¬®¬ ¤¥«¥ íâ® ¥éñ ­¥ ª®­¥æ. <20>®áâ à ©â¥áì ª ª-­¨¡ã¤ì § à ¡®â âì ¤¥­¥£, ¨­ ç¥, ª®£¤  ª à¬  ¡ã¤¥â ¬¥­ìè¥ ­ã«ï, ¢ë ¯à®¨£à ¥â¥!\n";
const char* gameOver = "‚ë ¤®á⨣«¨ ¯®áâ ¢«¥­­®© 楫¨ ¨ ãᯥ譮 § ¢¥à訫¨ ¨£àã! ‚ᥠªãàáë ®¡ã祭¨ï ¯à®©¤¥­ë, ¢á¥ ª®­æ®¢ª¨ à áªàëâë,   ᪮«ìª® ¤®á⨦¥­¨© ¢ë ­ ª®¯¨«¨ §  íâ® ¢à¥¬ï! „®¡¨âìáï â ª®£® ¢á¥£® §  21 ¤¥­ì! Ž¯ëâ, ª®â®àë© ¢ë ¯à¨®¡à¥«¨, ¡¥á業¥­,   ¢ë¡®à, ª®â®àë© ¢ë ¤¥« «¨ - ¯à ¢¨«ì­ë©. ‚¥¤ì ­¥â ­¥¯à ¢¨«ì­®£® ¢ë¡®à , ¥áâì ¯à®áâ® ¤à㣮©. € â®, çâ® ¡ã¤¥â ¤ «ìè¥, § ¢¨á¨â ®â ­ á. € ­¥ ®â <20>Ž ¨«¨ ª ª®©-â® ¬ è¨­ë ¢à¥¬¥­¨, ¢¥à­®?";
/*************************************************************************
* Hints
*************************************************************************/
const char* hintOfTheMonth = "<EFBFBD>®¤áª §ª  ¬¥áïæ :\n";
const int hintsCount = 12;
const char* hints[hintsCount] = {
"'<27>®áâ®ï­­ë© ¨áâ®ç­¨ª ¤®å®¤®¢' - íâ® ­¥ ⮫쪮 ®ä¨æ¨ «ì­ ï à ¡®â  ¨«¨ ᮡá⢥­­ ï ª®¬¯ ­¨ï, ­® â ª¦¥ ¨ ¢ë¯®«­¥­¨¥ § ª §®¢ ¨ ¯à®áì¡ §­ ª®¬ëå, ¥á«¨ ¢ë § à¥ª®¬¥­¤®¢ «¨ á¥¡ï ª ª ᯥ樠«¨áâ  ¨ ¨¬¥¥â¥ å®à®èãî ९ãâ æ¨î.",
"…᫨ ®âª §ë¢ âì ¢á¥¬ §­ ª®¬ë¬ ¯¥à¥ãáâ ­®¢¨âì ¢¨­¤ã ¨«¨ ¯®ç¨­¨âì ª®¬¯ìîâ¥à, â® ¢áª®à¥ ®­¨ ¯¥à¥áâ ­ãâ §¢®­¨âì ᮢᥬ.",
"‡ «¥§ âì ¢ ¤®«£¨ ­¥¯à¨ïâ­®, ­® § ¯®¬¨­ ¥âáï ­ ¤®«£®.",
"Ž¤¨­ ¬®© §­ ª®¬ë© £®¢®à¨«: ç⮡ë áâ âì ¬¨««¨®­¥à®¬, ­ã¦­® ®á­®¢ âì ­¥áª®«ìª® áâ àâ ¯®¢. ˆ«¨ ⮫쪮 ®¤¨­, ­® ­¥áª®«ìª® à §.",
"„à㣮© ¬®© §­ ª®¬ë© ¨¬¥« ªãçã ¤¥­¥£, ­® ¡ë« ­¥áç á⫨¢. Ž­ ­¨£¤¥ ­¥ à ¡®â «, ¨ ¯à®áâ® âà â¨« ¤¥­ì£¨, ¯®ª  ®­¨ ­¥ § ª®­ç¨«¨áì. ’ ª ®­ ¨ § ª®­ç¨«.",
"•®¤¨â¥ ªà㣠¬¨? Š ¦¥âáï, çâ® §¤¥áì ¢ë 㦥 ¡ë«¨ ¨ ¤àã£¨å ¯ã⥩ ­¥â? ‚¤ã¬ ©â¥áì, ¢ç¨â ©â¥áì - ¢á¥£¤  ¬®¦­® ᤥ« âì ª ª®©-­¨¡ã¤ì ¯à®àë¢ ¨«¨ ¤®á⨦¥­¨¥.",
"…᫨ ¢ è  ¦¨§­ì áªãç­  ¨ ¢ ­¥© ­¨ç¥£® ­¥ ¯à®¨á室¨â, ¯®¯à®¡ã©â¥ ᪮¯¨âì ¯®¡®«ìè¥ ¤¥­¥£. ƒ®¢®àïâ, ®­¨ ¤ îâ ¡®«ìè¥ ¢®§¬®¦­®á⥩.",
"…᫨ ¢ë ¢¨¤¨â¥ ᢮© 'Š®­¥æ'...£¬.., ⮠㦥 ­¨ç¥£® ­¥ ¯®¬®¦¥â. <20>â® §­ ç¨â, çâ® ¢áñ. <20>å, ¥á«¨ ¡ë ã ­ á ¡ë«  ¬ è¨­  ¢à¥¬¥­¨!",
"<EFBFBD>¥ §­ ¥â¥, ç¥¬ã ¡ë ­®¢®¬ã ¯®ãç¨âìáï? ‚ᯮ¬­¨â¥, ¡ëâì ¬®¦¥â, ®¤­ ¦¤ë ¢ ¬ ¯à¥¤« £ «¨ â ªãî ¢®§¬®¦­®áâì,   ¢ë ®âª § «¨áì.",
"<EFBFBD>« £®â¢®à¨â¥«ì­®áâì - å®à®è¨© ᯮᮡ ¨§¡ ¢¨âìáï ®â ¤¥­¥£,   § ®¤­® ¨ § à ¡®â âì «î¤áª®¥ ¤®¢¥à¨¥.",
"<EFBFBD>ਠ¯à릪 å ¢® ¢à¥¬¥­¨ ¯à®áâà ­á⢥­­®-¢à¥¬¥­­®© ª®­â¨­ã㬠¨­®£¤  ­¥ ¢ë¤¥à¦¨¢ ¥â ¨ ¯à®à뢠¥âáï: í⨬ ¬®¦­® ®¡êïá­¨âì ¢á¥ ¡ £¨ ¢ í⮩ ¨£à¥.",
"<EFBFBD>®á«¥ ¯à®å®¦¤¥­¨ï ¢á¥å ªãàᮢ ¨ ®âªàëâ¨ï ¢á¥å ¤®á⨦¥­¨© ¨ ª®­æ®¢®ª ­¥ § ¡ã¤ì⥠¢¥à­ãâìáï ¢ ¯à®è«®¥ ª 21-¬ã ¤­î. <20>â® ¬®¦¥â ¡ëâì ­¥ â ª ¯à®áâ®, ª ª ª ¦¥âáï: ¤¥­¥£ ¬®¦¥â ¡ ­ «ì­® ­¥ 墠â¨âì."
};
const char* getWordEnding(int n, int k) {
int ld = n % 10; // Last digit
if (ld == 1)
return (k == 0)?"¤¥­ì\n":"à §\n";
else if (ld == 2 || ld == 3 || ld == 4)
return (k == 0)?"¤­ï\n":"à § \n";
else
return (k == 0)?"¤­¥©\n":"à §\n";
}
/*************************************************************************
* Intro
*************************************************************************/
const char* developer = "Copyright (C) 2014 Maxim Grishin (igevorse)";
const char* introAllowedKeys = "€ á­¨§ã - ª« ¢¨è¨, ª®â®àë¥ ¢ë ¬®¦¥â¥ ­ ¦ âì. <20> ¯à¨¬¥à, [1] ¨«¨ [Enter]";
const char* introDesktop = "<EFBFBD>â® - ¢ è à ¡®ç¨© á⮫";
const char* introFinished = "Ž§­ ª®¬«¥­¨¥ á ¨­â¥à䥩ᮬ § ¢¥à襭®, ­ ç¨­ ¥¬ ¨£àã!";
const char* introLetsBegin = "<EFBFBD> ç­ñ¬!";
const char* introStatusLine = "‘¢¥àå㠮⮡ࠦ ¥âáï ¢ ¦­ ï ¨­ä®à¬ æ¨ï:\n1.’¥ªã騩 ¤¥­ì.\n2.Š®«¨ç¥á⢮ ¤¥­¥£ (ª ¦¤ë© ¤¥­ì áâ ­®¢¨âáï ¢áñ ¬¥­ìè¥, ¢¥¤ì ¢ ¬ ­ã¦­® ¯¨â âìáï).\n3.Š à¬  - ®â­®è¥­¨¥ «î¤¥© ª ¢ ¬. \n4.‘®®¡é¥­¨ï - ª®«¨ç¥á⢮ ­¥¯à®ç¨â ­­ëå á®®¡é¥­¨©.\n";
const char* gameIntroTextPart1 = "1. ‘«ãç ©\n\n\
- <EFBFBD> §¢¥ íâ® á¥à¢¨à®¢ª ? ë ¢ ª ª®© ¤¥à¥¢­¥ í⮬ã ã稫áï? <EFBFBD>®ç¥¬ã ã ¬¥­ï «®¦ª  «¥¦¨â ­¥ á ⮩ áâ®à®­ë, £¤¥ ¯®«®¦¥­®?! â® ¬®«ç¨èì? Žâ¢¥ç ©!\n- ...\n\
- <¤¥à£ ¥â ¬¥­ï §  ªà © à㪠¢ > ë á«ëè¨èì?   çñàâ á ­¥©, á í⮩ «®¦ª®©, âë ­ è¨ § ª §ë ¯¥à¥¯ãâ «! <EFBFBD>®­¨¬ ¥èì? è ¬¨ å«®¯ «, ª®£¤  § ª § ¯à¨­¨¬ «? <EFBFBD>  ¦¥­ã ¬®î § á¬®â५áï, ­¥â?\n\
<á­®¢  ¤¥à£ ¥â §  à㪠¢> <EFBFBD>  ¬¥­ï ᬮâà¨! Ÿ á á ¤ ¬®© ¯à¨èñ«,   âë ¨á¯®à⨫ ¢¥áì ¢¥ç¥à!\n\
<EFBFBD>®èñ« ®âá!\n\n\
<EFBFBD> §¢¥à­ã¢è¨áì, ï ¡ëáâàë¬ è £®¬ ­ ¯à ¢¨«áï ª ¤¢¥à¨ ¯®¤á®¡ª¨, ¢®à¢ «áï ¢­ãâàì, १ª® § ªàë« §  ᮡ®© ¤¢¥àì ¨ ¯à¨¦ «áï ᯨ­®© ª á⥭¥.\n ª ¡®«ìè¥ ­¥ ¬®¦¥â ¯à®¤®«¦ âìáï.\n\
® àâã ¯®ï¢¨« áì £®à¥çì ®â ®¡¨¤ë. <EFBFBD>ã ¯®ç¥¬ã ¢áñ â ª?\n\
<EFBFBD>ã ¯®ç¥¬ã ®­ ¯à¨¤à «áï ª í⮩ ¬¥«®ç¨, à §¢¥ ­¥«ì§ï ¯à®á⮠ᤥ« âì ¢¨¤, çâ® âë ¥ñ ­¥ § ¬¥â¨«?   ®­ ¦¥ á ¬ ¨á¯®à⨫ ¢¥ç¥à!  , ï ¯®áâ ¢¨« ªà¥¬-¡àî«¥ ­¥ ¥¬ã,   ¥£® á¯ãâ­¨æ¥, ¯®â®¬ã çâ® ¯®¤ã¬ «, çâ® ®­ § ª §ë¢ ¥â ­¥ ᥡ¥. Ž¡ëç­® ¢¥¤ì ¥£® § ª §ë¢ îâ ¤ ¬ ¬! Ž­ ¬®£ ¡ë ¢¥¦«¨¢® 㪠§ âì ­  ®è¨¡ªã, § ç¥¬ áà §ã ãáâà ¨¢ âì ¨áâ¥à¨ªã?\n\
<EFBFBD>à ¢¨«  ¯à¨«¨ç¨ï, å®à®è¨¥ ¬ ­¥àë? ƒ¤¥ íâ® ¢áñ?\n\
Ž­¨ «¨æ¥¬¥àïâ ¨ «î¡¥§­¨ç îâ ¤àã£ á ¤à㣮¬, ­® ª ª ⮫쪮 ªâ®-â® ­¨¦¥ ¨å ¯® á®æ¨ «ì­®¬ã ¯®«®¦¥­¨î ®è¨¡ñâáï, â ª ®­¨ áâ à îâáï ¨§«¨âì â®­­ã £­¥¢  ­  ¡¥¤­®£® ®ä¨æ¨ ­â !\n\
Ÿ â ª ¡®«ìè¥ ­¥ ¬®£ã. \n\
¦¥ âà¥â¨© à § §  ­¥¤¥«î ª«¨¥­âë ãáâà ¨¢ îâ ¨áâ¥à¨ª¨ ­  ¯ãá⮬ ¬¥áâ¥! <EFBFBD>㣠îâáï, ã­¨¦ îâ, 㪠§ë¢ îâ ¬­¥ ­  ¬®ñ ¯®«®¦¥­¨¥.   ¨ ªâ® à¥è¨«, çâ® <EFBFBD>Ž - ¬®ñ ¯®«®¦¥­¨¥? Ž­¨?   ã ­¨å ¬®§£®¢ 墠⠥â ⮫쪮 ­  ¯®å®¤ë ¢ ª ä¥ ¨ ¡¥§¬¥à­ë¥ âà âë ¤¥­¥£. Šâ® ¦¥ ⮣¤  íâ® à¥è ¥â?!\n¦¥ ­¥â ᨫ â¥à¯¥âì ¢áñ íâ®!\n\
˜¥ä 㧭 ¥â, ­ ç­ñâáï â ª ï à㣠­ì... ­ã¦­® ¯à®áâ® ¯¥à¥â¥à¯¥âì ¨ ¢áñ. <EFBFBD>Ž Ÿ <EFBFBD> ŒŽƒ.\n\n\
<EFBFBD>㦭® ã室¨âì ®âá. <EFBFBD>¥â, ­¥ ¯®â®¬ã çâ® è¥ä 㢮«¨â, 㧭 ¢ ® ¯à®¨§®è¥¤è¥¬. <EFBFBD>¥â. <EFBFBD>®â®¬ã çâ® ï ª®£¤ -­¨¡ã¤ì ª¨­ãáì á ªã« ª ¬¨ ­  ®ç¥à¥¤­®£® ¯à¨¤¨à î饣®áï ª«¨¥­â ... ¨¡® ï ¯à®á⮠ᮩ¤ã á 㬠, ¯ëâ ïáì â¥à¯¥âì ¢áñ íâ®.\n\n\
Ÿ ¯®¤­ï« £« §  ¨ 㢨¤¥« á¥¡ï ¢ §¥àª «¥, ¢¨á¥¢è¥¬ ­ ¯à®â¨¢: ­  «¨æ¥ § áâë«  ª ª ï-â® áâà ­­ ï ¡¥§®¡à §­ ï ãå¬ë«ª .\n\
¨¤¨¬®, íâ® ­¥à¢­®¥. <EFBFBD> ¤® íâ® ¯à¥ªà é âì, ¨­ ç¥ ï â ª ¤®«£® ­¥ ¯à®¦¨¢ã ¢ í⮬ ¯®áâ®ï­­®¬ áâà¥áá¥.\n\
Ÿ á ᨫ®© á®à¢ « ä àâ㪠¨ ­¥¡à¥¦­® ª¨­ã« ­  ¯®«.\n\
áñ ª®­ç¥­®!";
const char* gameIntroTextPart2 = "2. дǓ\n\n\
¥£ª® ᦨ£ âì ¬®áâë, ª®£¤  ⥡¥ ¥áâì, ­  çâ® ¦¨âì! çâ® ¤¥« âì, ¥á«¨ ¢ 宫®¤¨«ì­¨ª¥ ¥¤ë ­  âਠ¤­ï?  ¤­®, ¬ ªá¨¬ã¬ ­  ­¥¤¥«î, ¥á«¨ ¯®ç⨠­¨ç¥£® ­¥ ¥áâì. Ÿ â ª 㬥î, ¢ ®¡é £¥ ¨ ­¥ â ª®¥ ¯à®å®¤¨«¨. <EFBFBD>® ¥á«¨ ¢ ã­¨¢¥àá¨â¥â᪮© ®¡é £¥ ¬®¦­® ¡ë«® 室¨âì '¢ £®áâ¨' ª ¤®¡àë¬ áâ㤥­â ¬ á ®âªàëâ묨 á¥à¤æ ¬¨, § ¢âà ª âì ã ®¤­®£®,   ®¡¥¤ âì ã ¤à㣮£®, ⮠ᥩç á ï ¬®£ã à ááç¨â뢠âì ⮫쪮 ­  ᥡï. ã­¨¢¥à¥ ¢®®¡é¥ ¬­®£®¥ ¡ë«® ᮢᥬ ¯®-¤à㣮¬ã. <EFBFBD> ¬ £®¢®à¨«¨, çâ® ¬ë ¢ë©¤¥¬ å®à®è¨¬¨ ᯥ樠«¨áâ ¬¨, ¯®«ã稬 ¯à¥á⨦­ãî à ¡®âã! \n\
¥­ì ­¥à¢­®© ãå¬ë«ª¨ á­®¢  ¯à®¡¥¦ «  ¯® «¨æã.  ! ˆ íâ® ®­¨ ­ §ë¢ îâ ¯à¥á⨦­®© à ¡®â®©?\n\
ˆ§ ¢á¥å ®¤­®£à㯯­¨ª®¢, ­ áª®«ìª® ï §­ î, ⮫쪮 ¯ïâ¥à® ᬮ£«¨ ãáâநâìáï ¢ å®à®è¨¥ ª®¬¯ ­¨¨, ¯®â®¬ã çâ® ¤¥©á⢨⥫쭮 ã稫¨áì.\n\
祬 ï å㦥?\n\
¬­¥ ¯à¨å®¤¨«®áì à ¡®â âì ¤­ï¬¨ ¨ ­®ç ¬¨, ç⮡ë 墠⠫® ­  ¥¤ã ¨ ®¯« âã ãçñ¡ë ¢ ã­¨¢¥à¥. çñ¡ë?   à §¢¥ íâ® ãçñ¡ ? â ª®© à ¡®â®© ï ¨ ¢ ã­¨¢¥à¥-⮠।ª® ¯®ï¢«ï«áï.\n\
Œ­¥ ¯à®áâ® ­¥ ¯®¢¥§«®. <EFBFBD>¥ã¤¨¢¨â¥«ì­®, çâ® ï ­¨ç¥¬ã ¨ ­¥ ¢ëã稫áï.\n\
¦¨¢®â¥ à §¤ «áï âॢ®¦­ë© £ã«, ­ ¯®¬¨­ ï, ç⮠㦥 ¡®«¥¥ ¤¥áï⨠ç á®¢ ï ­¨ç¥£® ­¥ ¥«.\n\
  ï ᪮॥ ã¬àã á £®«®¤ã, 祬 ¢¥à­ãáì à ¡®â âì ®ä¨æ¨ ­â®¬! Œ­¥ ¦¥ £®à¤®áâì ¯à®áâ® ­¥ ¯®§¢®«¨â á«®¬ âì á¥¡ï ¨ ¢¥à­ãâìáï, ¯®¤¦ ¢ 墮áâ.\n<EFBFBD>㦭® çâ®-â® ¤¥« âì.\n\n\
Œë᫨ ¬¥è î⠤㬠âì. ƒ®«®¢  ¯à®áâ® à §à뢠¥âáï ®â ¬ëá«¥©!\n\
Ÿ ¦¥ ­¨ç¥£® ­¥ 㬥î!\n\
¤¨­á⢥­­®¥, çâ® ã ¬¥­ï ­¥¯«®å® ¯®«ãç ¥âáï - íâ® ¤ ¢ âì ᮢ¥âë.  ! ¥éñ ¬­¥ ­à ¢¨âáï ¢®§¨âìáï á ª®¬¯ìîâ¥à ¬¨, ª®£¤  ã ¤à㧥© çâ®-â® ­¥ à ¡®â ¥â. \n\
<EFBFBD>¥â, ­¥â, íâ® ¦¥ ­¥ ¬®¦¥â ¡ëâì à ¡®â®©. <EFBFBD>â® â ª, 审¡¨. <EFBFBD> ¤® ®â®£­ âì íâã ¬ëá«ì.\n\
¥«ã¤®ª ­ á⮩稢¥¥ ¤ « ¯®­ïâì, çâ® ã ­¥£® ¥áâì ¤à㣮¥ ¬­¥­¨¥ ¯® ¯®¢®¤ã à ¡®âë. Ÿ ᦠ«áï ®â ¡®«¨.\n\n\
<EFBFBD>à®è«®.\ çñ¬ ï ¤ã¬ «? å, ¤ , ­  í⮬ ­¥«ì§ï § à ¡®â âì. \n\
®âï...\n, ᮡá⢥­­®, ¯®ç¥¬ã ­¥â? â® ï ¥éñ 㬥î?\n...\n\
®â â®-â® ¨ ®­®. Š ¦¥âáï, ã ¬¥­ï ¯à®áâ® ­¥â ¤à㣮£® ¢ë室 . ¨èì ¡ë ­¥ ¢®§¢à é âìáï ¢ íâ®â à¥áâ®à ­.\n\
Ÿ ¢§ï« ¯¥à¢ë© ¯®¯ ¢è¨©áï á¬ïâë© «¨á⮪ á® á⮫ , § ¢ «¥­­®£® ¢á直¬ å« ¬®¬, ª à ­¤ è, ¨ ­ ¡à®á « ¯à¨¬¥à­ë¥ à áçñâë.\n\
 ª, ¥á«¨ § ­¨¬ âìáï ⮫쪮 í­¨ª¥©á⢮¬, â® ­  ¥¤ã ¬­¥ ¡ã¤¥â 墠â âì...   ¥á«¨ ¯®â®¬ à áè¨àïâì ªà㣠§­ ª®¬ëå... â ª, ¬®¦­® ¯®¯à®¡®¢ âì á®âà㤭¨ç âì á ŽŽ... ⮣¤  ¯®«ãç ¥âáï...íâ®... ¨ íâ®...\n\
<EFBFBD>®ç¥¬ã ï ­¥ ¤ã¬ « ®¡ í⮬ à ­ìè¥!\n\
ᨫ®© ª¨­ã¢ ª à ­¤ è ­  á⮫, ï ®âª¨­ã«áï ­  ᯨ­ªã áâã« . <EFBFBD>â® ¦¥ ¯à®é¥ ¯à®á⮣®!\n\
ˆ¤¨®â, ­ã¦­® ¡ë«® ¯à®¡®¢ âì à ­ìè¥!\n\n\
¥¯¥àì ï ᬮ£ã § à ¡®â âì å®âï ¡ë ­  ¥¤ã. Žâ«¨ç­ ï ¯¥àᯥªâ¨¢ ! Šáâ â¨, ® ¯¥àᯥªâ¨¢¥: ­ ¤® ¡ë § ­¨¬ âìáï 祬-â® ¥éñ ªà®¬¥ í­¨ª¥©á⢠, ¨­ ç¥ ª §¨¬¥ ¡ã¤¥â ­¥ ­  çâ® ªã¯¨âì ¡®â¨­ª¨. ã­¨¢¥à¥ ­ ¬ ç¨â «¨ ª ª¨¥-â® «¥ªæ¨¨ ¯® ¯à®£à ¬¬¨à®¢ ­¨î. ƒ®¢®à¨«¨, íâ® ¢áª®à¥ áâ ­¥â ®ç¥­ì ¢®áâॡ®¢ ­®.\n\
â® â ¬ ã ­ á ¥áâì? Š¨­ã¢ ¢§£«ï¤ ­  ¯®«ã¯ãáâãî ª­¨¦­ãî ¯®«ªã, ï ¯¥à¢ë¬ ¤¥«®¬ § ¬¥ç î ª­¨£ã 'C++ §  21 ¤¥­ì'. Œ­¥ ¥ñ ¯®¤ à¨«¨ ­  ¯¥à¢®¬ ªãàá¥. Ž­  ¤® á¨å ¯®à á⮨⠭¥âà®­ã⮩. Ÿ ⮣¤  楫묨 ¤­ï¬¨ ®¡á«ã¦¨¢ « á⮫¨ª¨, ¨ ᮢ¥à襭­® ­¥ ¡ë«® ¢à¥¬¥­¨ ¥ñ ¯à®ç¥áâì.\n\
  à §¢¥ íâ® ¢®§¬®¦­®?   21 ¤¥­ì ï ¤ ¦¥ ¯à®áâ® ¯à®ç¨â âì ¥ñ ­¥ ãᯥî.\n\
â® â ¬ à冷¬? Š­¨£  'Teach Yourself Perl in 21 days'. <EFBFBD>¨ç¥£® ­¥ ¯®­ïâ­®, ­® á­®¢  £®¢®àïâ ® ¤¢ ¤æ âì ®¤­®¬ ¤­¥. §ï« 㠯९®¤ ¢ â¥«ï, ª®£¤  £®â®¢¨«áï ª ¤¨¯«®¬­®©, ¨ § ¡ë« ®â¤ âì. ®¦¥ ­¥ ®âªà뢠«.\n\
  íâ® ¦¥ ᬥ譮!\n\
᫨ ¡ë íâ® ¡ë«® â ª ¯à®áâ®, â® ¢á¥ ¢®ªà㣠㦥 ¯¨á «¨ ­  C++ ¨ Perl, ¢¥¤ì ­ã¦­® ¯®âà â¨âì ¢á¥£® 21 ¤¥­ì ­  ®¡ã祭¨¥!\n\
£®«®¢¥ á­®¢  ¢®§­¨ª«® «¨æ® à §êïàñ­­®£® ª«¨¥­â : '...âë ­ è¨ § ª §ë ¯¥à¥¯ãâ «! <EFBFBD>®­¨¬ ¥èì? è ¬¨ å«®¯ «, ª®£¤  § ª § ¯à¨­¨¬ «?'.\n\
<EFBFBD>¥â, â ª¨¬ «î¤ï¬ ¨ ¢ £®«®¢ã ­¥ ¯à¨¤ñâ 祬ã-«¨¡® ãç¨âìáï.\n\n\
¬¥­ï ¦¥ á¨âã æ¨ï ¯à®áâ® ¡¥§¢ë室­ ï, ¯®í⮬ã ï ¯à®áâ® Ž<EFBFBD>Ÿ<EFBFBD> ¢ëãç¨âìáï §  21 ¤¥­ì. î¡®© 業®©.\n\
<EFBFBD>¥â ¯ã⨠­ § ¤.";
const char* gameIntroTextPart3 = "3. <20> å®¤ª \n\n\
¥­ì. Š ª ï £¤¥-â® ãá«ëè « äà §ã 'ë ­¥ ­ « ¤¨èì á¢®î ¦¨§­ì, ¯®ª  ­¥ ­ ¢¥¤ñèì ¯®à冷ª ¢ ᢮ñ¬ ¤®¬¥'. ®â â ª ¨ ï ¢ë«¨§ « ¢áî ª®¬­ âã, «¨èì ¡ë ­¥ ¡à âì í⨠ª­¨£¨ ¢ à㪨. ˆ§ í⮩ ª®¬­ âë-ᢠ«ª¨ ï ᤥ« « ¯à®áâ® ª®­ä¥âªã.\n\
<EFBFBD>㦭® ¥éñ ¢ëâ é¨âì ¢áñ ¨§-¯®¤ ªà®¢ â¨ ¨ ¢ëª¨­ãâì ª çñà⮢®© ¬ â¥à¨. Ÿ ¤ ¦¥ ¡®îáì à §£à¥¡ âì ¢áñ íâ®, ¤ ¦¥ ­¥ ¯à¥¤áâ ¢«ïî, çâ® â ¬ ¬®¦¥â ¡ëâì.\n\n<...>\n\n\
â® íâ® §  ª®à®¡ª ? Ÿ ­¥ ¯®¬­î â ª®©.  , ᮡá⢥­­®, çâ® ï ¬®£ ¯®¬­¨âì, ª®£¤  ¯à¨å®¤¨« ¤®¬®© ãáâ «ë© ¯®á«¥ à ¡®âë ¨ áà §ã ᯠâì? à ­® ãâ஬ ¢ '«î¡¨¬ë©' à¥áâ®à ­.\n\
âà ­­®. Œ¥â ««¨ç¥áª ï ª®à®¡ª  ­¥ å®ç¥â ®âªà뢠âìáï. <EFBFBD>ã-ª , ¯®¤­ ¦¬ñ¬...\n\
Šàë誠 ®â«¥â¥«  ®¡à â­® ¯®¤ ªà®¢ âì, ¨§ ª®à®¡ª¨ ¢ë¯ «  ª ª ï-â® ¡ã¬ ¦ª  á ­ ¤¯¨áìî. \n\
â® â ¬ ­ ¯¨á ­®? '<EFBFBD>⮠⥡¥'.\n\
â® íâ®? Š ª®©-â® ¬¥å ­¨§¬, ¬¨ªà®á奬ë, ¯à®¢®¤  ¨ ¡«¥áâï騩 ªà á­ë© ª ¬¥­ì...\n\n\
­¥§ ¯­® ï ¢áñ ¯®­ï«. Ÿ ¯«îå­ã«áï ­  ª®«¥­¨ ¯¥à¥¤ ªà®¢ âìî ¨ § áâë« ­  ­¥áª®«ìª® ¬£­®¢¥­¨©.\n\
Ž­ áãé¥áâ¢ã¥â. <EFBFBD>Ž Ž<EFBFBD>!\n\
éñ ¢ ¤¥âá⢥ ¤¥¤ ¬­¥ à á᪠§ë¢ « ᪠§ª¨ ¯à® â®, ª ª ®­ 类¡ë ¢® ¢à¥¬ï ᢮¨å ¯ãâ¥è¥á⢨© ®¡é «áï á® §­ ¬¥­¨â®áâﬨ à §­ëå ¢à¥¬ñ­, ®å®â¨«áï ­  ¤¨­®§ ¢à®¢ ¨ ¢®®¡é¥ å®à®è® ¯à®¢®¤¨« ¢à¥¬ï ­  ᢥâáª¨å ¡ « å. <EFBFBD>â® ¡ë«¨ 㢫¥ª â¥«ì­ë¥ ¨ ¨­â¥à¥á­ë¥ ᪠§ª¨ ­  ­®çì. ˆ¬¥­­® â ª ¬ë ®â­®á¨«¨áì ª í⨬ à á᪠§ ¬.\n\
Ž­ ¡ë« ¯à¥ª«®­­®£® ¢®§à áâ  ¨, å®âï ¥£® à á᪠§ë ¡ë«¨ ¨­â¥à¥á­ë¬¨, ¬ë ­¥ ¢®á¯à¨­¨¬ «¨ ¥£® á«®¢  ¢á¥àìñ§. Œ «® «¨, çâ® â ¬ ¡®à¬®ç¥â ¢ë¦¨¢è¨© ¨§ 㬠 áâ à¨ª?\n\n\
¯®â®¬ ®­ ¯à®¯ «. ˆá祧. ®¢á¥¬.\n\
£® â ª ¨ ­¥ ­ è«¨.\n\
⥯¥àì íâ  ª®à®¡ª . Ÿ ­¥ ¢¥àî ᢮¨¬ £« § ¬. <EFBFBD>â® ¦¥ ­¥¢®§¬®¦­®!\n\
Š ª ®­ â ¬ ­ §ë¢ « íâ®?\n\n\
Š¢ ... ª¢ ­â®¢ë© ᢮à ç¨¢ â¥«ì ¯à®áâà ­á⢠ ¨ ¢à¥¬¥­¨!  , ¨¬¥­­® â ª.\n\n\
Š®«¥­¨ áâ «¨ ­¥¢ë­®á¨¬® ­ëâì. Žç­ã¢è¨áì, ï ¯®­ï«, çâ® ¯à®á¨¤¥« ¬­®£® ¢à¥¬¥­¨. Šã¤  â ¬ ®â«¥â¥«  ªàë誠? , ¢®â ®­ .  ªàë¢ ª®à®¡ªã, ï ¯®«®¦¨« ¥ñ ­  ¯®«ªã.\n\n\
<EFBFBD> ¤® 㦥 ­ ç¨­ âì çâ®-â® ¤¥« âì!\n\
Š ª â ¬ ¡ë«®... ãᯥâì ¢áñ §  21 ¤¥­ì?\n\
맮¢ ¯à¨­ïâ!";
#endif

400
programs/games/21days/sys.cpp Executable file
View File

@ -0,0 +1,400 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
char* windowTitle = "21 days by igevorse";
#ifdef _KOS32
#define kbhit kbhit // Prevent redeclaring kbhit() in pc.h
#include <string>
using std::string;
#pragma pack(push,1)
typedef struct {
char *name;
void *data;
} kol_struct_import;
#pragma pack(pop)
void kol_exit() {
asm volatile ("int $0x40"::"a"(-1));
}
void kol_screen_get_size(unsigned *w, unsigned *h) {
unsigned size;
asm volatile ("int $0x40":"=a"(size):"a"(14));
*w = size / 65536;
*h = size % 65536;
}
void (* __attribute__((stdcall)) con_init)(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
void (* __attribute__((cdecl)) printf2)(const char* format,...);
void (* __attribute__((stdcall)) con_exit)(char bCloseWindow);
int (* __attribute__((stdcall)) getch)();
int (* __attribute__((stdcall)) kbhit)();
void (* __attribute__((stdcall)) con_set_cursor_pos) (int x, int y);
int (* __attribute__((stdcall)) con_set_cursor_height)(int new_height);
void (* __attribute__((stdcall)) cls)();
int strcmp(const char* string1, const char* string2) {
while (1) {
if (*string1<*string2)
return -1;
if (*string1>*string2)
return 1;
if (*string1=='\0')
return 0;
string1++;
string2++;
}
}
void* kol_cofflib_procload (kol_struct_import *imp, char *name) {
for (int i=0;;i++)
if (NULL == ((imp+i) -> name))
break;
else
if (0 == strcmp(name, (imp+i)->name) )
return (imp+i)->data;
return NULL;
}
kol_struct_import* kol_cofflib_load(char *name) {
kol_struct_import* val;
asm volatile ("int $0x40":"=a"(val):"a"(68), "b"(19), "c"(name));
return val;
}
unsigned _kWinWidth = 100;
unsigned _kWinHeight = 30;
void getWinWH(int& width, int& height) {
width = _kWinWidth;
height = _kWinHeight-1;
}
void CONSOLE_INIT(char* title) {
kol_struct_import *imp = kol_cofflib_load("/sys/lib/console.obj");
if (imp == 0)
kol_exit();
con_init = ( __attribute__((stdcall)) void (*)(unsigned, unsigned, unsigned, unsigned, const char*))
kol_cofflib_procload (imp, "con_init");
if (con_init == NULL)
kol_exit();
printf2 = ( __attribute__((cdecl)) void (*)(const char*,...))
kol_cofflib_procload (imp, "con_printf");
if (printf2 == NULL)
kol_exit();
con_exit = ( __attribute__((stdcall)) void (*)(char))
kol_cofflib_procload (imp, "con_exit");
if (con_exit == NULL)
kol_exit();
getch = ( __attribute__((stdcall)) int (*)())
kol_cofflib_procload (imp, "con_getch");
if (getch == NULL)
kol_exit();
cls = ( __attribute__((stdcall)) void (*)())
kol_cofflib_procload (imp, "con_cls");
if (cls == NULL)
kol_exit();
kbhit = ( __attribute__((stdcall)) int (*)())
kol_cofflib_procload (imp, "con_kbhit");
if (kbhit == NULL)
kol_exit();
con_set_cursor_pos = ( __attribute__((stdcall)) void (*) (int, int))
kol_cofflib_procload (imp, "con_set_cursor_pos");
if (con_set_cursor_pos == NULL)
kol_exit();
con_set_cursor_height = ( __attribute__((stdcall)) int (*)(int))
kol_cofflib_procload (imp, "con_set_cursor_height");
if (con_set_cursor_height == NULL)
kol_exit();
unsigned sw, sh;
kol_screen_get_size(&sw, &sh);
// Change window w/h depending on screen w/h
// Sorry for magic numbers
if (_kWinWidth*8 >= sw)
_kWinWidth = sw / 8;
if (_kWinHeight*17 >= sh)
_kWinHeight = sh / 17;
con_init(_kWinWidth, _kWinHeight, _kWinWidth, _kWinHeight, title);
}
void hideCursor() {
con_set_cursor_height(0);
}
void showCursor() {
//nop;
}
void consoleGoto(int line, int column) {
con_set_cursor_pos(column-1, line-1);
}
string itos(int n) {
string s;
int i, sign;
if ((sign = n) < 0)
n = -n;
i = 0;
do {
s[i++] = n % 10 + '0';
} while ((n /= 10) > 0);
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
int j,k;
for (k = 0, j = i-1; k<j; k++, j--) {
char c = s[k];
s[k] = s[j];
s[j] = c;
}
return s;
}
// Ok, I don't want to use vsprintf from KolibriOS
string txt(string s, int d) {
string t = s;
unsigned i = t.find("%d");
if (i != string::npos)
t.replace(i, 2, itos(d).c_str());
return t;
}
string txt(string s, char c) {
string t = s;
unsigned i = t.find("%c");
if (i != string::npos)
t.replace(i, 2, c);
return t;
}
string txt(string s, string s2) {
string t = s;
unsigned i = t.find("%s");
if (i != string::npos)
t.replace(i, 2, s2.c_str());
return t;
}
string txt(string s, string s2, string s3) {
return txt(txt(s, s2), s3);
}
string txt(string s, char ch, string s2) {
return txt(txt(s, ch), s2);
}
string txt(string s, char ch, string s2, char ch2) {
return txt(txt(txt(s, ch), s2), ch2);
}
string txt(string s, int d1, int d2) {
return txt(txt(s, d1), d2);
}
string txt(string s, int d1, int d2, int d3) {
return txt(txt(txt(s, d1), d2), d3);
}
string txt(string s, int d1, int d2, int d3, int d4) {
return txt(txt(txt(txt(s, d1), d2), d3), d4);
}
void initConsole() {
CONSOLE_INIT(windowTitle);
}
#elif defined __linux__
#define printf2 printf
#include <cstdlib> // system
#include <stdarg.h>
#include <stdio.h> // printf, vsprintf
#include <sys/ioctl.h> // get window width/height
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
#include <string>
static struct termios old, new1;
std::string txt(const char* s, ...) {
va_list args;
va_start(args,s);
char x[100000];
vsprintf(x, s, args);
va_end(args);
std::string str(x);
return str;
}
void cls() {
system("clear");
}
void hideCursor() {
printf2("\033[?25l");
}
void showCursor() {
printf2("\033[?25h");
}
void consoleGoto(int line, int column) {
printf2("\033[%d;%dH", line, column);
}
void consoleSetColor(short text = 30, short background = 47) {
printf2("\033[%d;%dm", text, background);
}
/* Initialize new terminal i/o settings */
void initTermios() {
tcgetattr(0, &old); /* grab old terminal i/o settings */
new1 = old; /* make new settings same as old settings */
new1.c_lflag &= ~ICANON; /* disable buffered i/o */
new1.c_lflag &= ~ECHO; /* set echo mode */
tcsetattr(0, TCSANOW, &new1); /* use these new terminal i/o settings now */
}
/* Restore old terminal i/o settings */
void resetTermios() {
tcsetattr(0, TCSANOW, &old);
}
int kbhit () {
struct termios oldt, newt;
int ch;
int oldf;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
oldf = fcntl(STDIN_FILENO, F_GETFL, 0);
fcntl(STDIN_FILENO, F_SETFL, oldf | O_NONBLOCK);
ch = getchar();
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
fcntl(STDIN_FILENO, F_SETFL, oldf);
if(ch != EOF) {
ungetc(ch, stdin);
return 1;
}
return 0;
}
/* Read 1 character without echo */
char getch() {
char ch;
initTermios();
ch = getchar();
resetTermios();
return ch;
}
void getWinWH(int& width, int& height) {
struct winsize w;
ioctl(0, TIOCGWINSZ, &w);
width = w.ws_col;
height = w.ws_row-1;
}
void initConsole() {
printf2("\033]0;%s\007", windowTitle);
}
#elif defined _WIN32
#define printf2 printf
#include <stdio.h> // printf, vsprintf
#include <windows.h>
#include <cstdlib> // system
#define _NO_OLDNAMES _NO_OLDNAMES
#include <conio.h> // kbhit(), getch(), getche()
#include <string>
char getch() {
return _getch();
}
int kbhit (void) {
return _kbhit();
}
std::string txt(const char* s, ...) {
va_list args;
va_start(args,s);
char x[100000];
vsprintf(x, s, args);
va_end(args);
std::string str(x);
return str;
}
void cls() {
system("cls");
}
void showCursor() {
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO info;
info.bVisible = TRUE;
SetConsoleCursorInfo(consoleHandle, &info);
}
void hideCursor() {
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO info;
info.bVisible = FALSE;
info.dwSize = 1;
SetConsoleCursorInfo(consoleHandle, &info);
}
void consoleGoto(int line, int column) {
COORD coord;
coord.X = column;
coord.Y = line;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void consoleSetColor(short text = 30, short background = 47) {
printf2("\033[%d;%dm", text, background);
}
void getWinWH(int& width, int& height) {
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
width = csbi.srWindow.Right - csbi.srWindow.Left - 1;
height = csbi.srWindow.Bottom - csbi.srWindow.Top - 1;
}
void initConsole() {
SetConsoleTitle(windowTitle);
system("mode 100, 30");
}
#endif

53
programs/games/21days/sys.h Executable file
View File

@ -0,0 +1,53 @@
/******************************************************************
* 21 days: a game for programmers
* Copyright (C) 2014 Maxim Grishin
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*******************************************************************/
#ifndef H_SYS
#define H_SYS
#define ESCAPE_KEY 27
#if defined(__linux__) && !defined(_KOS32)
#define ENTER_KEY '\n'
#else
#define ENTER_KEY 13
#endif
#ifdef _KOS32
#define kbhit kbhit // Prevent redeclaring kbhit() in pc.h
void CONSOLE_INIT(char* title);
void kol_exit();
extern void (* __attribute__((stdcall)) con_exit)(char bCloseWindow);
extern void (* __attribute__((cdecl)) printf2)(const char* format,...);
extern int (* __attribute__((stdcall)) getch)();
extern int (* __attribute__((stdcall)) kbhit)();
extern void (* __attribute__((stdcall)) cls)();
#else
void cls();
char getch();
int kbhit ();
#endif
void initConsole();
void hideCursor();
void showCursor();
void consoleGoto(int line, int column);
void getWinWH(int& width, int &height);
#endif