Friday, March 30, 2001
Thursday, March 29, 2001
$8 = (struct PathItem *) 0x804a9a8
(gdb) print list_node->next
$9 = (struct PathItem *) 0x804a9f0
(gdb) print list_node->next->next
$10 = (struct PathItem *) 0x804a9c0
(gdb) print list_node->next->next->next
$11 = (struct PathItem *) 0x804a9c0
(gdb) print list_node->prev->prev->prev
$12 = (struct PathItem *) 0x804a9a8
(gdb) print list_node->prev->prev->prev->next
$13 = (struct PathItem *) 0x804a9d8
(gdb) print list_node->prev->prev->prev->next->next
$14 = (struct PathItem *) 0x804a9f0
(gdb) print list_node->prev->prev->prev->next->next->next
$15 = (struct PathItem *) 0x804a9c0
(gdb) print list_node->prev->prev->prev->next->next->next->next
$16 = (struct PathItem *) 0x804a9c0
(gdb) print list_node->prev->prev->prev->prev
$17 = (struct PathItem *) 0x804a9a8
(gdb) print list_node->prev->prev->prev->prev->prev
$18 = (struct PathItem *) 0x804a9a8
(gdb) print list_node->prev->prev->prev->prev->prev->next
$19 = (struct PathItem *) 0x804a9d8
(gdb) print list_node->prev->prev->prev->prev->prev->next->next
$20 = (struct PathItem *) 0x804a9f0
(gdb) print list_node->prev->prev->prev->prev->prev->next->next->next
$21 = (struct PathItem *) 0x804a9c0
(gdb) print list_node->prev->prev->prev->prev->indx
$22 = -1
(gdb) print list_node->prev->prev->prev->prev->next->indx
$23 = 2
(gdb) print list_node->prev->prev->prev->prev->next->next->indx
$24 = 7
(gdb) print list_node->prev->prev->prev->prev->next->next->next->indx
$25 = -1
Tuesday, March 27, 2001
Friday, March 23, 2001
Thursday, March 22, 2001
// Iterate through this list until all clones are in paths
in_paths = contigs[ctgnum]->num_show;
while ((i < tot) && (in_paths > 0)) {
// Look at both clones
inlist1 = check_inlist(bl[i]->indx1,&c);
inlist2 = check_inlist(bl[i]->indx2,&c);
if (inlist1)
endlist1 = check_endlist(bl[i]->indx1,&c);
if (inlist2)
endlist2 = check_endlist(bl[i]->indx2,&c);
// If both clones are already in the middle of lists
// - yay! do next one
if ((inlist1 && inlist2) && ((!endlist1) && (!endlist2)))
continue;
// If neither clone is in a list
// - make a new list out of these two
if ((!inlist1) && (!inlist2)) {
}
// If one of the clones is the end of a list
// - Add other clone to the end of this list
// Do for indx1
if ((!inlist1) && (endlist2)) {
}
// Do for indx2
if ((!inlist2) && (endlist1)) {
}
// If one of the clones isn't in a list, and other is internal in a list
// - add these clones to appropriate PathItem->link
// Do for indx1
if ((!inlist1) && ((inlist2) && (!endlist2))) {
}
// Do for indx2
if ((!inlist2) && ((inlist1) && (!endlist1))) {
}
}
Wednesday, March 21, 2001
Tuesday, March 20, 2001
Saturday, March 17, 2001
Thursday, March 15, 2001
Shiva level in Nethack
A portal is generated at around level 10-15 that takes you to the Shiva level. There are 4 levels,
3 are big rooms, but completely filled with really nasty monsters that don't leave any items. First level is elementals, second is golems, third is demons. Here's the trick, if you have been a pacifist, all these monsters will instead be figurines of these monsters. The fourth level is empty, except for a throne in the middle of the room. Around the throne are an amulet of life saving, a bag of holding,and two blessed figurines of a Archons, Ida and Pingala.
If you have been a pacifist, Shiva is seated in the middle of the room in meditation, and will give you the "Mantle of Shiva", which you can wear for huge AC, protection from fire, cold, level
drain and shocking. You can apply it in a direction and all monsters in that direction will be
turned into figurines. You can invoke it, when invoked it summons another high level pet.
Wednesday, March 14, 2001
Tuesday, March 13, 2001
// Enumerated Mountain Rule
//
struct PathList;
// One item in a path
struct PathItem {
int indx; // Index into clones[]
struct PathItem *next; // Next PathItem in the list
struct PathList *links;
};
// One path
struct PathList {
struct PathItem *head;
struct PathItem *z;
};
// All the paths
struct PathCollection {
struct PathList *head;
struct PathList *z;
};
Hee hee! Lots of recursive data structures here! Isn't the PathList in PathItem a cute multi-dimensional treat?
algorithms, weird little data structures.. Cool.
I find in C that I stick with simpler data structures like arrays, not like how I used to work in C++,
but then there is more to keep track of in C, which makes it fun and challenging.
int compare_sulstons(const void* a, const void* b)
{
if((*(struct MatrixListItem**)a)->score < (*(struct MatrixListItem**)b)->score) return -1;
if((*(struct MatrixListItem**)a)->score > (*(struct MatrixListItem**)b)->score) return 1;
return 0;
}
int build_bestlist(struct Clone **clones, struct Contig **contigs, int ctgnum, int tolerance)
{
int i, j, k;
int num, tot;
// 1) Allocate memory for list and clear list
num = contigs[ctgnum]->num_show;
tot = num * (num - 1) / 2;
bestlist = (struct MatrixListItem **) malloc (sizeof (struct MatrixListItem*) * tot);
for (i = 0; i < tot; i++) {
bestlist[i] = (struct MatrixListItem *) malloc (sizeof (struct MatrixListItem));
bestlist[i]->indx1 = -1;
bestlist[i]->indx2 = -1;
bestlist[i]->score = 0.0;
}
// 2) Build the list (half the matrix)
k = 0;
for (i = 0; i < num; i++)
for (j = i+1; j < num; j++) {
bestlist[k]->indx1 = contigs[ctgnum]->show_indx[i];
bestlist[k]->indx2 = contigs[ctgnum]->show_indx[j];
bestlist[k]->score = sulston(clones[contigs[ctgnum]->show_indx[i]],clones[contigs[ctgnum]->show_indx[j]]);
if (DEBUG >= 2)
printf("Adding %3i %3i %3i\t\t1=%3i\t2=%3i\t%.1e\n",i,j,k,bestlist[k]->indx1,bestlist[k]->indx2,bestlist[k]->score);
k++;
}
// 3) Sort this list by sulston score
qsort(bestlist, tot, sizeof(struct MatrixListItem*), compare_sulstons);
// 4) Print the list out
if (DEBUG)
for (i = 0; i < tot; i++) {
printf("Score = %.1e\ti = %i\tClone A %3i (%s)\tClone B %3i (%s)\n",bestlist[i]->score,i,
bestlist[i]->indx1, clones[bestlist[i]->indx1]->clonename,
bestlist[i]->indx2, clones[bestlist[i]->indx2]->clonename);
}
return tot;
}
Isn't that cute? :)
Monday, March 12, 2001
genetic algorithms on them to fix them up. Hopefully will put this right into FPC which would rock, but might be difficult. I'll get it going in contiger first, then go crazy after that.
Sunday, March 11, 2001
// gactg.c
// Read in an fpc file and do a genetic algorithm to fix the named contig
//
// Genetic operators
//
// Crossover probability percentages, should add up to 100
#define CROSSOVER 25
#define MUTATION 25
#define FIXWORST 25
#define BLOCKSHIFT 25
#define MOUNTAIN 25
#define POPSIZE 20
#define NUMGENS 10000
#define NUMREPLACE 3
// Types of scoring metrics
#define RUNSCORE 1
#define NEIGHBOURSCORE 2
#define NEIGHBOURCONF 3
#define SULSTONNEIGHBOUR 4
// Which score we are using
int score_method = SULSTONNEIGHBOUR;
gactg, my new program name. cool, eh?!
Saturday, March 10, 2001
full GA up and running that looks very promising for doing our contig
ordering!
This takes 15 seconds to run at home (600 MHz Pentium III) for 10000
generations. Order is perfect, except that 8 should be at the leftmost
end.
Scores are all the sulston exponents between each neighbour and the next.
This tries to minimize that quantity. It's very fast.
Cool, eh!
-----------------------------------------------------------------
Best = 0 Score = 581
499 446 426 399 385 374 311 292 251 224 195 190 162 139 124 94 61 31 8 958 920 892 841 633 626 617 596 562
Total Mutations = 7624 Good Mutations = 36
Total Crossovers = 3707 Good Crossovers = 6
Total SpanXovers = 3724 Good SpanXovers = 8
Total Fix Worst = 7537 Good Fix Worst = 212
Total BlockShift = 7408 Good BlockShift = 27
Total Mountain = 0 Good Mountain = 0
-----------------------------------------------------------------
shakti 107 [~/GDEV/contiger] %
The inital contig order was randomly shuffled 1000 times, giving clones
like below:
Gen = 1 best = 211 (4)
399 311 446 499 162 958 374 633 841 139 190 195 251 292 892 31 61 94 596 426 562 617 626 385 8 920 224 124
This was the best order at the start.
Thursday, March 08, 2001
Wednesday, March 07, 2001
Monday, March 05, 2001
Friday, March 02, 2001
I've been working on programs to order fingerprinted contigs in the Mouse map, and have been
SUPER busy. More updates soon, I promise.