c ++ structure for a strategy game?

I'm doing a strategy game like Age of Empire. It's a pretty big project and I need a clear game structure.
I have defined a GameObject class with the following variables:
Hit Point, Speed, Damage, Range_Attack, … Some functions for moving game objects, loading the game object on the screen, checking the collision, …
Inheritance of "Game_Object class" is Building_Object (There are buildings in the game to train soldiers and villagers), Dynamic_Object (There are dynamic objects like villagers, soldiers, elephants, birds, …)
I've defined a Civil class, it's a class over land, it has std :: vector GameObject contains game objects, it has the variable to store the number of resources, a few variables about technology, function to the amount of army, Check villagers, house, … There are also some functions to check the collision, update the game object and move the game object.
I've defined a Civil_Computer class, it's an inheritance of the Civil class, it has some functions to control the nation of the computer against the player.
I've also defined a manager class that manages loading the map onto the screen, loading the image, managing the game object, and so on. It contains the nation of machines and players as well as some functions to start the game window win, game object to load the screen, …
Finally I have header file defined many functions like Move_Object, Check_Alive, …
Can someone suggest a clearer structure, sorry my English is pretty bad.
Thanks to all !

c – Map a vector within a structure vector

In case of a problem, a ticket sales system and air tickets would have to be created, with each sale the program has to count the number of passengers of that flight and if it reaches the limit, that flight should no longer be available and no longer be displayed in the menu. Sales, should also mark the seat selected and mark it as unavailable, and this part that gives problems, I made the code of registration, but I can not adjust this system of seats, someone can help me

typedef struct rotas{
    int codigo_rota;
    char nome_rota(40);
    int hora;
    int minutos;
    int poltronas;
    float milhas;
    int *lugar;

void cadastroRotasLeitura(int base,int limite){
        //Função responsavel por realizar leituras das rotas
        int x;

c – Design and implement a data structure that can be used to track and manipulate "scopes"

An "area" is defined by a start point (inclusive) and an end point (exclusive), e.g.
For example, the range (1, 4) contains the values ​​1, 2, and 3. You can assume that they are just ranges
defined with integer values.
Implement the following three methods.

a) Add (Start, End): Adds a new range from "Start" to "End" to the data structure. Is the area
does not exist or is included in an existing area, nothing needs to be done. If
The new area partially overlaps an existing area. Subsequently, the two areas should be merged into one
new assortment covering the union of new and old assortments. Examples:
i) Original state ((1, 2)), add (3, 5), New state: ((1, 2), (3, 5))
ii) Original state ((1, 6)), add (3, 5), New state: ((1, 6))
iii) Original state ((1, 4)), add (3, 5), New state: ((1, 5))

b) Delete (Start, End): Deletes the area from "Start" to "End" from the data structure. Is the area
does not exist, then nothing has to be done. If the area partially overlaps an existing area,
then the existing area should be cut off.

Number Theory – A good indication of the Gaussian result on the structure of the multiplicative group of a residual ring

I need a good hint (desirably a textbook in number theory) on the following known result attributed to Gauss in Wikipedia.

Sentence (Gauss). To let $ p $ be a prime number, $ k in mathbb N $ and $ mathbb Z_ {p ^ k} ^ times $ be the multiplicative group of the invertible elements of the residual ring $ mathbb Z_ {p ^ k}: = mathbb Z / p ^ k mathbb Z $,

  1. If $ p $ is odd, then the group $ mathbb Z_ {p ^ k} ^ times $ is cyclic.

  2. If $ p = 2 $ and $ 3k, then the element $ -1 + 2 ^ k mathbb Z $ creates a $ 2 $Element subgroup $ C_2 subset mathbb Z_ {2 ^ k} ^ times $ and the element $ 5 + 2 ^ k mathbb Z $ Creates a cyclic subgroup $ C_ {2 ^ {k-2}} subset mathbb Z_ {2 ^ k} ^ times $ of order $ 2 ^ {k-2} $ so that $ mathbb Z_ {p ^ k} ^ times = C_2 oplus C_ {2 ^ {k-2}} $,

Please help!

Wait types – What is a non-page data structure in SQL Server?

From the same source you mentioned at LATCH_EX

A latch is a lightweight synchronization mechanism that provides
Synchronization between threads trying to read or change data
Structure in SQL Server. There are three types of latches:

  • Latches on pages that are read from disk (these are covered by the PAGEIOLATCH_XX waits – see PAGEIOLATCH_SH waits for
    more details)
  • Latches on pages already in memory (these are covered by the PAGELATCH_XX wait types). For more information, see PAGELATCH_EX Wait Type
  • Latches for non-page data structures (ie Everything Else)

You are interested in the last part:

Latches for non-page data structures (ie Everything Else)

These are latches that do not correspond to data pages in memory or on the hard disk.

See below for the same source for more information on these types of latches:

The wait types LATCH_SH and LATCH_EX occur when a thread requires it
Access to a non-page data structure (eg page buffer in the buffer)
pool (latch type = BUFFER) or the data structure representing a
Database data and log files (latch type = FGCB_ADD_REMOVE)).

Two more examples wait for access to page buffers in the buffer pool or to data and log file data structures.

An example of accessing the data and log file structure is shrinking / enlarging the data or log file of your database.

Your tie type, ACCESS_METHODS_DATASET_PARENT refers to parallelism and latch on the threads needed to capture scan areas. More here and here.

I would start by looking at the query myself and asking a new question with as much information as possible LATCH_EX Waiting times are annoying for you.

Syntax Checker C ++ Data Structure – Stack

Syntax Checker is a very common question of C ++ programming using the data structure stack. However, this is the basis for advanced to this question, which I found in a reference book. Here is the question:

Based on the question checking the balance of parentheses, the output will be "Successful" if all braces () {} () match. Otherwise, print
the location where the first unmatched closing bracket is found, and when
There is no incomparable closing bracket, print the position of the first
Unsurpassed opening bracket.

Sample Input:
{(())()}() //Output:Success
{}((() //Output:3
{}((()}) //Output:7
{}{()} //Output:5
{}{)(} //Output:4
( (43)( i++ ; ) ) { lol = 3 ; }  //Output:Success

My code as follows:


bool arePair(char start, char end)
    if (start == '(' && end == ')') return true;
    else if (start == '{' && end == '}') return true;
    else if (start == '(' && end == ')') return true;
    return false;
bool areParanthesesBalanced(std::string exp)
    std::stack  S;
    for (int i = 0; i < exp.size(); i++)
        char c = exp.at(i);
        if (c == '(' || c == '{' || c == '(')
        else if (c == ')' || c == '}' || c == ')')
            if (S.empty()|| !arePair(S.top(), c)) {
                return false;
            else {
    return S.empty() ? true : false;
int main(){
    std::string input;
    while (std::getline(std::cin, input)) {
        if (areParanthesesBalanced(input))
            std::cout << "Success"<< std::endl;
            //I dont know how to implement this part, so I just randomly output fail
            std::cout << "Fail" << std::endl;
    return 0;

dg.differential geometry – Almost complex structure that oscillates with symplectomorphism

To let $ (V, omega) $ Let be a symplectic vector space with symplectic form $ omega $, Continue to leave $ varphi: V rightarrow V $ be a linear symplectomorphism. Look at the set
mathcal {I} _ { varphi}: = {I in text {end} (V) mid I ^ {2} = – text {Id}, I text {compatible with} omega, I circ varphi = varphi circ I },

the set of compatible, almost complex structures with which to communicate $ varphi $, I have the following questions now.


  1. Is not this sentence empty? If not, under what conditions? $ varphi $ are necessary so that $ mathcal {I} _ { varphi} not = emptyset $?

  2. If this space is not empty, is it contractible?

Unfortunately, I could not find any references. I hope some of you could help me;).

Best regards,

Compatibility of Sullivan's theorem with the hyperbolic structure of the figure-eight-node complement

I am interested in the 3-manifolds with hyperbolic structures from the perspective of physics (gravity). I encounter this article https://arxiv.org/pdf/hep-th/9812206.pdf, whose Eqs. (9) mentions a theorem of Sullivan stating that it is a 3-manifold $ M $ allows at least one hyperbolic structure, there is a 1-1 match between hyperbolic structures $ M $ and conformal structures $ partly M $,

I want to apply this theorem to the 8-node complement $ M = S ^ 3-K $, from where $ K $ denotes the 8-node. The limit of $ M $ is $ partial M = T ^ 2 $, Therefore, its conformal structure can be parameterized by a complex number $ tau $ (modulo $ SL (2, Z) $).
My question is whether Sullivan's theorem means that for every choice $ tau $ There is a corresponding hyperbolic structure $ M $ (regardless of whether the volume of the $ M $ is finite or not)?

Thurston's note constructs a hyperbolic structure for the 8-node complement $ M = S ^ 3-K $ by gluing together two tetrahedra. The $ tau $ The parameter for the boundary-conforming structure seems to be uniquely defined in this construction (as a third unit root?). And the hyperbolic volume of $ M $ is finally. If the answer to my question is yes, that means if $ tau $ deviates from the values ​​given by Thurston, $ M $ can still have a hyperbolic structure, but the volume has to be infinite? If the answer to my question is no, what is the meaning of Sullivan's theorem?

soft question – results on the additive structure of polynomial rings?

I recently wondered about results for irreducibility using the "additive structure" of the present polynomial ring. For example, can we say something about the irreducibility of a sum of two irreducible polynomials that satisfy certain conditions? This seems to be a problem of additive number theory, but in a different context. I looked for such things in the literature but did not find much. I miss something obvious (maybe I can ask the same questions in the underlying ring) or is it just a question with sparse literature? Posts with similar questions are always welcome!

Here is an example: $ (x ^ {2} + 2x + 1) p (x) + x $ seems to be irreducible for "almost all" p (x) with a non-zero constant term. Unsure how I would show it. Here is an article that has the taste of problems that I'm interested in.