Whitehall game (BBC BASIC)

discussion of beeb/electron applications, languages, utils and educational s/w
Post Reply
User avatar
lurkio
Posts: 2069
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Whitehall game (BBC BASIC)

Post by lurkio » Fri May 03, 2019 9:48 pm

From the May 1982 issue of Practical Computing magazine, here's Whitehall by SN Goodwin, a text-only game that simulates your rise from Parliamentary Private Secretary to Prime Minister (if you can get that far), in about 200 lines of code. (Simpler times.) Originally published as a listing in Apple Integer BASIC. Converted by me to BBC BASIC. (Please send bug reports.)

Play online:
Listing:

Code: Select all

  90 REM
 100 MODE7:PRINT:A$="":A%=0:C%=0:D%=0:E%=0:F%=0:G%=0:H%=0:J%=0:M%=0:P%=0:R%=0:T%=0:X%=0:Y%=0
 110 PRINT"****************************************";
 120 PRINT"*                                      *";
 130 PRINT"*           W H I T E H A L L          *";
 140 PRINT"*                                      *";
 150 PRINT"*      GAME (C) 1980 S.N. GOODWIN.     *";
 160 PRINT"*                                      *";
 170 PRINT"****************************************";
 175 PROCd(1000)
 180 PRINT:INPUT "DO YOU KNOW THE RULES? "A$:IFRND(-TIME)
 190 IF LEFT$(A$,1)<>"Y" THEN 1800
 198 REM
 199 REM  INITIALISE *****
 200 H%=40+FNrnd(21):E%=35+FNrnd(31)
 210 M%=45+FNrnd(21)
 220 T%=0:A%=0:R%=1
 230 CLS
 298 REM
 299 REM  MAIN LOOP *****
 300 T%=T%+1:A%=A%+1
 310 PRINT:PRINT
 320 PRINTTAB(16)"YEAR ";T%:PRINT
 330 IF T%<30+R%+FNrnd(6+R%) THEN 370
 340 PROCp("WELL DONE, SENILE... YOUR CONSTITUENCY PARTY 'ENCOURAGE' YOUR RETIREMENT FROM PARLIAMENT.")
 350 GOTO2000
 360 PRINT "TOTAL MUST ADD UP TO 20":PRINT
 370 INPUT "ENTER MINISTERIAL DUTIES: "D%:PRINT
 380 INPUT "ENTER CONSTITUENCY DUTIES: "C%:PRINT
 390 INPUT "ENTER PARLIAMENTARY DUTIES: "P%:PRINT
 400 IF D%+P%+C%>20 THEN 360
 410 F%=20-D%-P%-C%
 420 PRINT"REMAINDER (FAMILY DUTIES): ";F%:PRINT
 430 IF A%=5 OR A%=4+FNrnd(2) THEN 1500
 440 IF A%<>FNrnd(30) THEN 470
 450 PROCp("CRISIS !! EARLY ELECTION FORCED UPON GOVERNMENT."):PRINT
 460 GOTO1500
 470 REM  CRISIS, WHAT CRISIS ?
 498 REM
 499 REM  CALCULATIONS *****
 500 H%=H%*((D%-5)+(P%-5)*2)/50+H%-1
 510 IF H%>100 THEN H%=100-FNrnd(15)
 520 IF H%<0 THEN H%=FNrnd(6)
 530 E%=E%*((C%-5)*3+(D%-5)+(P%-5)+(M%-50)/5)/150+E%-A%+C%-1
 540 IF E%>100 THEN E%=99-FNrnd(10)
 550 IF E%<0 THEN E%=FNrnd(3)
 560 M%=M%*(F%-5*3+(E%-40)/10+(H%-50)/10)/100+M%-A%
 570 IF M%>100 THEN M%=100-FNrnd(5)
 580 IF M%<0 THEN M%=FNrnd(15)
 590 GOSUB1300
 598 REM
 599 REM  PRESET EVENTS *****
 600 IF D%>FNrnd(4) THEN 640
 610 PROCp("PARLIAMENT IS CONCERNED ABOUT YOUR MINISTERIAL PERFORMANCE.")
 620 PROCp("A PUBLIC ENQUIRY IS SET UP TO CHECK YOUR ACTIVITIES."):PRINT
 630 E%=E%*14/15:M%=M%*12/13:H%=H%*8/9
 640 IF C%>FNrnd(5) THEN 720
 650 PRINT"YOUR LOCAL PARTY ARE ANNOYED ABOUT YOUR ATTITUDE."
 660 PRINT"THEY STAGE A VOTE OF NO-CONFIDENCE.":PRINT
 670 J%=31-E%/3-C%:IF J%<1 THEN J%=FNrnd(3)
 680 PRINT"VOTES IN YOUR FAVOUR ....             ";31-J%
 690 PROCd(700)
 700 PRINT"VOTES AGAINST YOU .......             ";J%:PRINT
 710 E%=E%*32-J%/31:M%=M%*(J%+30)/60
 720 IF P%>FNrnd(4) THEN 760
 730 PRINT"MAJOR INTERNATIONAL SCANDAL OVER "
 740 PRINT"BRITISH GOVERNMENT DISORGANISATION.":PRINT
 750 M%=M%*10/11:H%=H%*15/16:E%=E%*13/14
 760 IF F%>FNrnd(4) THEN 800
 770 PRINT"FAMILY CRISIS LEAKED TO MEDIA."
 780 PRINT"CONSIDERABLE BAD PUBLICITY GENERATED.":PRINT
 790 M%=M%*3/5:E%=E%*12/13:H%=H%+FNrnd(7)-3
 800 J%=FNrnd(10):IF J%=0 THEN 900
 810 IF J%=1 THEN 950
 820 IF J%=2 OR J%=5 THEN 1000
 830 IF (J%=3 AND R%<>9) OR (J%=3 AND T%>30) THEN 1060
 840 IF (J%=4 AND R%<>9 AND T%>6) OR (J%=4 AND T%>30) THEN 1070
 850 PRINT"GENERALLY AN UNEVENTUL YEAR.":PRINT
 860 GOTO1200
 900 PRINT"FAMINE IN THE FAR EAST.":PRINT
 910 INPUT"DO YOU SEND AID? "A$:PRINT
 920 IF LEFT$(A$,1)<>"Y" THEN 940
 930 E%=E%*(30-FNrnd(11))/25:M%=M%*10/9:H%=H%*10/11:GOTO1200
 940 E%=E%*(30-FNrnd(21))/25:GOTO1200
 950 PRINT"FOREIGN REFUGEE CRISIS.":PRINT
 960 INPUT"WILL YOU ACCEPT IMMIGRANTS? "A$:PRINT
 970 IF LEFT$(A$,1)<>"Y" THEN 990
 980 E%=E%*(30-FNrnd(11))/25:M%=M%*10/9:GOTO1200
 990 E%=E%*(30-FNrnd(21))/25:H%=H%*13/12:GOTO1200
1000 PRINT"TIME FOR A PAY INCREASE FOR MPs? ":PRINT
1010 PRINT"WHAT INCREASE DO YOU SUGGEST(%)?":J%=FNrnd(5)
1020 PRINT"ELECTORATE SUGGEST ";J%*3+5;" %"
1030 PRINT"SOME MPs WANT ";J%*5+20;" %";:PRINT
1040 INPUTX%:E%=E%+(J%*4+6)-X%
1050 M%=M%-(J%*4)+X%:H%=H%-(J%*4+6)+X%:GOTO1200
1060 PRINT"YOUR SUPERIOR IS SUDDENLY TAKEN ILL.":GOTO1080
1070 PRINT"YOUR SUPERIOR DECIDES TO RETIRE."
1080 PRINT"WILL YOU TAKE HIS PLACE...?":PRINT
1090 PROCd(800)
1100 IF H%+M%*5>FNrnd(70)+40 THEN 1120
1110 PRINT"YOU KEEP YOUR PRESENT POSITION.":GOTO1400
1120 PRINT"YOU SUCCEED: NEW RANK ";:R%=R%+1:GOTO1400
1198 REM
1199 REM  END OF LOOP *****
1200 IF H%>100 THEN H%=100-FNrnd(15)
1210 IF H%<0 THEN H%=FNrnd(6)
1220 IF E%>100 THEN E%=99-FNrnd(14)
1230 IF E%<0 THEN E%=FNrnd(3)
1240 IF M%>100 THEN M%=99-FNrnd(5)
1250 IF M%<0 THEN M%=FNrnd(10)+2
1260 GOSUB1300
1270 GOTO300
1280 REM
1290 REM
1298 REM
1299 REM  REPORT *****
1300 PRINT"      CURRENT OPINION POLL.":PRINT
1310 PRINT"ELECTORATE SUPPORT ";E%;" %"
1320 PRINT"SUPPORT OF MPs     ";H%;" %"
1330 PRINT"YOUR MORALE RATING ";M%:PRINT
1340 IF M%>FNrnd(30) THEN 1370
1350 PRINT"URGH! YOU DECIDE TO RESIGN FOR PERSONAL REASONS."
1360 GOTO2000
1370 PROCd(1000)
1380 RETURN
1398 REM
1399 REM  RANK *****
1400 IF R%<>1 THEN 1410 ELSEPROCp("PARLIAMENTARY PRIVATE SECRETARY."):GOTO1480
1410 IF R%<>2 THEN 1420 ELSEPROCp("PARLIAMENTARY SECRETARY."):GOTO1480
1420 IF R%<>3 THEN 1430 ELSEPROCp("JUNIOR MINISTER."):GOTO1480
1430 IF R%<>4 THEN 1440 ELSEPROCp("CABINET MINISTER."):GOTO1480
1440 IF R%<>5 THEN 1450 ELSEPROCp("SECRETARY OF STATE."):GOTO1480
1450 IF R%<>6 THEN 1460 ELSEPROCp("PRIME MINISTER."):GOTO1480
1460 PROCp("LIFE PEER _ YOU ARE 'PROMOTED' TO THE HOUSE OF LORDS.")
1470 PRINT"YOUR CAREER IS OVER.":GOTO2000
1480 PRINT:GOTO1200
1498 REM
1499 REM  ELECTION *****
1500 PRINT"A GENERAL ELECTION IS CALLED.":PRINT
1510 INPUT"WILL YOU STAND FOR 'DEMOCRAT'"'"RE-ELECTION? "A$
1520 IF LEFT$(A$,1)<>"Y" THEN 2000
1530 PRINT:PRINT"RESULTS ARE COMING THROUGH.";
1540 FORX%=1TO6:FORY%=1TO300
1550 NEXTY%:PRINT".";:NEXTX%
1560 PRINT:PRINT
1570 A%=25000-(E%*260)-FNrnd(400)-(R%^4)
1575 IF A%<1000 THEN A%=1000+FNrnd(1000)
1580 PRINT"LOYALIST PARTY            ";A%
1590 PROCd(500):PRINT
1600 PRINT"PROGRESS PARTY            ";400+FNrnd(200)
1610 PROCd(700):PRINT
1620 PRINT"BIRTHDAY PARTY            ";INT(25000/365)
1630 PROCd(900):PRINT
1640 PRINT"ENTROPY PARTY             ";FNrnd(200)
1650 PROCd(1100):PRINT
1660 PRINT"DEMOCRATIC PARTY (YOU)    ";25000-A%
1670 PROCd(1300)
1680 IF A%>12500 THEN 1700
1690 PRINT"WELL DONE.":PRINT:A%=0:GOTO500
1700 PRINT"YOU SEEM TO HAVE LOST!"
1710 INPUT"DO YOU DEMAND A RECOUNT? "A$
1720 IF LEFT$(A$,1)<>"Y" THEN 2000
1730 IF Y%<>300 THEN 1740
1735 PRINT"SORRY, NOT ANOTHER!":GOTO2000
1740 Y%=300:PRINT:PRINT"O.K. HERE GOES....."
1750 PROCd(900)
1760 GOTO1560
1798 REM
1799 REM  GAME RULES *****
1800 CLS
1810 PRINT'"         WHITEHALL   GAME RULES":PRINT
1820 PROCp("YOU START THE GAME AS A PARLIAMENTARY PRIVATE SECRETARY, AND AIM TO RISE TO THE RANK OF PRIME MINISTER BY MAKING DECISIONS ABOUT HOW MUCH TIME YOU SPEND ON THESE ACTIVITIES:"):PRINT
1840 PRINT"        1. PARLIAMENTARY DUTIES."
1850 PRINT"        2. MINISTERIAL RESPONSIBILITIES.";
1860 PRINT"        3. CONSTITUENCY DUTIES."
1870 PRINT"        4. FAMILY RESPONSIBILITIES.":PRINT
1880 PROCp("YOU HAVE 20 POINTS TO SPLIT BETWEEN THESE EACH YEAR."):PRINT
1890 PROCp("YOU MAY BE CALLED UPON TO MAKE POLICY DECISIONS AS PLAY PROCEEDS."):PRINT
1900 PRINT:INPUT"READY FOR PAGE 2 ? "A$
1910 CLS
1920 PRINT'"WHITEHALL GAME RULES : SECOND PAGE.":PRINT
1930 PROCp("YOUR DECISIONS WILL DETERMINE THREE QUANTITIES _ IF ANY ONE FALLS TOO LOW THE GAME ENDS."):PRINT
1940 PRINT"       1. PERSONAL MORALE."
1950 PRINT"       2. PARLIAMENTARY SUPPORT."
1960 PRINT"       3. ELECTORATE SUPPORT.":PRINT
1970 PRINT"GOOD LUCK":PRINT
1980 INPUT"READY TO START? "A$
1990 GOTO200
1998 REM
1999 REM  END OF GAME *****
2000 PROCd(1599)
2010 REM CLS
2020 PRINT''TAB(15)"GAME OVER.":PRINT
2025 PRINTTAB(9)"YOU LASTED ";T%;" YEARS.":PRINT
2030 PRINT"TYPE YES IF YOU WOULD LIKE TO PLAY AGAIN"
2040 INPUTA$:IF LEFT$(A$,1)="Y" THEN 100
2050 PRINT:PRINT"PROGRAM END."
2060 END
2999 REM *** Word-wrap: l%=line-length
3000 DEFPROCp(s$):LOCALn%,a%,z%,w%,l%:l%=40:n%=LENs$:a%=1:REPEATz%=INSTR(s$," ",a%):w%=z%-a%:IF(w%-1<l%ANDl%-POS<w%)OR(z%=0ANDn%-a%<l%ANDl%-POS<n%+1-a%)PRINT
3010 PRINTMID$(s$,a%,w%);:IFz%=0UNTILTRUE:PRINT:ENDPROC ELSEa%=z%+1:IFPOS>0PRINT" ";:UNTILFALSE ELSEUNTILFALSE
3099 REM *** Apple Integer BASIC RND function
3100 DEFFNrnd(n%):=RND(n%)-1
3199 REM *** Delay loop
3200 DEFPROCd(d%):LOCAL i%:FORi%=1TOd%*10:NEXT:ENDPROC

1.jpg
3.jpg
2.jpg
4.jpg
Whitehall.png
I know! Let's have a referendum...

:idea:

EDIT: Minor updates to listing.
EDIT2: Improved word-wrap.
Last edited by lurkio on Sun May 05, 2019 5:04 pm, edited 2 times in total.

User avatar
AndyF
Posts: 1229
Joined: Sat Feb 23, 2008 10:16 pm
Location: Derby
Contact:

Re: Whitehall game (BBC BASIC)

Post by AndyF » Sat May 04, 2019 8:48 am

These kind of games are quite fun a bit like 'Millionaire' and there's another one or two if I remember correctly too. I first found those on another platform them realised they were also available on the 'B as well. Millionaire was a bit too tricky but as it was Basic it was not outside my scope to erm 'tweak' it a fraction. :)
wh.png
wh.png (7.02 KiB) Viewed 253 times
=D>

EDIT... Probably me but I could not find a way to search for and download it from the online variant so I quickly made this:

Whitehall.ssd
(7.5 KiB) Downloaded 9 times
:mrgreen:
Last edited by AndyF on Sat May 04, 2019 9:02 am, edited 3 times in total.
Andy

* NEW * The Jetset Willy and Manic Miner community :)

Adventure games ported across to the BBC (in progress) as soon as I can find some time!

User avatar
leenew
Posts: 3883
Joined: Wed Jul 04, 2012 3:27 pm
Location: Doncaster, Yorkshire
Contact:

Re: Whitehall game (BBC BASIC)

Post by leenew » Sat May 04, 2019 9:15 am

Good work Lurkio =D>

Here is an article by the prolific Simon Goodwin all about his days writing for computer mags: http://simon.mooli.org.uk/AF/article/magazine.html

Lee.

User avatar
lurkio
Posts: 2069
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Whitehall game (BBC BASIC)

Post by lurkio » Sat May 04, 2019 12:28 pm

AndyF wrote:
Sat May 04, 2019 8:48 am
Millionaire was a bit too tricky but as it was Basic it was not outside my scope to erm 'tweak' it a fraction.
Similarly, it's quite easy to lose Whitehall because of a low morale rating: line 1340.

:idea:

User avatar
lurkio
Posts: 2069
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Whitehall game (BBC BASIC)

Post by lurkio » Sat May 04, 2019 12:31 pm

leenew wrote:
Sat May 04, 2019 9:15 am
Here is an article by the prolific Simon Goodwin all about his days writing for computer mags: http://simon.mooli.org.uk/AF/article/magazine.html
Ooh, controversy..!:
Simon N Goodwin wrote:... there was a blatant rip-off - a game dubbed 'Westminster' for an expanded VIC-20, which just happened to use exactly the same variable names, line numbers, program structure and even comments as 'Whitehall', a listing I'd sold to Practical Computing a couple of years earlier. The most significant differences, other than adaptations for the small VIC-20 display, were that the plagiarist had got the spelling of words like "parliament", "prime minister" and "scandal" wrong.

In the next issue editor Elspeth Joiner wrote "thank you for pointing that out to us Simon and I am sorry to say that this case is not the only one to have arisen ... As there are so many computer magazines now on sale we have to rely on the author to tell us whether or not his/her game has been copied from someone else's work, as it would be an almost impossible task to check every program in every issue of every magazine on sale to the public" ("The Runaway Robot Replies", Games Computing, March 1984, page 68).
:shock:

scruss
Posts: 120
Joined: Sun Jul 01, 2018 3:12 pm
Location: Toronto
Contact:

Re: Whitehall game (BBC BASIC)

Post by scruss » Sat May 04, 2019 5:59 pm

Type-ins got ripped off all the time. While there was more demand for magazines than there was pay for rigorous editors, it was hard to stop.

Simon Goodwins' UK government simulator* wasn't the first type-in of this kind. I remember playing one on the PET that started off asking ‘[M]ONETARIST or [K]EYNESIAN?’ a couple of years before his came out. Even really simple simulators like Hamurabi (sic; somewhat deftly ripped off as Yellow River Kingdom) can be quite fun. Fun, that is, until you work out the multipliers by peeking at the source. Add a little randomness and it becomes much more engaging. I don't know how many commuting hours I've spent on Dope Wars on the Palm and Android

*: I suspect an emulator of the current one could be managed fairly simply with a few random pokes and see how long things keep working …

Post Reply