• What do you need help with? V. 3.0
    4,884 replies, posted
Thanks, it turns out it is a different problem. "Lua error: foo.lua:1 unexpected symbol near ''". Googled around a bit and setting Notepad++ to ANSI rather than UTF-8 solved the issue. Thanks again.
In c#, how can I simply toggle the affinity of a certain core? I can manually set the mask with Process.ProcessorAffinity, but all I want to do is make the process use all cores except core 0. I'm not sure how manually setting the mask to use 1-7 would work on a quad core machine, and it would semi-break on a 12 core box since it has more cores.
I'm JUST starting to program. I know absolutely nothing What are good C# tutorials? I'm planning on making that my first language.
Is there any generally recommended Java tutorials or books? I've already got some beginner C++ experience but would like to learn Java too.
[url]www.thenewboston.com[/url] [url]http://download.oracle.com/javase/tutorial/[/url]
Hey guys, I'm trying to make a program that is sort is like prisoners dilema. The problem is that I need help trying to generate a random number.This is what I have so far. Every time I try the program it the random number is 1. Any help is appreciated. [cpp] #include <iostream> #include <cstdlib> #include <ctime> int main () { int part, x; std::cout << "You and your buddy were marked highly supicious for a crime that happend last week. " << std::endl; std::cout << "You were both put in seperate rooms and questioned about the crime."<< std::endl; std::cout <<"What do you choose to do" <<std::endl <<"1. Stay silent and cooperate with your partner "<< std::endl << "2. Confess and betray your partner"<< std::endl; std::cin >> x; srand ( time(NULL) ); part = rand() % 2+1; if (part==1 || x==1) { std::cout << "Both you and your partner cooperated with each other so as a result you both serve 1 month in prison."; } else if (part == 1 || x == 2) { std::cout << "You are set free, but due to your decision your partner was put on a full sentence of 1 year."; } else if (part == 2 || x == 1) { std::cout <<"You have decided to stay loyal with your partner, but he betrayed you. You serve 1 full sentence of a year while he is set free."; } else if (part == 2 || x == 2) { std::cout << "Both you and your partner betrayed each other, so both of you serve 3 months in prison."; } std::cin.ignore(); std::cin.get(); } [/cpp]
Well one that you're doing wrong is using ||. || is logical OR. You want to use AND, which is &&.
I think you just want a logical and (&&) instead of that logical or (||) for those conditional branches. [editline]4th June 2011[/editline] :clocks:
[QUOTE=ZeekyHBomb;30243304]I think you just want a logical and (&&) instead of that logical or (||) for those conditional branches. [editline]4th June 2011[/editline] :clocks:[/QUOTE] [QUOTE=ThePuska;30243029]Well one that you're doing wrong is using ||. || is logical OR. You want to use AND, which is &&.[/QUOTE] Thanks.
I am relatively new to C++, and often find myself relatively lost when it comes to advancing in a specific direction. I was wondering whether there were any C++ libraries recommended for beginners, preferably not related to games, or atleast game graphics.
[QUOTE=genkaz92;30244439]I am relatively new to C++, and often find myself relatively lost when it comes to advancing in a specific direction. I was wondering whether there were any C++ libraries recommended for beginners, preferably not related to games.[/QUOTE] I felt the same way but I've been learning with a book and I'm just working my way through the end of section excercises
[QUOTE=Kondor58;30244464]I felt the same way but I've been learning with a book and I'm just working my way through the end of section excercises[/QUOTE] I would highly appreciate if you told me the name of it. I tried learning with a few books, but for the most part I become quickly uncomfortable with "pure theory".
[QUOTE=genkaz92;30244525]I would highly appreciate if you told me the name of it. I tried learning with a few books, but for the most part I become quickly uncomfortable with "pure theory".[/QUOTE] [url=http://www.textbookw.com/search.asp?p=&filteryr=&genre=&alpha=&page=&source=search&searchstr=Deitel&pid=2871&pauth=Paul+J%2E+Deitel%2C+Harvey+M%2E+Deitel&pname=C%2B%2B+How+to+Program]C++ How to Program 7th Edition by Deitel[/url]: It's a great book, every chapter is a new program where the author includes plenty of code to show you how it's implemented. Also, it's huge, I'm using it for learning and as a reference book. This is the book I bought when I first started C++ and found not problems getting into it, each chapter has LOADS of practice questions and programs that you can try out to become accustomed to the techniques in each chapter. It also comes with a CD that includes basically another book's worth of optional PDF chapters including programming a 3D graphical game of Pong in OGRE.
[QUOTE=Kondor58;30244649][url=http://www.textbookw.com/search.asp?p=&filteryr=&genre=&alpha=&page=&source=search&searchstr=Deitel&pid=2871&pauth=Paul+J%2E+Deitel%2C+Harvey+M%2E+Deitel&pname=C%2B%2B+How+to+Program]C++ How to Program 7th Edition by Deitel[/url]: It's a great book, every chapter is a new program where the author includes plenty of code to show you how it's implemented. Also, it's huge, I'm using it for learning and as a reference book. This is the book I bought when I first started C++ and found not problems getting into it, each chapter has LOADS of practice questions and programs that you can try out to become accustomed to the techniques in each chapter. It also comes with a CD that includes basically another book's worth of optional PDF chapters including programming a 3D graphical game of Pong in OGRE.[/QUOTE] Thank you, I will take a look at it.
That's the International edition, there's a US version but there's probably no difference. [editline]4th June 2011[/editline] You'll love that book if you hate pure theory as much as I do, it's very practical, it shows each technique being used in a real scenario instead of "well technique x does y and z" and then leaving you feeling like "how is that even useful?"
Are there any understandable Java tutorials about networking, and making a game multiplayer? I really want to learn this.
[QUOTE=Kondor58;30244705]That's the International edition, there's a US version but there's probably no difference. [editline]4th June 2011[/editline] You'll love that book if you hate pure theory as much as I do, it's very practical, it shows each technique being used in a real scenario instead of "well technique x does y and z" and then leaving you feeling like "how is that even useful?"[/QUOTE] I completely share your view.
How can I separate my collision logic from my player class. Basically, when the player moves, while inside the same method, I check for collisions and correct his final position. If I move it elsewhere, the final position would appear inside the object for a short while before getting to the collision detection.
I'm having really hard time understanding aabb and obb collision today... Can anyone please show me how to do it in laymen's terms? Or at least good source code. [editline]5th June 2011[/editline] Ok, it seems to be working... Somewhat - according to my programme my calculations are not only inverse (the white collisioned box is spinning the other way the real box does), but also has overflows of some kinds (bottom right), also sometimes half of the white box dissapears completely to reappear later on. [img]http://filesmelt.com/dl/Overflow.JPG[/img] I guess 2am is not the best time for programming :D
[QUOTE=Ritave;30248671] I guess 2am is not the best time for programming :D[/QUOTE] lies [editline]4th June 2011[/editline] okay, so i've got a question of my own how the hell do i get my function to return a value type different than the function's?
[QUOTE=Mon;30249825]lies [editline]4th June 2011[/editline] okay, so i've got a question of my own how the hell do i get my function to return a value type different than the function's?[/QUOTE] What do you mean? If you want to change the return type then just change the function type
[QUOTE=Kondor58;30249889]What do you mean? If you want to change the return type then just change the function type[/QUOTE] i tried that what i'm trying to do here is make a function that outputs a string (like one that uses all that strcat and strcpy stuff) thing is, i can't pull it off [editline]4th June 2011[/editline] embarassing
[QUOTE=Ritave;30248671] -snip- I guess 2am is not the best time for programming :D[/QUOTE] Completely untrue. [img]http://www.worldsstrangest.com/wp-content/plugins/wp-o-matic/wscache23/b5c37_peak-productivity-2am.jpg[/img]
[QUOTE=NotoriousSpy;30247030]If I move it elsewhere, the final position would appear inside the object for a short while before getting to the collision detection.[/QUOTE] It doesn't "appear" anywhere until you draw it, though. If you're doing drawing from the same function that moves the player, you shouldn't be. [list] [*]Go through all entities and let them update themselves: player moves according to user input, monsters move according to AI, etc. [*]Run collision on all entities, and adjust positions accordingly. [*]Now that everything's in its final position, redraw the screen. [/list]
So far my programming/compsci self-teaching has been good... I've gone thru loads of past exam questions, but there's a couple left that I'm unsure about. One of the questions has this pseudocode: [code]Get the current time from the operating system and store it in a variable called &#8216;MyTime&#8217; Loop forever doing the following Wait for one second Add one second to MyTime Display the time from &#8216;MyTime&#8217; in a large graphic style End of loop[/code] The question states that the timer loses several minutes a day... as opposed to the operating system time in the system tray, which is perfect and always keeps accurate track of time. It asks: a) Why is this happening? b) How can the problem be fixed? I'm thinking, the answer to a) is possibly because the CPU is always multitasking (ie not doing operations simultaneously) and hence is losing time because it's busy doing other operations? (This is an old exam paper so let's pretend we only have single core CPUs.) b) Maybe modify the program to get the current time from the OS a lot more frequently? My answer to b) sounds like a really "cheap" solution to the problem... although the whole program sounds silly anyway.
[QUOTE=Anonim;30250649]Completely untrue. [img]http://www.worldsstrangest.com/wp-content/plugins/wp-o-matic/wscache23/b5c37_peak-productivity-2am.jpg[/img][/QUOTE] At 2 AM sometimes I am too tired to think straight, I code some stuff, and when I wake up in the morning, I think, why the fuck did I code it like this?
[QUOTE=Chrispy_645;30254920]So far my programming/compsci self-teaching has been good... I've gone thru loads of past exam questions, but there's a couple left that I'm unsure about. One of the questions has this pseudocode: [code]Get the current time from the operating system and store it in a variable called ‘MyTime’ Loop forever doing the following Wait for one second Add one second to MyTime Display the time from ‘MyTime’ in a large graphic style End of loop[/code] The question states that the timer loses several minutes a day... as opposed to the operating system time in the system tray, which is perfect and always keeps accurate track of time. It asks: a) Why is this happening? b) How can the problem be fixed? I'm thinking, the answer to a) is possibly because the CPU is always multitasking (ie not doing operations simultaneously) and hence is losing time because it's busy doing other operations? (This is an old exam paper so let's pretend we only have single core CPUs.) b) Maybe modify the program to get the current time from the OS a lot more frequently? My answer to b) sounds like a really "cheap" solution to the problem... although the whole program sounds silly anyway.[/QUOTE] Ok, what is happening is that drawing mytime in a large graphic style takes a certain amount of time, which means that the overall loop time is slightly longer than one second. So mytime gets increasingly far out from the real time You can fix it by finding the time it takes for the loop to complete, and adding that to mytime
Also, you can never wait for precisely one second. I think the OS guarantees that it will wait for at least the specified amount but it will never be the exact time.
Can anyone point me in the direction of the best OpenGL tutorial out there? I'm confused by the different versions and people keep telling me that too many tutorials teach you the out of date "fixed" pipeline or whatever that is. Any advice?
This is a good one [url]http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-1:-The-Graphics-Pipeline.html[/url]
Sorry, you need to Log In to post a reply to this thread.