The goal is that the program asks 7 numbers

1-39, then it starts making random winning

number sets such as 1,8,20,25,28,35,37

It would continue until all seven hit equal to

what is coming out of random generator/generators.

And output would be a number of loops it had to

run to reach the equal set of numbers.

My guess is, or the problem is that, how

to set like this:

Code java:

quess1[3]=1;
quess2[20]=1;
quess3[5]=1;
quess4[35]=1;
quess5[39]=1;
quess6[1]=1;
quess7[2]=1;

but I got this output

1

2

3

4

5

6

7

:confused:

So it was far from the goal. Any help ?

so i am kind of thinking two arrays is the solution ]]>

im trying to develop a tool that crops and resizes JPG files and then applies a color correction to these files.

I'm using Java JAI for this and so far cropping and resizing works like a charm.

Since I have very limited experience with image processing I have a few questions that i was not able to solve with google:

I want this tool to improve the contrast of the input images: These are objects on a white background and I want the white and colors to be brighter while the darker colors should be more saturated.

I have found some university documents on algorithms but I can't figure out how to implement most of these, since they mostly use very sophisticated procedures that I can't transfer into code.

I would really appreciate it if someone could give me some ideas/a place to start for this project.

When I have improved this algorithm to be sufficient, I'd also like to implement some "orientation detection".

The pictures mostly involve mostly objects with clear borders and I'd like to have them automatically rotated that these borders are parallel to the image borders. But this task is secondary, the primary problem i am facing is the color/contrast correction described above.

I really look forward to your input, thanks in advance!

N3XT

(OT: I am not that new to Java but haven't dont anything in a longer time: Would it be possible that Stackoverflow has gone to ***, hasn't it?) ]]>

I create matrices; 4X3 String matrices let's say. Each column of the matrix is a 1D-Array of Strings. Each array consists of the letters {a,b,c,d}. Hence, to create a matrix I generate three 1D-Arrays of Strings.

My objective is to generate all possible 4X3 matrices whith all combinations of the letters {a,b,c,d}.

I do these by the following program segment. Please have a look.

Code :

static LinkedList<String> comb(String s)
{
LinkedList<String> retval=new LinkedList<String>();
if (s.length()==1)
{
retval.add(s);
return retval;
}
for (int i=0;i<s.length();i++)
{
String prep=s.substring(i,i+1);
String sub=s.substring(0,i)+s.substring(i+1);
LinkedList<String> subcomb=comb(sub);
for (int j=0;j<subcomb.size();j++)
retval.add(prep+subcomb.get(j));
}
return retval;
}
public static void main(String[] args)
{
LinkedList<String> combs=comb("abcd");
String [] M = new String [3];
for( int i=0; i<= 23; i ++)
{
for (int j=i; j<= 23; j ++)
{
for (int k=j; k<=23; k ++)
{
M [0]= combs.get(i);
M [1]= combs.get(j);
M [2]= combs.get(k);

There are two rules to achieve this clearing.

1) If I have generated the matriks (i,j,k)=(0,1,6), I do not need any exchange of the columns. That is I do not need any of matrices (1,0,6), (1,6,0), (0,6,1), (6,1,0) etc.

2) If we can reach matrix (i',j',k') from a matrix (i,j,k) by interchanging any two letters in every column, then we do not need to generate one of them.

Ex. from matrix (0,1,2), we reach matrix (6,7,8) by interchanging 'a' and 'b' in (0,1,2). That is,

0 abcd 1 abdc 2 acbd

6 bacd 7 badc 8 bcad

ANYBODY HAS ANY SUGGESTION TO DO IT? HOW CAN I APPLY THESE 2 METHODS TO FOR-LOOPS TO CLEAR SOME OF (i,j,k) TRİPLETS? ]]>

could somebody point me in the right direction?

Let me first explain.

For a hobby I sometimes play the Quiniela, which is a soccer prediction pool in Spain.

You have 15 matches of which you have to predict the outcome (1 for winning of the home team, 2 for the away team and X for a draw).

The 15th match is only a bonus match and will only count if you have predicted all 14 correctly.

You win something if you have predicted 10 or more matches correctly.

I have a mysql database with a lot of statistics (fixtures, tables, winning/drawing/losing/etc streaks, statistics of Quiniela, etc.)

All that data I update/calculate using Java.

For each match of the Quiniela I can calculate the chance of a certain outcome, based on 1 statistic. That's not so complicated.

But, what I want is to build a learning system that calculates the chance of a certain outcome, based on ALL statistics.

For example, the chance will be higher if a team plays at home, but the chance will be lower if the away team is Real Madrid or FC Barcelona, for example.

The chance will be higher if the team hasn't lost for a while, or something like that.

The chance will be higher if a lot of people bet on that match (yes, I have that information too).

etc

And I need more than only a prediction system PER match. It should also be possible for example to say that of a certain 5 matches 3 or more teams will win.

So, is there anyone with an idea how to do this?

Thanks!

Eelco ]]>

Code :

public final class AStar
{
public static LinkedList<Vec3i> route(final World world, final Vec3i start, final Vec3i end, final INeighborFinder neighborFinder)
{
return AStar.route(world, start, end, ClosestHeuristic.INSTANCE, neighborFinder);
}
public static LinkedList<Vec3i> route(final World world, final Vec3i start, final Vec3i end, final IHeuristic heuristic, final INeighborFinder neighborFinder)
{
final Set<Vec3i> closed = new HashSet<>();
final Set<Vec3i> open = new HashSet<>();
final Map<Vec3i, Vec3i> cameFrom = new HashMap<>();
final Map<Vec3i, Double> gScore = new HashMap<>();
final Map<Vec3i, Double> fScore = new HashMap<>();
open.add(start);
gScore.put(start, 0d);
fScore.put(start, gScore.get(start) + heuristic.getEstimatedDistanceToGoal(start, end));
while (!open.isEmpty())
{
Vec3i current = null;
double fScoreValue = Double.MAX_VALUE;
for (final Vec3i vec : open)
{
if (!fScore.containsKey(vec))
continue;
final Double value = fScore.get(vec);
if (value == null)
continue;
if (value < fScoreValue)
{
fScoreValue = value;
current = vec;
}
}
if (current.equals(end))
{
return AStar.reconstructPath(cameFrom, current);
}
open.remove(current);
closed.add(current);
for (final Vec3i neighbor : neighborFinder.findNeighbors(world, current))
{
if (closed.contains(neighbor))
continue;
final double tentativeGScore = gScore.get(current) + AStar.distBetween(current, neighbor);
if (!open.contains(neighbor) || tentativeGScore < gScore.get(neighbor))
{
cameFrom.put(neighbor, current);
gScore.put(neighbor, tentativeGScore);
fScore.put(neighbor, gScore.get(neighbor) + heuristic.getEstimatedDistanceToGoal(neighbor, end));
if (!open.contains(neighbor))
open.add(neighbor);
}
}
}
return null;
}
private static LinkedList<Vec3i> reconstructPath(final Map<Vec3i, Vec3i> cameFrom, final Vec3i current)
{
final LinkedList<Vec3i> path = new LinkedList<>();
path.add(current);
Vec3i _current = current;
while (cameFrom.containsKey(_current))
{
_current = cameFrom.get(current);
path.add(_current);
}
return path;
}
private static double distBetween(final Vec3i current, final Vec3i neighbor)
{
return Math.sqrt((current.getX() * current.getX()) + (current.getY() * current.getY()) + (current.getZ() * current.getZ()));
}
private AStar()
{
}
}

When I run this, the open set continues to grow infinitely. Any idea where I goofed up? Thanks! ]]>