Ok, here is the exp formula tester as I promised. It is pretty small, only 300 lines, and it is pretty simple. This program runs separate from the mud, just compile it, and run it. Here are a couple random notes: The program was made on FreeBSD, but I am hoping it will work on all systems. If you have to make changes to have the program work, please let me know so I can make it more portable. The program uses stuff from <math.h> so when you compile it, at least in FreeBSD, you need to use the -lm argument. Again, if you need to mke changes to get it to work on your system, please let me know what they are. If you have any suggestions, problems, bug reports, enhancment possibilities, or any comments, please contact me. (In other words, if you have any chnages at all, no matter how small, that might be good, please let me know.) If you add any formulas to this program, could you please send it to me. That way I can add it to the next version.(If there is one) Thanks. Mark Dickey mark@bestweb.net /* Exp Formula Tester */ /* Version: 1.0 */ /* This program was designed by Mark Dickey */ /* If there are any problems, enhancements, */ /* additions, questions, or ideas for this */ /* program, please contact mark@bestweb.net */ /* This program when compiled with gcc or */ /* cc, must have the arguments "-lm" Ex: */ /* gcc -lm -o exp exp.c */ /* This is because it uses "pow" and "log" */ /* Other systems might also need extra argu- */ /* ments, but I don't know. (I have FreeBSD) */ /* The include files */ #include <stdio.h> #include <math.h> /* Defines to make it easy to change stuff */ #define NUMBER_OF_LEVELS 100 /* The headers for all of the functions */ void formula_1(void); void formula_2(void); void formula_3(void); void formula_4(void); int choose_class(void); void error_message(void); int main(void); /* Start the program */ int main() { int choice = 1; /* The variable used to choose what to do */ /* The while statment continues until choice == 4 */ /* Then it contiues past to the ending message. */ while (choice != 5) { (void)puts("\nWhat formula would you like to execute?"); (void)puts("1 - Exp_to_level's Formula"); (void)puts("2 - John Watson's Formula - jwatson@magibox.net"); (void)puts("3 - Siv's Formula - siv@cyberenet.net"); (void)puts("4 - George's Formula - greerga@miavx1.acs.mouhio.edu"); (void)puts("5 - Quit the Program"); (void)printf("Your choice: "); (int)scanf("%d", &choice); /* Another fancy while statement to make sure the answer given */ /* is a valid one. If it isn't, it will prompt for */ /* another answer */ while (choice < 1 || choice > 5) { (void)puts("\nThat is not a choice, please try again."); (void)puts("1 - Exp_to_level's Formula"); (void)puts("2 - John Watson's Formula - jwatson@magibox.net"); (void)puts("3 - Siv's Formula - siv@cyberenet.net"); (void)puts("4 - George's Formula - greerga@miavx1.acs.mouhio.edu"); (void)puts("5 - Quit the program"); (void)printf("Your choice: "); (int)scanf("%d", &choice); } /* Right now the choice is evaluated by a switch. */ /* I don't know if if statments would be better or*/ /* not, so I am going to leave it like this */ switch (choice) { case 1: formula_1(); break; case 2: formula_2(); break; case 3: formula_3(); break; case 4: formula_4(); break; default: break; } } (void)puts("\nThanks for using Mark Dickey\'s exp tester. If you have any"); (void)puts("comments on this program, please contact him at:\n"); (void)puts("mark@bestweb.net\n"); return (0); } void error_message() { (void)puts("There was an error in the program, please record"); (void)puts("the exact keystrokes that were used to get this"); (void)puts("error. Contact mark@bestweb.net with the information"); } int choose_class() { int player_class = 0; /* The player's class */ /* Decide what class the player will be */ (void)puts("\nWhat class will the player be?"); (void)puts("1 - Cleric"); (void)puts("2 - Thief"); (void)puts("3 - Warrior"); (void)puts("4 - Magic-User"); (void)printf("Your answer: "); (int)scanf("%d", &player_class); while (player_class < 1 || player_class > 4) { (void)puts("\nThat is not a choice. Try again."); (void)puts("1 - Cleric"); (void)puts("2 - Thief"); (void)puts("3 - Warrior"); (void)puts("4 - Magic-User"); (void)printf("Your answer: "); (int)scanf("%d", &player_class); } return (player_class); } /* This is the first formula. */ void formula_1() { int player_level = 1; /* The player's level */ int level_modifier = 1; /* The modifier dependent upon the level for the exp_needed */ long exp_needed = 1; /* Exp needed for each level */ /* A fancy for statement to print out the exp needed for 100 levels */ for (player_level = 1; player_level <=NUMBER_OF_LEVELS; player_level++) { if (player_level < 10) level_modifier = 1; else if (player_level < 20) level_modifier = 2; else if (player_level < 30) level_modifier = 5; else if (player_level < 40) level_modifier = 10; else if (player_level < 50) level_modifier = 20; else if (player_level < 60) level_modifier = 30; else if (player_level < 70) level_modifier = 50; else if (player_level < 80) level_modifier = 70; else if (player_level < 90) level_modifier = 100; else level_modifier = 250; exp_needed = player_level * level_modifier * 4000; (void)printf("Level: %d Exp: %ld\n", player_level, exp_needed); } return; } void formula_2() { int player_level = 1; /* Player's Level */ int player_class = 0; /* Player's Class */ long exp_needed = 1; /* Exp needed for next level */ int class_modifier = 1; /* Modification to exp dependent upon class */ player_class = choose_class(); switch (player_class) { case 3: /* Warrior */ class_modifier = 335; break; case 4: /* Magic User */ class_modifier = 355; break; case 2: /* Thief */ class_modifier = 330; break; case 1: /* Cleric */ class_modifier = 342; break; default: error_message(); break; } for (player_level = 1; player_level <=NUMBER_OF_LEVELS; player_level++) { exp_needed = class_modifier * pow((double) player_level, 2.75); exp_needed *= log10((double) player_level); (void)printf("Level: %d Exp: %ld\n", player_level, exp_needed); } return; } void formula_3() { int player_level = 1; /* Player's Level */ int player_class = 0; /* Player's Class */ long exp_needed = 1; /* Exp needed for next level */ int class_modifier = 1; /* Modification to exp dependent upon class */ player_class = choose_class(); switch (player_class) { case 3: /* Warrior */ class_modifier = 10; break; case 4: /* Magic User */ class_modifier = 8; break; case 2: /* Thief */ class_modifier = 9; break; case 1: /* Cleric */ class_modifier = 8; break; default: error_message(); break; } for (player_level = 1; player_level <=NUMBER_OF_LEVELS; player_level++) { exp_needed = 200 * pow((double)player_level, 2); exp_needed *= pow(3, (double)(player_level/25)); exp_needed *= class_modifier; (void)printf("Level: %d Exp: %ld\n", player_level, exp_needed); } return; } void formula_4() { int player_level = 1; /* Player's Level */ long exp_needed = 1; /* Exp needed for next level */ for (player_level = 1; player_level <=NUMBER_OF_LEVELS; player_level++) { exp_needed = ((player_level * player_level) * player_level); if ((player_level / 20) != 0) exp_needed *= (100 * (player_level / 20)); else exp_needed *= 100; (void)printf("Level: %d Exp: %ld\n", player_level, exp_needed); } return; } +-----------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://cspo.queensu.ca/~fletcher/Circle/list-faq.html | +-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST