Hi there!

I would suggest you use the programming language that you feel the most comfortable with. I would use C# since you get a lot of tools for building UI around your map editor.

In terrain generation, there are a number of approaches depending on how you want to represent your terrain (i.e I) semi-voxel based like Minecraft, II) a continous surface with hills and valleys, or III) a pure 3D modelled terrain (enables overhanging cliffs, caves and the likes). One pretty neat approach is called the Diamond-square algorithm which is explained here. This generates a height-map similar to II), that can be used for coordinates in the terrain, with each pixel representing a fixed (x, z) location, and its gray-value representing its height (y-value).

I hope this helps you in some way at least!

Regards,
Emil Olofsson

Hi there!

I'm interested in the constents of `core.badTiles`. How is it populated? Have you checked that there are more than just one rectangle? Could you post the code where the list is built?

Also, one thought that also came into my mind is the last else if statement (`else if (dir == dirLeft || dir == dirRight)`). First you test if there is an intersection between futurePos and badTile, then you test its negative. One of these will allways be true, so you will never reach your last else if-statement. I'm pretty sure that's the case anyway :)

Regards,
Emil Olofsson

Hi there!

I've tested your code and come up with the following:

1. You might want to check your random values. According to Oracles documentation, Math.random() does the following:
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
Less than 1.0 means that your maximum values will be less than 4. And by converting your double to int using `(int)` you simply cut all decimals, thus your maximum value will be 3. This means that you will only read at most 4 lines (0-3). A suggestion is to use:

``````Random rnd = new Random(); // Do this once, generates a unique seed
int myVal = rnd.nextInt(5); // Generates an integer [0, 4]``````
2. I think what's actually causing your problem is that you increase `c` before checking if it's bigger or equal to `check_phrase`.

Regards,
Emil Olofsson

Try to first search your items for the required text to find out its index, then select that index from the box

Okay, so it is powered. Can you see anything on the screen? It may be the graphics card that doesn't respond. Try removing it (if possible), drying and cleaning it an re-insert. If that doesn't work, try booting with another graphics card (again if possible)

I suggest you solve this by creating a list of all the parameters that are included on a specific flight. Then you compare this list to the users list, and each match adds to the rating points.

You can create a procedure for that. Example:

``````Sub Update()
MessageBox.Show("A button was clicked.")
End Sub

Sub FirstButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show("FirstButton was clicked.")
Update()
End Sub

Sub SecondButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show("SecondButton was clicked.")
Update()
End Sub``````

Regards,
Emil Olofsson

Hmm it looks to me like you forget to reset `count` after every `posinteger` check. If one particular integer has too few divisors, I assume you want to start counting divisors from zero on the next integer.

I hope this helps!

Regards,
Emil Olofsson

Hi. I suggest you start going through the program, one bubble at a time. For example, concentrate on the first bubble. It says "Reading [data.txt]". Ask yourself these questions:

What does that mean?
It means that the program should read the contents of data.txt.

What is the goal of this bubble?
Well, I think the goal must be to open and read the contents of data.txt and put them in some data structure in memory.

What steps are required to achieve this goal?
I need to:

• Open the file for reading
• Loop through all entries, reading one at a time
• Convert every entry to fit my data type
• Insert every entry in my data structure
• Close the file (If not done later in flowchart)

From here, you pretty much got it. Just translate every step to pseudo code. Then pick next bubble.

I hope this helps!

Regards,
Emil Olofsson

Hello! Here is an example of how you could implement a timer that will generate events every interval of `delay` millisecs. If you wand an event generated after 3.124 minutes, you could either initialize your timer with delay `delay = 187440` (and then use `t.stop();` when you received your event.

You could otherwise initialize your delay to like 1000 (one event every second, and then use a counter to count how many seconds have passed).

``````public class TimerExample implements ActionListener {

javax.swing.Timer t = null;

public TimerExample(int delay) {
//Delay between timer events in milliseconds
t = new javax.swing.Timer(delay, this);
t.start();
}

public void actionPerformed(ActionEvent e) {
// Do stuff
}
}``````

Good luck!

Regards,
Emil Olofsson

Thanks! Are you sure that varCreditTotal is visible to the part where you are getting problems? What happens if you place `response.write "Credit Total: " & varCreditTotal` right under the line `varCreditTotal =varCreditTotal + rs("Amount")`?

Hi there!

I need to see more code than this to be able to help you. To solve this problem I would use an array of coordinates like this:
`[ (5, 5) (4, 5) (3, 5) (3, 6) ]`
for example.

Then, when I move up for example, I take the first coordinate (5, 5) and decrease y by 1 and push it first in the queue so I get this:
`[ (5, 4) (5, 5) (4, 5) (3, 5) (3, 6) ]`

I then pop the last coordinate (3, 6) from the queue leaving this:
`[ (5, 4) (5, 5) (4, 5) (3, 5) ].`

This is your new snake.

Also, a proper game loop using old standards can look something like this:

``````1. While Not EndCondition = True do:
2. If KeyPressed do:
3. (char) c <= GetKey
4. Handle movement
5. End if
6. Calculate stuff
7. Draw stuff
8. Sleep some
9. End while``````

I used this structure quite alot when I took my Pascal courses back in highschool. You should be able to find a similar way to implement this in your C++ code.

I hope this helps!

Regards,
Emil Olofsson

PeTo. commented: thank you so much i'm trying to that right now :) +0

Okay, I have never played around with any ASP.NET before, but I'm pretty sure now that `varCreditTotal` is not declared properly (meaning that it is set to null or NaN or something like that). Is `varCreditTotal` a variable that is created somewhere in your code? If so, could you post that piece of code aswell?

What is the output of the following:

``<% response.write "Credit Total: " & varCreditTotal %>``

And this:

``<% response.write "Credit Total: " & varCreditTotal*-1 %>``

Since I don't think there's something wrong with the FormatCurrency function, maybe varCreditTotal is not declared properly?

You could add a member called `name` of type `char*`to your queue class. Then you could change the constructor to request a string that will be the name of your list:

``````public class queue
{
public:
queue();
~queue();
bool Empty() const;
void Enqueue(message^);
void Dequeue();
void DisplayAll() const;
private:
gcroot<String^> bindingkey;
queue(queue const& obj);
ListNode* head;
ListNode* tail;
char* name; // Added this
};

queue::queue(char* _name):head(nullptr), tail(nullptr), name(_name) {}``````

You can of course change it to some other string type if you would like that better. I hope it works!

SAM2012 commented: thanks +1

I suggest you make a for loop, first with start destination = "Santa Barbara" and end destination = "Maracas Gardens". Save that path, then change start destination to "Maracas Gardens" and set end destination to the next stop on your route. That would work, wouldn't it?

Well, you could run it several times then?

Hello! I don't really understand your question. Do you want to programatically get the name of the pointer that points to a certain queue object? I think that could be rather tricky. What are you gonna use this for? I'm sure there's another way to solve your problem.

Regards,
Emil Olofsson

Whats "Whaf Trace"? :P

Regards,
Emil Olofsson

Use
`System.out.println(integersCount[i]);`

Regards,
Emil Olofsson

You could convert the number into a string, then creating substrings of every two characters, and then parse them back to int and add them together?

Another approach would be using modulus, adding the rests of your value x mod 100, 10000 (then split by 100) and so on.

Good luck to you!
Emil Olofsson

Hello!

I need more code in order to understand what has gone wrong. From what I understand it's the line `this.Close();`
That generates the error message?

Where is this line located? Is it somewhere in the code section of the Form1 class, or are you calling it in the same class as where your Form1 object is created? If that is the case, what class does `this` refer to?

Best regards,
Emil Olofsson

Please show us your code so far and specify what your problem is. Then maybe I can help you.

Regards,
Emil Olofsson

Hello!

I think every programmer should have a good understanding of C/C++ (to fully understand the concept of pointers and freeing memory and stuff). This makes it easier to understand the relationship between object references and object clones and how to efficiently control your garbage collector in higher level languages such as C# or Java.

Personally, I'm happy to have worked with Lisp aswell, since i learned alot about writing efficient algorithms and using recursion from it, so I suggest you give Lisp a try aswell.

Finally, I just want ot mention that altough Visual Basic (vb6) was the first language I ever used, I now find it syntactically horrible. So stay away from that :P

Good luck!

Regards,
Emil Olofsson

Hmm yeah, now your display function draws only one square each iteration. Im not really sure what you want your final output to look like, but you could try changing your display and animation functions like this:

``````const int kFramesMax = 30;

void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();

/* define a point data type */
typedef GLfloat point2[2];
point2 vertices[4]={{20,20},{20,-20},{-20,-20},{-20,20}}; // A square

// Draw all squares up to current frame number
for(int i = 0; i < frame; i++)
{
// Random color
glColor3f(((float)rand())/RAND_MAX, ((float)rand())/RAND_MAX,((float)rand())/RAND_MAX);
glBegin(GL_LINE_LOOP);
glVertex2f(vertices[0][0],vertices[0][1]);
glVertex2f(vertices[1][0],vertices[1][1]);
glVertex2f(vertices[2][0],vertices[2][1]);
glVertex2f(vertices[3][0],vertices[3][1]);
glEnd();

glRotatef(9,0,0, 1);
glScalef(1.09,1.09,1);
}

glutSwapBuffers();
}

void animationFunc(void){
Sleep(1000);
glutPostRedisplay();
if(frame < kFramesMax)
{
frame++;
}
}``````

Now it should add one square at a time until there are `kFramesMax` squares on the screen. However, all colors should keep changing since the color information is never stored anywhere. Please tell me your results!

Regards,
Emil Olofsson

With this method you're not supposed to need this buffer swap at all:

if(frame++<=30)
{
...

glutSwapBuffers();
}

`glutDisplayFunc(animationFunc)` is called whenever a redraw is posted. This happens once when your program starts. Instead of running a loop inside your rendering function (display), which may cause bufferswaps before the system is done painting, you should create a new `animationFunc()` and bind it to `glutIdleFunc(animationFunc)`. This is why:

This is what glutIdleFunc does:

If enabled, the idle callback is continuously called when events are not being received.
http://www.opengl.org/resources/libraries/glut/spec3/node63.html

This means that display will be called over and over again.

Now if you add this line: `glutPostRedisplay();` to the end of `animationFunc()`, every time you enter your idle function `animationFunc()` this will cause your program to post a redraw. This makes your program call the `glutDisplayFunc()` again.

Hehe, I hope you understand what I mean :) Also I have never worked with glut, so my claims may even be wrong, but I think I got it right, this is what a proper game loop should look like.

Regards,
Emil Olofsson

Hi!

`Math.Sin` and `Math.Cos` takes angles measured in radians and not degrees. Try this:

``double angleRadians = (Math.PI / 180.0) * angle;``

Then use `angleRadians` instead.

Regards,
Emil Olofsson

Sahil89 commented: Quickly solved! +2

x1 = startx
y1 = starty
x2 = x1 + cos(angle) length
y2 = y1 + sin(angle)
length

Regards,
Emil Olofsson

Just looking at your code makes me wonder if your scene is animated correctly. I found this after a little Googling: http://www.opengl.org/resources/libraries/glut/spec3/node46.html. Thats a pretty interesting example of an alternate way of animating your glut scene. I suspect that your problem lies with your use of `glutSwapBuffers();`.

You could try to use the same technique as mentioned in the example above:

``````void InitGraphics(void)
{
// Initiate your GL-stuff here
}

void display(void)
{
// Clear frame buffer and depth buffer
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

// Set up viewing transformation, looking down -Z axis
glLoadIdentity();

// Twist and turn

// Render your squares or whatever

// Make sure changes appear onscreen
glutSwapBuffers();
}

void AnimateScene(void)
{
// Limit your fps and such here

// Force redraw
glutPostRedisplay();
}

int main(int argc, char** argv)
{
// Initializations
InitGraphics();

glutIdleFunc (AnimateScene);

// Add the spark
glutMainLoop ();
return 0;
}``````

You can read about idle func here: http://www.opengl.org/resources/libraries/glut/spec3/node63.html

Good luck on your animations!

Regards,
Emil Olofsson

Well, this really sounds like a typical homework assignment to me, so I'm not going to provide the full solution to you -just in case.. This is some pretty fundamental java you are asking about, and if you want to start programming, this is something you must learn to figure out by yourself. I can, however, help you with pushes in the right direction until we've solved this exercise.

What have you got so far? Do you know how to create a class? A method? Where do you start getting problems?

Regards,
Emil Olofsson