fuck this shit

This commit is contained in:
Isaac Shoebottom 2023-11-28 21:31:01 -04:00
parent 6189cf6a3b
commit 5ebb6a96cc
2 changed files with 7 additions and 4 deletions

View File

@ -86,13 +86,18 @@ DiskRequest* findClosest(DiskQueue *queue, int position, double time) {
if (closest == NULL) {
closest = current;
} else {
if (abs(current->position - position) < abs(closest->position - position)) {
closest = current;
int closestDistance = closest->position - position;
int currentDistance = current->position - position;
if (currentDistance > 0) {
if (currentDistance < closestDistance) {
closest = current;
}
}
}
}
current = current->next;
}
// Bad
if (closest == NULL) {
return NULL;
}

View File

@ -68,10 +68,8 @@ int main(int argc, char **argv) {
int start = 0;
queue = createDiskQueue();
while (EOF != (scanf("%i %i\n", &position, &time))) {
enqueue(queue, time, position);
// printf("Delete me: position %i, Delete me: time %i\n", position, time);
}
if (algorithm == 'F') {
fcfs(start);