Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float oilPrice[34] = { 1.1f, 1.7f, 1.8f, 1.8f, 1.6f, 1.6f, 1.1f, 1.7f, 1.1f, 1.6f, 1.4f, 0.7f, 1.2f, 1.6f, 1.7f, 1.8f, 1.2f,
- 0.5f, 0.2f, 0.8f, 1.3f, 1.4f, 1.9f, 1.9f, 2.0f, 2.0f, 2.0f, 1.3f, 1.2f, 0.7f, 0.1f, 0.1f, 0.4f, 0.5f };
- int main(void) {
- int i;
- int sellAmount;
- int basicPumpCapacity = 8000;
- int basicTransportCapacity = 7000;
- int gameRound = 0;
- int playerNum = 0;
- int oilWell = 0;
- int cumPumpCap[12];
- int playerMoney[6];
- int pumpAmount[12];
- int tankWagonAmount[12];
- int pumpCapacity[12];
- int transportCapacity[12];
- srand((unsigned) time(NULL));
- for (i = 0; i < 12; i++) {
- cumPumpCap[i] = 0;
- pumpAmount[i] = 0;
- tankWagonAmount[i] = 0;
- transportCapacity[i] = 0;
- }
- for (i = 0; i < 6; i++) playerMoney[i] = 124321;
- pumpCapacity[oilWell] = (rand() % 10 + 1) * basicPumpCapacity;
- transportCapacity[oilWell] = (rand() % 10 + 1) * basicTransportCapacity;
- cumPumpCap[oilWell] += pumpCapacity[oilWell];
- printf("Raffinerieabnahmepreis: %.1f\n\n", oilPrice[gameRound]);
- /* Bis hierhin stimmmt der oilPrice */
- printf("Pumpenanzahl: %d\n", pumpAmount[oilWell]);
- printf("Versandmenge: %d\n", cumPumpCap[oilWell]);
- printf("Tankwagen: %d\n", tankWagonAmount[oilWell]);
- printf("LKW-Kapazit\x84t: %d\n", transportCapacity[oilWell]);
- printf("Kapital: %d\n\n", playerMoney[playerNum]);
- if (cumPumpCap[oilWell] == 0 || tankWagonAmount[oilWell] == 0) {
- printf("Wieviel Liter sollen weg? ");
- scanf("%d", &sellAmount);
- fflush(stdin);
- if (transportCapacity[oilWell] <= cumPumpCap[oilWell]) {
- if (sellAmount <= transportCapacity[oilWell]) {
- printf("path 1.1\n");
- printf("sellAmount %d\n", sellAmount);
- /* Ab hier bekommt oilPrice einen absonderlichen, negativen Wert, was man in der nächsten Ausgabe sieht */
- printf("oilPrice %d\n", oilPrice[gameRound]);
- printf("transportCapacity %d\n", transportCapacity[oilWell]);
- printf("cumPumpCap %d\n", cumPumpCap[oilWell]);
- printf("sellAmount * oilPrice %d\n", sellAmount * oilPrice[gameRound]);
- cumPumpCap[oilWell] -= sellAmount;
- playerMoney[playerNum] += sellAmount * oilPrice[gameRound];
- }
- else {
- printf("path 1.2\n");
- printf("sellAmount %d\n", sellAmount);
- printf("oilPrice %d\n", oilPrice[gameRound]);
- printf("transportCapacity %d\n", transportCapacity[oilWell]);
- printf("cumPumpCap %d\n", cumPumpCap[oilWell]);
- printf("sellAmount * oilPrice %d\n", sellAmount * oilPrice[gameRound]);
- cumPumpCap[oilWell] -= transportCapacity[oilWell];
- playerMoney[playerNum] += sellAmount * oilPrice[gameRound];
- }
- }
- else {
- if (sellAmount <= cumPumpCap[oilWell]) {
- printf("path 2.1\n");
- printf("sellAmount %d\n", sellAmount);
- printf("oilPrice %d\n", oilPrice[gameRound]);
- printf("transportCapacity %d\n", transportCapacity[oilWell]);
- printf("cumPumpCap %d\n", cumPumpCap[oilWell]);
- printf("sellAmount * oilPrice %d\n", sellAmount * oilPrice[gameRound]);
- cumPumpCap[oilWell] -= sellAmount;
- playerMoney[playerNum] += sellAmount * oilPrice[gameRound];
- }
- else {
- printf("path 2.2\n");
- printf("sellAmount %d\n", sellAmount);
- printf("oilPrice %d\n", oilPrice[gameRound]);
- printf("transportCapacity %d\n", transportCapacity[oilWell]);
- printf("cumPumpCap %d\n", cumPumpCap[oilWell]);
- printf("sellAmount * oilPrice %d\n", sellAmount * oilPrice[gameRound]);
- cumPumpCap[oilWell] -= cumPumpCap[oilWell];
- playerMoney[playerNum] += sellAmount * oilPrice[gameRound];
- }
- }
- printf("Kapital: %d\n", playerMoney[playerNum]);
- }
- else printf("Kein \x99l zum Verkaufen.\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement