I'm trying to put together a simple system for a user to generate a list of users to whom surveys will be sent. The list generation may depend on various constraints. For example, "we only want people from the U.S. and Canada" or "we only want people who have a level 2 or level 3 membership."
This part is pretty easy and I've set up the...
Way way back (think 20+ years) I encountered a Gomoku game source code in a magazine that I typed in for my computer and had a lot of fun with.
The game was difficult to win against, but the core algorithm for the computer AI was really simply and didn't account for a lot of code. I wonder if anyone knows this algorithm and has some lin...
I'm trying to come up with a way for players to fire their weapons and only hit for a certain percentage. For example, one gun can only hit 70% of the time while another only hits 34% of the time.
So far all I could come up with is weighted arrays.
Attempt 1:
private function weighted_random(&$weight)
{
$weights = array(($...
Hi,
Given some positive-weighted directed graph, I'd like to find a cheapest set of edges s.t.
1. The set of vertices is a spanning tree, i.e. all vertices are present in the final graph
2. Every vertex is reachable from any other vertex through a directed path (transitive closure??)
3. Set of edges has the minimum cost
Essentially, I ...
Is there a rgaph searching algorithm that searches through a graph (from point a to point b, at the lowest cost possible - this is on a weighted graph) that remembers the path that it takes (e.g. not Dijkstra's as it does not remember the path but simply gives you the shortest distance)?
...