Table of Contents

PNCX

algorithm: brute force / trial-by-division

variant: naive

START TIMEKEEPING
NUMBER: FROM 2 THROUGH UPPERBOUND:
    ISPRIME <- YES
    FACTOR: FROM 2 THROUGH NUMBER-1:
        SHOULD FACTOR DIVIDE EVENLY INTO NUMBER:
            ISPRIME <- NO
    PROCEED TO NEXT FACTOR
    SHOULD ISPRIME STILL BE YES:
        INCREMENT OUR PRIME TALLY
PROCEED TO NEXT NUMBER
STOP TIMEKEEPING

variant: break on composite (BOC)

variant: odds-only processing

variant: sqrt point

variant: break+odds

variant: break+sqrt

variant: break+odds+sqrt

timing

One way to calculate your runtime is by using the get_frame_counter() Vircon32 function. You will need to first store the start frames (before you tally the prime numbers) and your end frames (after you tally the prime numbers). Subtracting the start frames from the end frames will give you a value that you can use to find your runtime. The get_frame_counter() function obtains the current value of the frame counter (there are 60 frames per second). If you’d prefer, you could use get_time() or get_cycle_counter(). Just remember the runtime will need to be drawn in seconds with three decimal places for milliseconds. Don't forget that you need to restart at 0 after you reach each upper bound!

titles

Vircon32 uses the standard BIOS font with a width and height that may be 10 by 15 or 20…

Your title is:

[type]  upper tally runtime 
======= ===== ===== =======

This can be done by printing every word separately and calculating the correct positions or making each line one string. This can be done like:

print_at( X, Y, "title sequence that is really long" );
print_at( X, Y-10, "===== ======== ==== == ====== ====" );

info

You will need to print the info. This can be done similarly to:

    print type name at an X and Y;
    Add X to itself + some value;
    itoa Value;
    print Value at an X and Y;
    repeat x amount of times;
    Time = SomeTime - OtherTime
    ftoa Value;
    Some string length, manipulation, and copying may be required for printing decimals;

It is suggested that you make this into a function with parameters that you can pass to it. This may be done for cleanliness and ease of use in the future!

Also, two important functions used in the example are the itoa and ftoa functions which are a part of the string.h library. They allow you to convert numbers to strings which will be important for displaying data that you have recorded.

wedge pnc0 runtimes

VerbalGnat48 pnc0 runtimes

MrVengeance pnc0 runtimes

cburling pnc0 runtimes

bpatricelli pnc0 runtimes

amelvil2 pnc0 runtimes