C.
Database operation
In our application, the database was created using SQLite
by the terminal. It is suggested for a developer to use the
terminal in order to begin familiarizing with writing code.
After its creation, he can use the SQLite plugin for Firefox to
add faster entries into tables.
In our quiz game the database is closed. This means that the
three users that we defined above have not the ability to add or
remove questions through the application. The only way to add
data in the database is online, or through a new refreshed
version of the entire application.
When the application starts, the database is initially set to
be renewed after choosing the category. That means that it
writes in the field «Used» the value 'NO' to all the questions
that are saved in the database. This is the proper use of the
database in the process of the game. Choosing the category of
questions they want, either the server or the single user start the
game.
The database starts exporting the category questions the
user selected randomly and with selection criteria the fact that
the field «Used» has the value 'NO'. For each question that is
being displayed, the change of the variable of the field «Used»
with the value 'YES' to this question is automatically being
done. This way we can avoid the appearance of a double
question.
Finally, so that there is no abuse-intemperance of the device
memory, we have defined that the database closes each time it
performs a question.
IV.
C
REATING THE PROJECT
All new mobile operating systems are coming with their
own software application for development, in the case of
anyone wants to occupy and develop apps for each operating
system. So, if a developer decides to create an application, he
has all the tools he needs to achieve that.
We chose iOS because we wanted to learn the secrets of
Objective C language. It is said that it resembles to C++ but in
reality it has a lot different syntax.
When programming for iOS we wrote our code in Xcode
and used its simulation for testing. Xcode gives to developer
the ability to choose between different options for his project.
We suggest that the developers choose an “Empty Application”
project on xCode, because with this option they can customize
View Controllers for their applications.
A.
Analysing game view controller
All view controllers in our application where created from
“Empty view controllers” by adding only the elements we
needed. By starting our application, the user joins the menu.
Menu consists of the following three buttons: “Host Game”,
“Join Game”, and “Single Player”.
When the user selects “Single Player”, the category
controller is appeared. This controller consists of one table
view which is filled with values of category table. Additionally,
two buttons are available, one for starting the game, and the
other for exiting to the main menu [4]. By choosing a category,
the user has the ability to know the total number of its
questions. For that purpose, an alert message that displays the
necessary information was created.
Figure 5 represents the game view controller, which
consists of seven labels. One of them is for the display of the
time, one for the score of the correct answers, and the other
five for the question and its’ possible answers. Also, there are
four more buttons that cover the labels of the answers and will
be used for the method that will check the right answer.
Figure 5.
View of the game when loading the answers
B.
Analysing the game code
In the process of programming, developers should use
techniques to minimize the effort in building and deploying
their application. The most important is to learn about errors,
how to handle them, and how to fix bugs of their application.
Many times, we had to deal with problems in our application.
Bellow we analyze the game code and some techniques we
used.
Starting the game, the first thing to do is to clear the screen
so that the notification message of time input and number of
questions are displayed. To achieve this in every controller,
there is a method - (void)WillAppear:(Bool) animated, stating
the methods that will be activated at the start of the controller.
Here we created a method to achieve the screen clearing and
disabling the use of the buttons in case the user accidentally
touches the screen.
After clearing the screen, if we wish to start the game we
must set the time and questions. To complete the notification
message we create two variables of "Int" type. After the user
has set the data on the time and questions by pressing the "OK"
button on the notification message, the method of time display,
timer start up, and questions are triggered. At the same time we
get the values and we place them in their own labels. In order
for this button to activate, certain conditions must be fulfilled.
For the game time, the user needs to enter more than two
digits, while the number of questions should not exceed the
listed questions. To do that, we need a variable of "NSInteger",