rem Space Mines
rem Daniel Isaaman and Jenny Tyler
rem Translated to BB4Win by T Street
rem 14/03/2013
*font Courier New, 16b
colour4+128:cls:off
colour 3
mines% = rnd(5)+3 : rem number of mines
pop% = mines% * 10 + rnd(25) : rem number of people
cash% = rnd(10)*pop% : rem get a random amount of cash
minerals% = 0 : rem starting minerals
year% = 1
gameOver% = false
satisfaction% = 100
repeat
minePrice% = rnd(2000)+2000
foodPrice% = rnd(8) +2 : rem food price
mineralPrice% = rnd(4) + rnd(4) + rnd(4)
minMined% = (rnd(4)+4)*satisfaction% / 25 : rem amount of minerals produced
rem add minerals mined this year
minerals% = minerals% + minMined% * mines%
cls : rem clear the screen
print "SPACE MINES REPORT FOR YEAR "str$(year%)
print "-------------------------------"
print"There are "str$(pop%)" people in the colony."
print"You have "str$(mines%)" mines and £"str$(cash%)
print
print"Mines produced "str$(minMined%)" kg of minerals each."
print"You have "str$(minerals%)" kg of minerals in total."
print
print"(press any key to continue...)"
print
g% = get
print"SELLING"
print"-------"
print
print"Mineral selling price £"str$(mineralPrice%)
print
rem find how many minerals player should sell
repeat
print "Enter minerals to sell (max "str$(minerals%)") : ";
input " " sell%
until sell%>=0 and sell%<=minerals%
rem reduce amount of minerals
minerals% = minerals% - sell%
rem increase cash
cash% = cash% + sell% * mineralPrice%
print'"You now have £"str$(cash%)
print'"Mine selling price £"str$(minePrice% div 5)
print
repeat
input "How many mines to sell ?: " sell%
until sell%<=mines% and sell%>=0
rem reduce number of mines
mines% = mines% - sell%
rem increase cash
cash% = cash% + sell%*minePrice% div 5
print'"You now have £"str$(cash%)
print
print
print "BUYING"
print "------"
print
print "Food price £"str$(foodPrice%)" per person."
print "Current population "str$(pop%):print
repeat
input "Buy food for how many people? : " buy%
rem check if you can afford that much
until buy%>=0 and buy% * foodPrice% <= cash%
rem adjust funds
cash% = cash% - (buy% * foodPrice%)
print'"You now have £"str$(cash%)
print
rem change satisfaction
rem based on how much food you bought
if buy%/pop% <0.8 then
rem you did not buy enough food
rem reduce satisfaction
satisfaction% = satisfaction% - rnd(10)
endif
if buy%/pop% >1.2 then
rem you bought plenty of food
rem increase satisfaction
satisfaction% = satisfaction% + rnd(10)
endif
print
rem check if you can afford a new mine
if cash%>= minePrice% then
print'"You can now build more mines"
print"Mine build cost £"str$(minePrice%)'
repeat
input "Enter how many mines : " build%
until build% >=0 and build%*minePrice%<=cash%
rem adjust number of mines
mines% = mines% + build%
rem adjust cash
cash% = cash% - build% * minePrice%
print'"You now have £"str$(cash%)
endif
rem check satisfaction
if pop% div mines% < 10 then
print
print "You are over-working the population!"
satisfaction% = satisfaction% - rnd(15)
endif
rem if satisfaction is high then people join
if satisfaction% > 110 then
arrive% = rnd(5)+1
print
printstr$(arrive%)" people join the colony!"
pop% = pop% + arrive% : rem adjust population
endif
rem if satisfaction is low then people leave
if satisfaction%<80 then
leave% = rnd(5)+1
print
printstr$(leave%)" people have quit!"
pop% = pop% - leave% : rem adjust population
endif
rem if the satisfaction is very low then the people revolt
if satisfaction%<70 then
print
print "The workers complain of poor working conditions!"
endif
rem chance of end of game
if satisfaction%<50 then
print
print "The workers have revolted!"
gameOver% = true
endif
rem check for events
rem small chance of a mine collapse
if mines%>2 then
if rnd(50)<= mines% then
print "Explosion in mine "str$(mines%)
dead% = rnd(mines%*2)+1
printstr$(dead%)" people die!"
pop% = pop% - dead%
mines% = mines% - 1
satisfaction% = satisfaction% - rnd(15)
endif
endif
rem 1% chance of a radiation leak
if rnd(100)= 1 then
print "Radiation leak - many die!"
rem integer division
rem divide population in half
pop% = pop% div 2
satisfaction% = satisfaction% - rnd(15)
endif
g% = get
rem add one on to the year
year% = year% + 1
until gameOver%
print"GAME OVER!"
Again, there is loads of scope for improvement here. Have fun!