problem-solving

Making Asteroids Game In C#

So I am currently trying to make the game Asteroids for a class. The problem is, I haven't done any coding for about 3/4ths of a year since the last time I had the class and forgot almost everything I learned. I need to move the ship using thrust/acceleration but also cap it, and have friction so that when the thrust stops, the ship slow...

C++ Coprimes Problem. Optimize code.

Hi i want to optimize the following code. It tries to find all coprimes in a given range by comparing them to n. But i want to make it run faster... any ideas? #include <iostream> using namespace std; int GCD(int a, int b) { while( 1 ) { a = a % b; if( a == 0 ) return b; b = b % a; if( b == 0 ) retur...

Aggregating Probabilistic Plans

I'm trying to create a simple STRIPS-based planner. I've completed the basic functionality to compute separate probabilistic plans that will reach a goal, but now I'm trying to determine how to aggregate these plans based on their initial action, to determine what the "overall" best action is at time t0. Consider the following example. ...

Write a function to solve a simple linear equation

I need to know how to write a function to solve a simple linear equation like 2x +1 = 5. How would one do this? If anyone can show some code or point me to a site, it would be much appreciated. ...

Good problem solving and data structure questions?

Possible Duplicate: Algorithm/Data Structure Design Interview Questions Share some of good problem solving and data structure questions for hiring a fresh programmer. ...

listing all interesting sections of a tetrahedron

An interesting 2d section is plane that goes through the center of a regular 3d simplex and 2 other points each of which is a centroid of some non-empty subset of vertices. It is defined by two subsets of vertices. For instance {{1},{1,2}} gives a plane defined by 3 points -- center of the tetrahedron, first vertex, and average of first ...

How to get ClassLoader tree and which classloader is associated to each .war in WebSphere

I am analyzing an OutOfMemory issue in some applications in IBM WebSphere Application Server. The problem comes from a singleton instance (a cache) loaded several times, that should be loaded only by one application and is loaded by several. My problem is that I need to determine from the javacore and heapdump files: * The Classloader ...

Effective Timetabling Algorithm

I've got a job that I've been asked to do which involves writing a program to determine where various people are to work on a given day. For example the input may be: 4-6pm, Site A 1-2pm, Site B 9-11am & 2-4pm Site A Essentially there can be many sites and people can work during multiple blocks. I get the feeling that this kind of pr...

What coding challenges are there, and what is the prize?

Some time ago, I have heard about the Netflix challenge to find a better way to organize recommendations. Do you know about more "challenges" in computer science? What are the prizes? ...

Formulating a problem in Prolog

I currently have the following problem, that I want to solve with Prolog. It's an easy example, that would be easy to solve in Java/C/whatever. My problem is that I believe to be too tied to Java's thinking to actually formulate the problem in a way that makes useof Prolog's logic power. The problem is.. I have a set of 6 arrows, eithe...

Tricky MS Access SQL query to remove surplus duplicate records

I have an Access table of the form (I'm simplifying it a bit) ID AutoNumber Primary Key SchemeName Text (50) SchemeNumber Text (15) This contains some data eg... ID SchemeName SchemeNumber -------------------------------------------------------------------- 714 Malcolm ...

Updating recent updates - Problem in procedure - Any other approach?

I have a Section in my website called Recent Updates. in that I will show the latest 5 updates at first when the page is rendered. When a New update is done at real time, the new update will be appended to the top of the updates list and the last one will be deleted. My approach: For this problem, what im doing is, First i renders th...

Dealing with not my-code-related issues

In many programming projects that I develop, it happens that I hit a "wall", which it is not related to my code. The wall is some unexpected issue that prevents my project from working. It can be a hardware issue, it can be a system issue, it can be an issue that is related to some other code which I can't see. What happens next is a lo...

How long does it usually takes before you finally post your problem stackoverflow?

Recently I realized that most of my coding problems are solved either by digging stackoverflow archive or simply asking question here. Still, I spend lots of time fooling myself I will manage to find the solution without any help. It usually results in really high frustration level and the whole thing ends at stackoverflow anyway. So ...

Algorithm for matching all items with another item in same list, where some have restrictions

Given array [a, b, c, d, e, f] I want to match each letter with any other letter except itself, resulting in something like: a - c b - f d - e The catch is that each letter may be restricted to being matched with one or more of the other letters. So let's say for example, a cannot be matched with c, d c cannot be matched with e,...

Programming problem - Game of Blocks

Hi guys, maybe you would have an idea on how to solve the following problem. John decided to buy his son Johnny some mathematical toys. One of his most favorite toy is blocks of different colors. John has decided to buy blocks of C different colors. For each color he will buy googol (10^100) blocks. All blocks of same color are of sa...

Problems in Using Object Variable to Activate & Deactivate WordPress Hooks

First of all, I want to say sorry for this very big question, but all these questions were disturbing my little brain (or no brain!) for the past couple of days as I was not getting any suitable answer. I will request to first read this slowly, and whoever knows any part of it, please try to answer it for that part only. I will really be...