SgtMe 46 Veteran Poster Featured Poster

Why are you making an enumerator for boolean ?
Can you not just use:

bool x = False;

That's probably what it's moaning about.

SgtMe 46 Veteran Poster Featured Poster

Offtopic: Basteon, don't give away free help. It's not in forum policy.

SgtMe 46 Veteran Poster Featured Poster
SgtMe 46 Veteran Poster Featured Poster

In your code, you specify numbers of length "9" (index "0" to index "8"). Then, you have a look that feeds data into the array "if nSize is less than or equal to length '10' (index '0' to index '9')". Therefore, your program will try to reference an index of the array that doesn't exist. This is what it should be something like (this is for 10 array values).

int const nSize = 10;
double numbers[nsize];

for (i=0; i<nSize; i++){
//do loop here
}
SgtMe 46 Veteran Poster Featured Poster

It means that you can put a sim-card from any network into the phone. For example, if you buy a phone from orange, you can only put an orange sim in it. If you buy a sim-unlocked phone, you could put in an orange sim, vodafone sim, 3 sim etc.

NewOrder commented: thanks +0
SgtMe 46 Veteran Poster Featured Poster

OK cheers :)
(Please upvote the helpful post)

Hideyshi commented: Very helpful. +0
SgtMe 46 Veteran Poster Featured Poster

I would use Python 2.7, simply because there are so many more tutorials and examples on the internet. Python 3x isn't yet supported by many useful libraries, so Python 2.7 is the way to go at the moment. One day there will be a big shift where the majority jumps across to 3x, but at the moment, just stick to version 2.
(Please upvote my helpful posts :) )
EDIT: Thanks for the upvote :)

SgtMe 46 Veteran Poster Featured Poster

http://www.youtube.com/user/TheMonkeyLords#p/c/0/RC5GeZIOZaU
This is a guy who has a series of Python 3 tutorials. If the link works, you should see the playlist of the videos on the right. If not, you will need to find the "Python 3 Tutorials" playlist.
Good luck :)

FAITH2011 commented: Kind Reply +1
SgtMe 46 Veteran Poster Featured Poster

sunblock -> cream
I'm over 1000...wellllllllllll...on it.

AndreRet commented: Nice on your 1000 posts! +0
SgtMe 46 Veteran Poster Featured Poster

Simple fix (you'll really kill yourself for this one ;) ). You have int gold; , which will set the value of gold to "0". Then, all of your options (apart from else and your inventory option) require you to have enough gold. Consider using a switch instead.

Set gold as 100. Then, have a switch. For example, if the user inputs option 1, you can test whether they have enough money, then go through the function if they do, and call a function or a line of code to tell them they don't have enough if they don't.
http://java-samples.com/showtutorial.php?tutorialid=327

SgtMe 46 Veteran Poster Featured Poster

OK :) Steps:

1. The download in step 2 (the files for wxPython) are in a "tarball (tar.gz2)". Not sure what you use on Ubuntu to open these. Have a look around and you should find something. Try this link though (look at the first post by MisfitI38) http://ohioloco.ubuntuforums.org/showthread.php?t=1417011
You may need to extract twice. On windows 7 with 7-zip, you extract the "tar.gz2" to a ".tar", then to the folder containing the files.

2. Download the source package for wxPython here:
http://sourceforge.net/projects/wxpython/files/wxPython/2.8.11.0/wxPython-src-2.8.11.0.tar.bz2/download

3. Extract the tarball to wherever. It doesn't really matter.

4. Look for the folder wxPython-src-2.8.11.0\wxPython\ . In this folder, there should be a script called "setup.py". Copy the path to this file, including the filename (if you can't copy this, tac it on in the next step).

5. Open the shell or whatever (like Windows Command Prompt). Not sure what the Ubuntu command is, but ( cd ) navigate to the directory of your file (paste it in). The tarball must be fully extracted.

6. Type: setup.py install or failing that, python setup.py install . NOTE: THESE ARE THE WINDOWS COMMANDS. YOU MAY HAVE TO PUT SOMETHING FUNNY IN THOSE, BUT TRY THEM OUT FIRST!!!

7. The console will stream out a whole load of cr*p. Ignore this. It should give you confirmation or whatever. Don't close the shell just yet! Open up your python prompt and type import wx . If …

SgtMe 46 Veteran Poster Featured Poster

Try downloading the source package of wxPython.
Then run setup.py install from the command line.

SgtMe 46 Veteran Poster Featured Poster

Please upvote my post seeing as it was helpful :)

SgtMe 46 Veteran Poster Featured Poster

Your probably best of leaving your project for a bit. If you haven't done graphics before, go here:
http://www.cppgameprogramming.com/cgi/nav.cgi?page=index
(double-click anywhere to bring up the site menu)
and learn allegro. Make pong or space invaders or something first, then go back to do your project. Basically just keep your existing logic, but get rid of all the printing to the console and replace it with graphics. It will be fairly hard to do. Depending on the size of your game, you may want to consider re-writing it around allegro.

skorm909 commented: Helped me out. +1
SgtMe 46 Veteran Poster Featured Poster

I think allegro is a good place to start. It's fairly primitive, but it should be advanced enough to make some good little 2D games, as long as you know what your doing with it. Not sure what you mean about PyGame not being documented very well. There are loads of examples and a full documentation of all the functions. I got along fine with it, and I'm now using PyOpenGL with it as well.

SgtMe 46 Veteran Poster Featured Poster

Well post the code. We can't help without it!
Well people lie about things not being school assignments ;)
Anyway, I wouldn't help someone who didn't show effort regardless.

SgtMe 46 Veteran Poster Featured Poster

One useful trick for creating sky is "sky box". Basically, this is a cube surrounding your entire map (ie everything is inside it). On the inside of the cube, you map a sky texture. Unfortunately, this presents other issues to deal with, such as removing the seams at the edges of the cube. Do a bit of google-ing to see what you can find on sky boxes. I would have given you a link to a site which could help you better, but I would need to know what language and graphics library you are making the game with (eg. C++ and OpenGL) or what SDK you are using (eg. Unreal SDK [UDK] ).

Here are a couple of vids, though neither will be particularly helpful:
http://www.youtube.com/watch?v=PPGjY4sTE9o
http://www.youtube.com/watch?v=Oeejdhcz39M

SgtMe 46 Veteran Poster Featured Poster

Try the "allegro" library. Do a search on YouTube for how to set it up with VC++. There is a good set of tutorials and some example (the examples are all games-based) at:
http://www.cppgameprogramming.com/cgi/nav.cgi?page=allegbasics

Just double click anywhere on the site to bring up the menu :)

SgtMe 46 Veteran Poster Featured Poster

*wolf whistles*

SgtMe 46 Veteran Poster Featured Poster

In your code, you have a kind of double negative here:

while not n == 0:

This is saying that "while 'n' does not equal 0", do stuff.
A simpler way of writing this is "while n != 0:".
The "not" is only really used for boolean. ie:

a = True
while not a:
	print ':)'

the "not" effectively means "false". So: "while 'a' is false".

In your code, you have a kind of double negative here:

while not n == 0:

This is saying that "while 'n' does not equal 0", do stuff.
A simpler way of writing this is "while n != 0:".
The "not" is only really used for boolean. ie:

It looks rather like you are going to use the first bit :)

Just a note: a more convential way of doing this starts at zero and counts to 'n', not the other way round. It won't make any difference, it's just a convention.

Line 3 could also be:

n -= 1
SgtMe 46 Veteran Poster Featured Poster

You show effort.
I wait.

jonsca commented: Nice +5
SgtMe 46 Veteran Poster Featured Poster

We won't do your homework for you. Without you showing a decent amount of code you have written (ie. effort), we will only link you to places that can get you on the right track, and we will NOT give you bits of code. Sorry, but it's the rules.

SgtMe 46 Veteran Poster Featured Poster
SgtMe 46 Veteran Poster Featured Poster

A good way to learn stuff is to make decent programs that do helpful things. Not ones that p*ss people off.

Fbody commented: Amen! +4
SgtMe 46 Veteran Poster Featured Poster

Here's a demo code:

#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
    
    //variables
    //length of array
    const int len=5;
    //array of numbers. Obvs. 24 is highest
    int arr[len]={3, -1, 24, 10, 16};
    //index of current highest
    int HighestSoFar=0;
    //loop until we have tested each array value
    int i=0;
    while (i<len)
    {
        //if the current array value is higher than
        //the current highest, overwrite the current
        //highest variable ("HighestSoFar")
        if (arr[i]>arr[HighestSoFar]){HighestSoFar=i;}
        i++;
    }
    cout<<"HIGHEST INDEX         "<<HighestSoFar<<endl;
    cout<<"HIGHEST VALUE         "<<arr[HighestSoFar]<<endl;
    system("Pause");
}
SgtMe 46 Veteran Poster Featured Poster

These won't fix your issue, but they will clean up your code a bit.

In main.cpp:
-Change lines 8-10 to:

float mypointx, mypointy, Answer;

-After line 22 add:

system("pause");

In XYPoint.h:
-Change lines 13-17 to:

float mypointx, mypointy, pointpx, pointpy, mydistance;

In XYPoint.cpp:
-Remove lines 6-10 (Variables already zero. For one run, you won't need to set them. Keep though if looping program).

-------------------------------

Not sure why you are getting the answer in scientific notation.
When you are testing your program, make the (actual) distance between points "0", as to say that both sets of coordinates are the same. If it does not turn out zero, something is wrong.

When that is working, you will need to test the logic of your program with a 3-4-5 triangle. From your fixed point (eg [0, 0]), you will go out 3 on the x, and up 4 on the y, giving you [3, 4]. The hypotenuse (the distance) of which will be "5".
http://www.tpub.com/math1/20f.htm

Hope this helps :) (If so, then please upvote!)

SgtMe 46 Veteran Poster Featured Poster

Eeeeek...sounds nasty. I think education globally is going to waste. I keep hearing on this site of people who are stuck on homework, not because they can't do it, but because they have a poor tutor, or the tutor is too vague or whatever. The fact that there are lots of functions doesn't really help.

My brain is trying to figure out a way of doing it without classes. For movement, I would suggest that you in your 10x10 grid, you have blank spaces as '0' and ships as 's'. Then, when you come to print, you would find all the ships in the array, get their direction, and print, say, [^] [>] [v] [<] to show the direction.

With regards to armour and range and the like, I would have an array called, eg., ArmourStats of length 'n=ships'. Therefore, ArmourStats[0] would be the value of the armour of ship one, ArmourStats[1] of ship two and so forth. Repeat for the other mass-variable storage mabobs.

You could reduce the amount of functions quite easily. Have ONE function for move, which takes a variable of where the ship you want to move is, and where to. Then you can just recycle this. Obviously, repeat with the other functions. The more of this you do, the more your tutor will/should be impressed.

Good luck again :)

SgtMe 46 Veteran Poster Featured Poster

"The Sound Of Truth" - As I Lay Dying

SgtMe 46 Veteran Poster Featured Poster

OK. Just keep us updated :)

SgtMe 46 Veteran Poster Featured Poster

It's YOUR exam. Not ours. If you show some effort, we can help you, BUT, we won't write it for you.

SgtMe 46 Veteran Poster Featured Poster

http://www.koders.com/c/fidAFD244F63A431E188774EE14C972A5B3FD8F433D.aspx?s=ftp
That has a download link.
Looking through the code...
You may need this as well (features.h)
http://www.koders.com/c/fid4B72990CAFE31EDE806801FF5F38AEBC9B04D1AA.aspx?s=ftp
Have a look and see what you think :)

SgtMe 46 Veteran Poster Featured Poster

What's your current problem?
You could upload your game files in a zip and I could have a look and try to get it working.

WildBamaBoy commented: Very nice to offer +1
SgtMe 46 Veteran Poster Featured Poster

Make sure the header is in your include directory of the compiler/IDE. If you don't have the file, don't use it.

SgtMe 46 Veteran Poster Featured Poster

It is actually pointing to line 49. This is the default new-line at the end of your code. Look at the braces in your main. You have the opener for main, open and close for the while loop, BUT, you don't have the close brace for main.
Add another brace on line 49, without indentation.

SgtMe 46 Veteran Poster Featured Poster

We won't do your homework for you.
If you get started and write some code, we can point you in the right direction.

SgtMe 46 Veteran Poster Featured Poster

Sweet sprites! It looks fine on my computer. I'm guessing it would be to do with the time it takes to redraw the scene? Have a look into dirty-rectangles and dirty-sprites. These only update the parts of the screen or the sprites that need updating, without redrawing the whole scene.

Dirty Rectangles:
http://www.pygame.org/docs/ref/display.html#pygame.display.flip (PyGame Doc)
http://muagames.com/tutorials/pygame-3-pong/pygame-3-pong-step-1/ (An example I found, do page search for "dirty" or "dirty rectangles")
http://www.pygame.org/docs/tut/newbieguide.html (Another example)

Dirty Sprites:
http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.DirtySprite (PyGame Doc)
Couldn't find so much for this one. Have a look round yourself if your interested.

I'd say dirty rectangles would be the best way to go for now.

SgtMe 46 Veteran Poster Featured Poster

"My Last Serenade" - Killswitch Engage

SgtMe 46 Veteran Poster Featured Poster

Well a simple fix would be to multiply everything by 10. Ie:

import os
print float(1+1+1-3)/10
os.system("pause")
SgtMe 46 Veteran Poster Featured Poster

"The Bleeding" Five Finger Death Punch

Ezzaral commented: Good song. +0
SgtMe 46 Veteran Poster Featured Poster

I believe that the problem lies in line 7. You appear to create a variable called "array" (type double). In line 29, you are trying to call values from an array called "array". However, in line 7, you did not set "array" as an array. There is also something a little funny with the code order. You ask for the size of the array (user input) after you have declared it (or not at the moment). Furthermore, you declare variables "i" and "t" before use in the foor loops. A quicker way of doing this is:

for (int t=0; t<size; t++)   //note the int in the brackets before t
                                    //this initializes t

Nothing will be printed, as you have a return statement at line 30, before your "cout" statement loop at lines 33-35. This will end the function. You should return after your print statements, instead of returning "0". The user will not be able to see the "couts", as the console will close before you get a chance to look.

There may be another couple of things I have skipped informing you about in the above, but here is a working code I have.

#include <iostream>

using namespace std;

 int main()
{

    int size, value ;

    cout << "How many values do you wish to enter?\n";
    cin >> size;

    while (size>50)
    {
        cout << "Sorry, that was above 50" << endl;
        cout << "How many values do you wish to enter?\n";
        cin >> size;
    }
    
    double …
hiddepolen commented: Nice post, very lnog and informative. If the owner of the topic wont do it, I will... +1
SgtMe 46 Veteran Poster Featured Poster

So it keeps printing "Computer Moves"?
It would appear that your block of "if" statements are constantly going to the "else" option. Try this:
At line 72:
Change

else (Whose_Turn == 2);

To

else if (Whose_Turn == 2);

However, if that is the case, it will probably keep reverting to the "else if" and we will have another problem.

SgtMe 46 Veteran Poster Featured Poster

Say something about the avatar of the person above you!!!
I'll start...

codeorder commented: :) +0
SgtMe 46 Veteran Poster Featured Poster

The error is around lines 70 and 75. The user input changes the value of "Move" and the computer random value writes to the value of "move". Notice the difference?
Now look at lines 88 to 98. This is where you execute the moves. They both use "Move", which will always be the user input. Change line 75 to:

Move = rand () % 8;

Also:
http://www.cplusplus.com/reference/clibrary/cstdlib/rand/
Here is a reference to rand.
Have a look through.
You should reseed the random value:

#include <time.h>
//...............
//Between current lines 74 and 75
srand (time(NULL));

This should hopefully sort it :)

SgtMe 46 Veteran Poster Featured Poster

OK I'll tell you my secret weapon: My secret weapon is that I don't really have a secret weapon, but it sounds intimidating and can make your opponent edgy ;)
It's now just a weapon...that...won't work anymore... :P

WASDted commented: LOL +0
SgtMe 46 Veteran Poster Featured Poster

Please use code tags. What problem are you having? You can never describe to us a problem in 8 words. We need more detail.

SgtMe 46 Veteran Poster Featured Poster

Please explain your question better. One sentence is not enough to describe a problem to us. It appears that English is not your main language, so I can understand that, but you have shown no effort, and have not given us enough detail to help you.

SgtMe 46 Veteran Poster Featured Poster

Rugby and Tennis :D Not unusual but hey...

SgtMe 46 Veteran Poster Featured Poster

I ran your code in NetBeans:

ERROR 1:
SuitEnumerator(suit):
                        ^
SyntaxError: invalid syntax
(You have a random colon [:] on the end. Remove it)

ERROR 2:
card_list = [[ (rank, suit) for suit in range(4)] for rank in range(1, 14)]]
                                                                               ^
SyntaxError: invalid syntax
(You have one too many close square brackets on the end

ERROR 3:
Traceback (most recent call last):
  File "PATH", line 279, in <module>
    show_hand(card_list)
  File "PATH", line 263, in show_hand
    RankEnumerator(rank)
  File "PATH", line 71, in RankEnumerator
    if rank.isdigit():
AttributeError: 'tuple' object has no attribute 'isdigit'

(Not sure how to fix. Look through your code. It appears that rank is a tuple at the time that line is executed)

I'll have another look later.

SgtMe 46 Veteran Poster Featured Poster

Thanks :) I shall be back later

SgtMe 46 Veteran Poster Featured Poster

OK. Sorry I can't write out much more code for you 'cos I've got a 3D modeling project to sort out. Here are some links to get you help on this.
Arrays
Time Value Of Money (Just take a glance)

Please can you upvote my posts seeing as I have helped you out :)