Author Topic: WHILE AND DO LOOP CYCLES  (Read 8322 times)

0 Members and 1 Guest are viewing this topic.

Offline Kiara87

  • Forum Regular
  • Posts: 164
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #15 on: November 08, 2020, 08:50:41 am »
@Kiara - Ce ne può essere solo uno! Kiara, comprati per un libro per QBasic e "Code Complete" in italiano. Davvero! :-;

https://www.youtube.com/watch?v=XfjJzL6yWfU

after doing a bit of research i think a qbasic book doesn't learn programming
programming is a way of thinking
if i read a qbasic book i will only learn the language syntax
programming is knowing how to create algorithms and think like a programmer
I remember when I wanted to do my lotto schedule
and the user @TempodiBasic 
he had mentioned to me to create a pseudocode or a flowchart now I can understand why
but I didn't even know what it was
and I didn't even know how to define the problem well
A. Risolvere ogni problema rispettando le cinque fasi per una corretta programmazione:
1. Descrizione del problema
2. Definizione dei dati (variabili e costanti di input, di output e di lavoro
3. Pseudocodifica dell'algoritmo
4. Diagramma a blocchi (FLOWCHART)
5. Codice QB64

-----------------------------------------
ITALIANO
A. Risolvere ogni problema rispettando le cinque fasi per una corretta programmazione:
1. Descrizione del problema
2. Definizione dei dati (variabili e costanti di input, di output e di lavoro
3. Pseudocodifica dell'algoritmo
4. Diagramma a blocchi
5. Codice QB64

se il problema non viene descritto bene non sarà possibile continuare se il passo 1 e descritto bene e anche il passo 2
poi si puo passare a l'algoritmo
è infine la parte più facile
implementazione a linguaggio di programmazione

I ask you programmers what you think?
se avessi solo un'ora per salvare il mondo, passerei 55 minuti per definire bene il problema e 5 a trovare la soluzione

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #16 on: November 08, 2020, 12:13:48 pm »
Quote
after doing a bit of research i think a qbasic book doesn't learn programming
programming is a way of thinking
if i read a qbasic book i will only learn the language syntax
programming is knowing how to create algorithms and think like a programmer
I remember when I wanted to do my lotto schedule
and the user @TempodiBasic
he had mentioned to me to create a pseudocode or a flowchart now I can understand why
but I didn't even know what it was
and I didn't even know how to define the problem well

I don't think I've ever used a flowchart, that is something they formally taught in Computer Science back in the day.

Define the problem, again pretty formal, either you have an idea what you want to accomplish or you don't. Classic problems might get the ball rolling.

Might make a commented list of things that need to be done in the order of doing.
Like going on vacation make a list of things you will need variables, arrays, data structures.

I have daily used a spiral notebooks (not Golden, in fact most is throw away trash but handy to get ideas out of my head) and worked out sketches of how I might do this or that critical operation in program. Much of it is habitual, establish habits of how to do this or that thing.

Classic programming problems to develop habits are:
Make a calculator start with add and subtract and build from there.
Make an editor, start with a word or a line, graduate to paragraphs then pages.
Make a text file reader and display, graduate to binary or hexadecimal.
Make a Tic Tac Toe Game try to do more and more with less lines try other classic games make you own variations.
Make drawings and then animate them.
Make a data base of friends and relatives or of your spending and budget.

Learn how to get input from mouse, divide screen into different squares and detect which square is being clicked.
Learn how to get key input in different ways ie difference between _KEYDOWN and _KEYHIT and INKEY$
Learn how to access files and store stuff you want to save.
Learn how to move stuff and display stuff on the screen.
« Last Edit: November 08, 2020, 12:23:22 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #17 on: November 08, 2020, 12:37:43 pm »
When you can see in your mind's eye what you want to happen, then you have defined the problem "good enough".

Offline Kiara87

  • Forum Regular
  • Posts: 164
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #18 on: November 08, 2020, 01:49:35 pm »
When you can see in your mind's eye what you want to happen, then you have defined the problem "good enough".

Thanks for your suggestions @bplus

I know you are a very good programmer

I just asked why other Italian programmers suggested me to use pseudocode and flowchart to learn programming

is they advised me not to focus too much on the programming language

because it would only serve to learn the syntax

then I wonder if you have never used pseudocode and flowchart then you can also learn by studying the syntax of the language?

maybe searching on google only caused me confusion... but I really want to learn

that's the reason for so many questions I ask here in this forum

and I also wanted your opinion that you are very good at programming

even if you use different programming styles

but you are able to solve any problem

I hope to be able to solve them and learn one day

thanks for your attention and for answering me
se avessi solo un'ora per salvare il mondo, passerei 55 minuti per definire bene il problema e 5 a trovare la soluzione

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #19 on: November 08, 2020, 02:44:27 pm »
@Kiara87  I have started this to give you some practice: https://www.qb64.org/forum/index.php?topic=3224.msg125026#msg125026

Offline Kiara87

  • Forum Regular
  • Posts: 164
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #20 on: November 08, 2020, 06:57:51 pm »


Here for the coder is easier to modify the instruction if he must add a new function to the calculator for example Substraction! :-)
but using the structured technique you can reach more complex code without loose its readableness
this is an example
Code: QB64: [Select]
  1. DEFINT A-Z
  2. DECLARE FUNCTION chot (t)
  3. DECLARE FUNCTION chou (t)
  4. DECLARE FUNCTION di (d1, d2)
  5. DECLARE FUNCTION lts$ (nu)
  6. DECLARE FUNCTION ltsb$ (nu&)
  7. DECLARE FUNCTION ner (dn, max)
  8. DECLARE FUNCTION nerb& (dn, max&)
  9. DECLARE FUNCTION nerk$ ()
  10. DECLARE SUB act (rl, t)
  11. DECLARE SUB ar (t)
  12. DECLARE SUB auc (t)
  13. DECLARE SUB bca (t, houf, hotf)
  14. DECLARE SUB box ()
  15. DECLARE SUB broke (t)
  16. DECLARE SUB buhot (t)
  17. DECLARE SUB buhou (t)
  18. DECLARE SUB ce (dn, tx$)
  19. DECLARE SUB chk (l, m, h)
  20. DECLARE SUB clk (se!)
  21. DECLARE SUB cont (t, nos)
  22. DECLARE SUB crd ()
  23. DECLARE SUB dcha (t)
  24. DECLARE SUB dche (t)
  25. DECLARE SUB dy (wt)
  26. DECLARE SUB fd (rl1, rl2, d1, d2, d3, d4)
  27. DECLARE SUB gov (t)
  28. DECLARE SUB inc (t)
  29. DECLARE SUB init ()
  30. DECLARE SUB inv ()
  31. DECLARE SUB lil (wt)
  32. DECLARE SUB lop (rl, t)
  33. DECLARE SUB mb ()
  34. DECLARE SUB md ()
  35. DECLARE SUB mini (gr)
  36. DECLARE SUB mob (t)
  37. DECLARE SUB more (t)
  38. DECLARE SUB mort (t)
  39. DECLARE SUB move (dist, t)
  40. DECLARE SUB noo (t)
  41. DECLARE SUB opt (t)
  42. DECLARE SUB pay (t, cge)
  43. DECLARE SUB pim (gr, l, m, h)
  44. DECLARE SUB popp (t, cge)
  45. DECLARE SUB quit ()
  46. DECLARE SUB rlc (t)
  47. DECLARE SUB rules ()
  48. DECLARE SUB save (t)
  49. DECLARE SUB scha ()
  50. DECLARE SUB sche ()
  51. DECLARE SUB short (t, l, m, h)
  52. DECLARE SUB shot (t)
  53. DECLARE SUB shou (t)
  54. DECLARE SUB sml (wt)
  55. DECLARE SUB swbd ()
  56. DECLARE SUB swbs ()
  57. DECLARE SUB tiny (wt)
  58. DECLARE SUB tj (t)
  59. DECLARE SUB tn (t)
  60. DECLARE SUB trade ()
  61. DECLARE SUB unm (t)
  62. DECLARE SUB upd ()
  63. DECLARE SUB utc (t)
  64. DECLARE SUB vwd ()
  65. TYPE dd
  66. ttl AS STRING * 21
  67. ab AS STRING * 5
  68. sty AS STRING * 1
  69. rhot AS INTEGER
  70. stat AS INTEGER
  71. TYPE pl
  72. ft AS STRING * 8
  73. tk AS STRING * 1
  74. chag AS INTEGER
  75. cheg AS INTEGER
  76. DIM SHARED sf!, uf!, j, bn, x, q, fr&, bhu, bht, top(1 TO 6) AS STRING * 7, mdd(1 TO 6) AS STRING * 7, bot(1 TO 6) AS STRING * 7, cha(1 TO 16), che(1 TO 16), lot(39) AS dd, st(1 TO 2) AS pl
  77. mb
  78. md
  79. swbd
  80. cont t, nos
  81. IF nos THEN
  82. rules
  83. bhu = 32
  84. bht = 12
  85. init
  86. t = 1
  87. IF st(1).whr > -10 THEN
  88. LOCATE lot(st(1).whr).od, lot(st(1).whr).oa
  89. PRINT st(1).tk
  90. IF st(2).whr > -10 THEN
  91. LOCATE lot(st(2).whr).id, lot(st(2).whr).ia
  92. PRINT st(2).tk
  93. IF st(t).whr > -10 THEN tn t ELSE tj t
  94. t = 3 - t
  95. 1
  96. CASE 53
  97. nos = -1
  98. CASE 255
  99. ce 10, "The save is faulty."
  100. ce 11, "I will delete it."
  101. p
  102. nos = -1
  103. KILL "monopoly.dat"
  104. box
  105. ce 5, "Crash " + lts(ERR) + " has happened."
  106. ce 7, "Take note of what was going on just before the crash."
  107. ce 9, "Contact me at grahambhg@yahoo.com,"
  108. ce 10, "and I will see what I can do."
  109. crd
  110. DATA ,,o,,,,,,,,,,23,78,21,72,,
  111. DATA Mediterranean Avenue,MEDIT,b,60,2,10,30,90,160,250,50,5,23,68,21,68,22,65
  112. DATA ,,o,,,,,,,,,,23,61,21,61,,
  113. DATA Baltic Avenue,BALTI,b,60,4,20,60,180,320,450,50,5,23,54,21,54,22,51
  114. DATA ,,o,,,,,,,,,,23,47,21,47,,
  115. DATA Reading Railroad,READR,r,200,,25,50,100,200,,,7,23,40,21,40,,
  116. DATA Oriental Avenue,ORIEN,b,100,6,30,90,270,400,550,50,11,23,33,21,33,22,30
  117. DATA ,,o,,,,,,,,,,23,26,21,26,,
  118. DATA Vermont Avenue,VERMO,b,100,6,30,90,270,400,550,50,11,23,19,21,19,22,16
  119. DATA Conneticut Avenue,CONNE,b,120,8,40,100,300,450,600,50,11,23,12,21,12,22,9
  120. DATA ,,o,,,,,,,,,,23,2,21,8,,
  121. DATA Saint Charles Place,STCHA,b,140,10,50,150,450,625,750,100,13,20,2,20,9,20,8
  122. DATA Electric Company,ELECT,u,150,,,,,,,,7,18,2,18,9,,
  123. DATA States Avenue,STATE,b,140,10,50,150,450,625,750,100,13,16,2,16,9,16,8
  124. DATA Virginia Avenue,VIRGI,b,160,12,60,180,500,700,900,100,13,14,2,14,9,14,8
  125. DATA Pennsylvania Railroad,PENRR,r,200,,25,50,100,200,,,7,12,2,12,9,,
  126. DATA Saint James Place,STJAM,b,180,14,70,200,550,750,950,100,12,10,2,10,9,10,8
  127. DATA ,,o,,,,,,,,,,8,2,8,9,,
  128. DATA Tennessee Avenue,TENNE,b,180,14,70,200,550,750,950,100,12,6,2,6,9,6,8
  129. DATA New York Avenue,NEWYO,b,200,16,80,220,600,800,1000,100,12,4,2,4,9,4,8
  130. DATA ,,o,,,,,,,,,,1,2,3,8,,
  131. DATA Kentucky Avenue,KENTU,b,220,18,90,250,700,875,1050,150,4,1,12,3,12,2,15
  132. DATA ,,o,,,,,,,,,,1,19,3,19,,
  133. DATA Indiana Avenue,INDIA,b,220,18,90,250,700,875,1050,150,4,1,26,3,26,2,29
  134. DATA Illinois Avenue,ILLIN,b,240,20,100,300,750,925,1100,150,4,1,33,3,33,2,36
  135. DATA B. & O. Railroad,B&ORR,r,200,,25,50,100,200,,,7,1,40,3,40,,
  136. DATA Atlantic Avenue,ATLAN,b,260,22,110,330,800,975,1150,150,14,1,47,3,47,2,50
  137. DATA Ventnor Avenue,VENTN,b,260,22,110,330,800,975,1150,150,14,1,54,3,54,2,57
  138. DATA Water Works,WATER,u,150,,,,,,,,7,1,61,3,61,,
  139. DATA Marvin Gardens,MARVI,b,280,24,120,360,850,1025,1200,150,14,1,68,3,68,2,71
  140. DATA ,,o,,,,,,,,,,1,78,3,72,,
  141. DATA Pacific Avenue,PACIF,b,300,26,130,390,900,1100,1275,200,10,4,78,4,71,4,72
  142. DATA North Carolina Avenue,NORTH,b,300,26,130,390,900,1100,1275,200,10,6,78,6,71,6,72
  143. DATA ,,o,,,,,,,,,,8,78,8,71,,
  144. DATA Pennsylvania Avenue,PENAV,b,320,28,150,450,1000,1200,1400,200,10,10,78,10,71,10,72
  145. DATA Short Line,SHORT,r,200,,25,50,100,200,,,7,12,78,12,71,,
  146. DATA ,,o,,,,,,,,,,14,78,14,71,,
  147. DATA Park Place,PARKP,b,350,35,175,500,1100,1300,1500,200,9,16,78,16,71,16,72
  148. DATA ,,o,,,,,,,,,,18,78,18,71,,
  149. DATA Boardwalk,BOARD,b,400,50,200,600,1400,1700,2000,200,9,20,78,20,71,20,72
  150.  
  151. SUB act (rl, t)
  152. SELECT CASE st(t).whr
  153. ce 10, "You landed on Go."
  154. IF bn THEN
  155. st(t).c = st(t).c + 200
  156. ce 11, "Collect $400."
  157. ce 11, "Collect $200."
  158. p
  159. CASE 2, 17, 33
  160. dche t
  161. inc t
  162. CASE 7, 22, 36
  163. dcha t
  164. CASE 10
  165. ce 10, "Just visiting"
  166. p
  167. CASE 20
  168. ce 10, "Free Parking"
  169. ce 11, "You get $" + ltsb(fr&)
  170. st(t).c = st(t).c + fr&
  171. fr& = 500
  172. p
  173. CASE 30
  174. ar t
  175. CASE 38
  176. ce 10, "Luxury Tax. Pay $75."
  177. p
  178. pay t, 75
  179. IF j THEN fr& = fr& + 75
  180. p
  181. lop rl, t
  182.  
  183. tx$ = LCASE$(INKEY$)
  184. LOOP UNTIL tx$ > ""
  185. ak = tx$
  186.  
  187. SUB ar (t)
  188. ce 9, RTRIM$(st(t).ft) + " will be sent directly to Jail."
  189. p
  190. IF t = 1 THEN LOCATE lot(st(1).whr).od, lot(st(1).whr).oa ELSE LOCATE lot(st(2).whr).id, lot(st(2).whr).ia
  191. PRINT " "
  192. st(t).whr = -10
  193. st(t).dc = 0
  194. box
  195.  
  196. SUB auc (t)
  197. lwst = INT(.5 + lot(st(t).whr).c / 10)
  198. bj = INT(.5 + lwst / 2)
  199. nw = lwst
  200. box
  201. COLOR lot(st(t).whr).hue
  202. ce 5, RTRIM$(lot(st(t).whr).ttl)
  203. ce 6, RTRIM$(st(1).ft) + ", you have $" + ltsb(st(1).c)
  204. ce 7, "Do I hear $" + lts(nw) + "?"
  205. IF cr(1) + st(1).c >= nw THEN ce 8, "(Y/N)" ELSE ce 8, "press N to Not bid."
  206. yn$ = LCASE$(INKEY$)
  207. LOOP UNTIL yn$ = "n" OR (yn$ = "y" AND cr(1) + st(1).c >= nw)
  208. IF yn$ = "y" THEN
  209. ce 10, " I hear $" + lts(nw)
  210. nw = nw + bj
  211. bidder = 1
  212. ce 10, RTRIM$(st(1).ft) + " passes first bid."
  213. clk .5
  214. box
  215. COLOR lot(st(t).whr).hue
  216. ce 5, RTRIM$(lot(st(t).whr).ttl)
  217. ce 6, RTRIM$(st(2).ft) + ", you have $" + ltsb(st(2).c)
  218. ce 7, "Do I hear $" + lts(nw) + "?"
  219. IF cr(2) + st(2).c >= nw THEN ce 8, "(Y/N)" ELSE ce 8, "press N to Not bid."
  220. yn$ = LCASE$(INKEY$)
  221. LOOP UNTIL yn$ = "n" OR (yn$ = "y" AND cr(2) + st(2).c >= nw)
  222. IF yn$ = "y" THEN
  223. ce 10, " I hear $" + lts(nw)
  224. nw = nw + bj
  225. bidder = 2
  226. ce 9, "Going, going, going..."
  227. clk .5
  228. SELECT CASE bidder
  229. ce 11, "No sale!"
  230. p
  231. pay 1, lwst
  232. COLOR lot(st(t).whr).hue
  233. ce 10, RTRIM$(lot(st(t).whr).ttl)
  234. lot(st(t).whr).own = 1
  235. p
  236. who = 1
  237. box
  238. COLOR lot(st(t).whr).hue
  239. ce 5, RTRIM$(lot(st(t).whr).ttl)
  240. ce 6, RTRIM$(st(who).ft) + ", you have $" + ltsb(st(who).c)
  241. ce 7, "Do I hear $" + lts(nw) + "?"
  242. IF cr(who) + st(who).c >= nw THEN ce 8, "(Y/N)" ELSE ce 8, "press N to Not bid."
  243. yn$ = LCASE$(INKEY$)
  244. LOOP UNTIL yn$ = "n" OR (yn$ = "y" AND cr(who) + st(who).c >= nw)
  245. IF yn$ = "y" THEN
  246. ce 10, " I hear $" + lts(nw)
  247. nw = nw + bj
  248. bidder = who
  249. ce 9, "Going, going, going..."
  250. done = -1
  251. clk .5
  252. who = 3 - who
  253. LOOP UNTIL done
  254. COLOR lot(st(t).whr).hue
  255. ce 10, RTRIM$(lot(st(t).whr).ttl)
  256. pay bidder, nw - bj
  257. lot(st(t).whr).own = bidder
  258. p
  259.  
  260. SUB b
  261. FOR al = 300 TO 500 STEP 100
  262. SOUND al, 2
  263.  
  264. SUB bca (t, houf, hotf)
  265. hss = chou(t)
  266. hts = chot(t)
  267. ce 8, RTRIM$(st(t).ft) + ", you have " + lts(hss) + " house(s) and " + lts(hts) + " hotel(s)."
  268. fee = hss * houf + hts * hotf
  269. ce 9, "$" + lts(fee) + " due."
  270. p
  271. IF fee = 0 THEN EXIT SUB
  272. pay t, fee
  273. p
  274. IF j THEN fr& = fr& + fee
  275.  
  276. SUB box
  277. ce 4, CHR$(201) + STRING$(59, 205) + CHR$(187)
  278. FOR sides = 5 TO 17
  279. ce sides, CHR$(186) + SPACE$(59) + CHR$(186)
  280. ce 18, CHR$(204) + STRING$(8, 205) + CHR$(187) + SPACE$(50) + CHR$(186)
  281. ce 19, CHR$(186) + SPACE$(8) + CHR$(186) + SPACE$(50) + CHR$(186)
  282. ce 20, CHR$(200) + STRING$(8, 205) + CHR$(202) + STRING$(50, 205) + CHR$(188)
  283. LOCATE 19, 11
  284. PRINT "JAIL:"
  285. IF st(1).whr = -10 THEN
  286. LOCATE 19, 16
  287. PRINT st(1).tk
  288. IF st(2).whr = -10 THEN
  289. LOCATE 19, 18
  290. PRINT st(2).tk
  291. IF (NOT x) THEN
  292. LOCATE 18, 61
  293. PRINT USING "houses:##"; bhu
  294. IF (NOT x) THEN
  295. LOCATE 19, 61
  296. PRINT USING "hotels:##"; bht
  297.  
  298. SUB broke (t)
  299. box
  300. owe = ABS(st(t).c)
  301. v = cr(t)
  302. ce 5, RTRIM$(st(t).ft) + ", you need to raise $" + lts(ABS(owe))
  303. ce 6, "You can raise $" + lts(v)
  304. IF owe > v THEN
  305. ce 12, "YOU ARE BROKE!!"
  306. ce 16, "press Q to Quit game"
  307. done$ = LCASE$(INKEY$)
  308. LOOP UNTIL done$ = "q"
  309. gov 3 - t
  310. ce 9, "press 4 to mortgage properties"
  311. ce 10, "press 5 to sell houses"
  312. ce 11, "press 6 to sell hotels"
  313. ce 13, "press 8 to see inventories"
  314. ce 14, "press 9 to view deeds"
  315. ce 16, "press Q to Quit game"
  316. wtn$ = LCASE$(INKEY$)
  317. wtn = VAL(wtn$)
  318. LOOP UNTIL wtn$ > ""
  319. IF wtn$ = "q" THEN quit
  320. mort t
  321. shou t
  322. swbs
  323. shot t
  324. swbs
  325. inv
  326. vwd
  327. LOOP UNTIL st(t).c >= 0
  328. box
  329.  
  330. SUB buhot (t)
  331. DIM gm(9)
  332. gm(0) = -1
  333. box
  334. IF lot(1).own = t AND lot(1).stat = 4 AND st(t).c >= 50 AND bht > 0 THEN
  335. gm(1) = -1
  336. mini 1
  337. IF lot(6).own = t AND lot(6).stat = 4 AND st(t).c >= 50 AND bht > 0 THEN
  338. gm(2) = -1
  339. mini 2
  340. IF lot(11).own = t AND lot(11).stat = 4 AND st(t).c >= 100 AND bht > 0 THEN
  341. gm(3) = -1
  342. mini 3
  343. IF lot(16).own = t AND lot(16).stat = 4 AND st(t).c >= 100 AND bht > 0 THEN
  344. gm(4) = -1
  345. mini 4
  346. IF lot(21).own = t AND lot(21).stat = 4 AND st(t).c >= 150 AND bht > 0 THEN
  347. gm(5) = -1
  348. mini 5
  349. IF lot(26).own = t AND lot(26).stat = 4 AND st(t).c >= 150 AND bht > 0 THEN
  350. gm(6) = -1
  351. mini 6
  352. IF lot(31).own = t AND lot(31).stat = 4 AND st(t).c >= 200 AND bht > 0 THEN
  353. gm(7) = -1
  354. mini 7
  355. IF lot(37).own = t AND lot(37).stat = 4 AND st(t).c >= 200 AND bht > 0 THEN
  356. gm(8) = -1
  357. mini 8
  358. ce 9, RTRIM$(st(t).ft)
  359. ce 10, "Choose a monopoly to buy hotels for"
  360. ce 11, "or 0 to continue"
  361. IF wlb > 0 AND (NOT q) THEN b
  362. wlb$ = INKEY$
  363. IF wlb$ = CHR$(13) THEN wlb$ = "0"
  364. LOOP UNTIL wlb$ > ""
  365. IF wlb$ >= "0" AND wlb$ <= "8" THEN wlb = VAL(wlb$) ELSE wlb = 9
  366. LOOP UNTIL gm(wlb)
  367. IF wlb = 0 THEN EXIT SUB
  368. box
  369. ce 5, RTRIM$(st(t).ft)
  370. pim wlb, l, m, h
  371. IF lot(h).stat = 5 THEN max = 1 ELSE max = 2
  372. max = 3
  373. IF lot(h).stat = 5 THEN max = 2
  374. IF lot(m).stat = 5 THEN max = 1
  375. IF max > bht THEN max = bht
  376. IF max > INT(st(t).c / lot(l).bc) THEN max = INT(st(t).c / lot(l).bc)
  377. ce 7, "you can buy up to " + lts(max) + " hotel(s)."
  378. ce 8, "or 0 to continue"
  379. ce 10, "you have $" + ltsb(st(t).c)
  380. ce 11, "hotels cost $" + lts(lot(l).bc) + " (plus four houses) each."
  381. quan = ner(9, max)
  382. IF quan = 0 THEN EXIT SUB
  383. tot = lot(l).stat + lot(m).stat + lot(h).stat + quan
  384. lot(h).stat = INT(tot / 2)
  385. lot(l).stat = INT(tot / 2)
  386. IF lot(h).stat + lot(l).stat < tot THEN lot(h).stat = lot(h).stat + 1
  387. lot(h).stat = INT(tot / 3)
  388. lot(m).stat = INT(tot / 3)
  389. lot(l).stat = INT(tot / 3)
  390. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(h).stat = lot(h).stat + 1
  391. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(m).stat = lot(m).stat + 1
  392. pay t, lot(l).bc * quan
  393. p
  394. IF (NOT x) THEN
  395. bht = bht - quan
  396. bhu = bhu + quan * 4
  397.  
  398. SUB buhou (t)
  399. DIM gm(9)
  400. gm(0) = -1
  401. box
  402. IF lot(1).own = t AND lot(1).mop AND (NOT lot(1).hk) AND (NOT lot(3).hk) AND lot(1).stat < 4 AND st(t).c >= 50 AND bhu > 0 THEN
  403. gm(1) = -1
  404. mini 1
  405. IF lot(6).own = t AND lot(6).mop AND (NOT lot(6).hk) AND (NOT lot(8).hk) AND (NOT lot(9).hk) AND lot(6).stat < 4 AND st(t).c >= 50 AND bhu > 0 THEN
  406. gm(2) = -1
  407. mini 2
  408. IF lot(11).own = t AND lot(11).mop AND (NOT lot(11).hk) AND (NOT lot(13).hk) AND (NOT lot(14).hk) AND lot(11).stat < 4 AND st(t).c >= 100 AND bhu > 0 THEN
  409. gm(3) = -1
  410. mini 3
  411. IF lot(16).own = t AND lot(16).mop AND (NOT lot(16).hk) AND (NOT lot(18).hk) AND (NOT lot(19).hk) AND lot(16).stat < 4 AND st(t).c >= 100 AND bhu > 0 THEN
  412. gm(4) = -1
  413. mini 4
  414. IF lot(21).own = t AND lot(21).mop AND (NOT lot(21).hk) AND (NOT lot(23).hk) AND (NOT lot(24).hk) AND lot(21).stat < 4 AND st(t).c >= 150 AND bhu > 0 THEN
  415. gm(5) = -1
  416. mini 5
  417. IF lot(26).own = t AND lot(26).mop AND (NOT lot(26).hk) AND (NOT lot(27).hk) AND (NOT lot(29).hk) AND lot(26).stat < 4 AND st(t).c >= 150 AND bhu > 0 THEN
  418. gm(6) = -1
  419. mini 6
  420. IF lot(31).own = t AND lot(31).mop AND (NOT lot(31).hk) AND (NOT lot(32).hk) AND (NOT lot(34).hk) AND lot(31).stat < 4 AND st(t).c >= 200 AND bhu > 0 THEN
  421. gm(7) = -1
  422. mini 7
  423. IF lot(37).own = t AND lot(37).mop AND (NOT lot(37).hk) AND (NOT lot(39).hk) AND lot(37).stat < 4 AND st(t).c >= 200 AND bhu > 0 THEN
  424. gm(8) = -1
  425. mini 8
  426. ce 9, RTRIM$(st(t).ft)
  427. ce 10, "Choose a monopoly to buy houses for"
  428. ce 11, "or 0 to continue"
  429. IF wlb > 0 AND (NOT q) THEN b
  430. wlb$ = INKEY$
  431. IF wlb$ = CHR$(13) THEN wlb$ = "0"
  432. LOOP UNTIL wlb$ > ""
  433. IF wlb$ >= "0" AND wlb$ <= "8" THEN wlb = VAL(wlb$) ELSE wlb = 9
  434. LOOP UNTIL gm(wlb)
  435. IF wlb = 0 THEN EXIT SUB
  436. box
  437. ce 5, RTRIM$(st(t).ft)
  438. pim wlb, l, m, h
  439. max = 8 - lot(l).stat - lot(h).stat
  440. max = 12 - lot(l).stat - lot(m).stat - lot(h).stat
  441. IF max > bhu THEN max = bhu
  442. IF max > INT(st(t).c / lot(l).bc) THEN max = INT(st(t).c / lot(l).bc)
  443. ce 7, "you can buy up to " + lts(max) + " house(s)."
  444. ce 8, "or 0 to continue"
  445. ce 10, "you have $" + ltsb(st(t).c)
  446. ce 11, "houses cost $" + lts(lot(l).bc) + " each."
  447. quan = ner(9, max)
  448. IF quan = 0 THEN EXIT SUB
  449. tot = lot(l).stat + lot(m).stat + lot(h).stat + quan
  450. lot(h).stat = INT(tot / 2)
  451. lot(l).stat = INT(tot / 2)
  452. IF lot(h).stat + lot(l).stat < tot THEN lot(h).stat = lot(h).stat + 1
  453. lot(h).stat = INT(tot / 3)
  454. lot(m).stat = INT(tot / 3)
  455. lot(l).stat = INT(tot / 3)
  456. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(h).stat = lot(h).stat + 1
  457. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(m).stat = lot(m).stat + 1
  458. pay t, lot(l).bc * quan
  459. p
  460. IF (NOT x) THEN bhu = bhu - quan
  461.  
  462. SUB ce (dn, tx$)
  463. LOCATE dn, 40 - INT(LEN(tx$) / 2)
  464. PRINT tx$
  465.  
  466. SUB chk (l, m, h)
  467. IF lot(l).own = lot(m).own AND lot(m).own = lot(h).own AND lot(l).own > 0 THEN
  468. lot(l).mop = -1
  469. lot(m).mop = -1
  470. lot(h).mop = -1
  471. lot(l).mop = 0
  472. lot(m).mop = 0
  473. lot(h).mop = 0
  474.  
  475. FUNCTION chot (t)
  476. FOR sq = 1 TO 39
  477. IF lot(sq).sty = "b" AND lot(sq).own = t AND lot(sq).stat = 5 THEN ced = ced + 1
  478. chot = ced
  479.  
  480. FUNCTION chou (t)
  481. FOR sq = 1 TO 39
  482. IF lot(sq).sty = "b" AND lot(sq).own = t AND lot(sq).stat < 5 THEN ced = ced + lot(sq).stat
  483. chou = ced
  484.  
  485. SUB clk (se!)
  486. start# = TIMER
  487. IF se! >= .1 THEN
  488. LOOP UNTIL TIMER < start# OR TIMER - start# >= se!
  489.  
  490. SUB cont (t, nos)
  491. OPEN "monopoly.dat" FOR INPUT AS #1
  492. IF (NOT nos) THEN
  493. ce 5, "I found a save."
  494. ce 7, "Do you want to continue prior game? (Y/N)"
  495. yn$ = LCASE$(INKEY$)
  496. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  497. ce 8, UCASE$(yn$)
  498. p
  499. IF yn$ = "n" THEN
  500. nos = -1
  501. INPUT #1, sf!
  502. IF sf! <> 1 AND sf! <> .5 THEN GOTO oops
  503. INPUT #1, uf!
  504. IF uf! <> .5 AND uf! <> .55 THEN GOTO oops
  505. INPUT #1, t
  506. IF t < 1 OR t > 2 THEN GOTO oops
  507. INPUT #1, fr&
  508. IF fr& < 0 THEN GOTO oops
  509. INPUT #1, bhu
  510. IF bhu < 0 OR bhu > 32 THEN GOTO oops
  511. INPUT #1, bht
  512. IF bht < 0 OR bht > 12 THEN GOTO oops
  513. INPUT #1, j
  514. IF j < -1 OR j > 0 THEN GOTO oops
  515. INPUT #1, bn
  516. IF bn < -1 OR bn > 0 THEN GOTO oops
  517. INPUT #1, x
  518. IF x < -1 OR x > 0 THEN GOTO oops
  519. INPUT #1, q
  520. IF q < -1 OR q > 0 THEN GOTO oops
  521. FOR sq = 0 TO 39
  522. INPUT #1, lot(sq).own
  523. IF lot(sq).own < 0 OR lot(sq).own > 2 THEN GOTO oops
  524. INPUT #1, lot(sq).stat
  525. IF lot(sq).stat < 0 OR lot(sq).stat > 5 THEN GOTO oops
  526. INPUT #1, lot(sq).mop
  527. IF lot(sq).mop < -1 OR lot(sq).mop > 0 THEN GOTO oops
  528. INPUT #1, lot(sq).hk
  529. IF lot(sq).hk < -1 OR lot(sq).hk > 0 THEN GOTO oops
  530. FOR sq = 1 TO 2
  531. INPUT #1, st(sq).ft
  532. INPUT #1, st(sq).tk
  533. INPUT #1, st(sq).c
  534. IF st(sq).c < 0 THEN GOTO oops
  535. INPUT #1, st(sq).whr
  536. IF (st(sq).whr < 0 OR st(sq).whr > 39) AND st(sq).whr <> -10 THEN GOTO oops
  537. INPUT #1, st(sq).jc
  538. IF st(sq).jc < 0 OR st(sq).jc > 2 THEN GOTO oops
  539. INPUT #1, st(sq).dc
  540. IF st(sq).dc < 0 OR st(sq).dc > 2 THEN GOTO oops
  541. INPUT #1, st(sq).chag
  542. IF st(sq).chag < -1 OR st(sq).chag > 0 THEN GOTO oops
  543. INPUT #1, st(sq).cheg
  544. IF st(sq).cheg < -1 OR st(sq).cheg > 0 THEN GOTO oops
  545. FOR sq = 1 TO 16
  546. INPUT #1, cha(sq)
  547. IF cha(sq) < 0 OR cha(sq) > 2 THEN GOTO oops
  548. INPUT #1, che(sq)
  549. IF che(sq) < 0 OR che(sq) > 2 THEN GOTO oops
  550. KILL "monopoly.dat"
  551. upd
  552. oops:
  553. ERROR 255
  554.  
  555. FUNCTION cr (t)
  556. FOR sq = 1 TO 39
  557. IF lot(sq).own = t THEN
  558. IF (NOT lot(sq).hk) THEN current = current + lot(sq).c / 2
  559. IF lot(sq).sty = "b" THEN current = current + lot(sq).bc * lot(sq).stat * sf!
  560. cr = current
  561.  
  562. SUB crd
  563. ce 12, "Program written by Brian H. Graham."
  564. ce 13, "Based on the board game 'Monopoly' by Parker Brothers."
  565. p
  566. LOCATE 25, 1
  567.  
  568. FUNCTION cw (t)
  569. FOR sq = 1 TO 39
  570. IF lot(sq).own = t THEN
  571. IF lot(sq).hk THEN current = current + lot(sq).c / 2 ELSE current = current + lot(sq).c
  572. IF lot(sq).sty = "b" THEN current = current + lot(sq).bc * lot(sq).stat
  573. cw = current + st(t).c
  574.  
  575. SUB dcha (t)
  576. FOR look = 1 TO 16
  577. IF cha(look) > 0 THEN ucha = ucha + 1
  578. IF ucha = 16 THEN scha
  579. box
  580. ce 5, RTRIM$(st(t).ft)
  581. cd = INT(RND * 16) + 1
  582. LOOP UNTIL cha(cd) = 0
  583. cha(cd) = 1
  584. ce 6, "Chance"
  585. ce 7, "Advance to Go. (Collect $200.)"
  586. p
  587. move 40 - st(t).whr, t
  588. p
  589. ce 7, "Advance to Illinois Avenue."
  590. p
  591. IF st(t).whr < 24 THEN move 24 - st(t).whr, t ELSE move 64 - st(t).whr, t
  592. lop rl, t
  593. ce 7, "Advance to the nearest Utility."
  594. ce 8, "If it is owned, roll the dice,"
  595. ce 9, "and pay the own ten times the amount shown."
  596. ce 10, "If it is not owned, you may buy it."
  597. p
  598. SELECT CASE st(t).whr
  599. move 12 - st(t).whr, t
  600. CASE 22
  601. move 28 - st(t).whr, t
  602. CASE 36
  603. move 52 - st(t).whr, t
  604. utc t
  605. CASE 4, 5
  606. ce 7, "Advance to the next Railroad."
  607. ce 8, "If it is owned, pay the own double"
  608. ce 9, "the rent he/she is usually entitled."
  609. ce 10, "If it is not owned, you may buy it."
  610. p
  611. SELECT CASE st(t).whr
  612. move 15 - st(t).whr, t
  613. CASE 22
  614. move 25 - st(t).whr, t
  615. CASE 36
  616. move 45 - st(t).whr, t
  617. rlc t
  618. ce 7, "Advance to Saint Charles Place."
  619. ce 8, "If you pass Go, collect $200."
  620. p
  621. IF st(t).whr < 11 THEN move 11 - st(t).whr, t ELSE move 51 - st(t).whr, t
  622. lop rl, t
  623. ce 7, "Bank pays you dividend of $50."
  624. st(t).c = st(t).c + 50
  625. p
  626. ce 7, "Get out of Jail free."
  627. ce 8, "This card may be kept until used or traded."
  628. cha(8) = 2
  629. st(t).chag = -1
  630. p
  631. ce 7, "Go back three spaces."
  632. p
  633. mob t
  634. act rl, t
  635. CASE 10
  636. ce 7, "Go directly to Jail."
  637. ce 8, "Do not pass Go, Do not collect $200."
  638. p
  639. ar t
  640. CASE 11
  641. ce 7, "Make general repairs on all you properties."
  642. ce 8, "Pay $25 per house, $100 per hotel."
  643. bca t, 25, 100
  644. CASE 12
  645. ce 7, "Pay poor tax of $15."
  646. p
  647. pay t, 15
  648. IF j THEN fr& = fr& + 15
  649. p
  650. CASE 13
  651. ce 7, "Take a ride on the Reading."
  652. ce 8, "Advance to Reading Railroad."
  653. ce 9, "Collect $200 if you pass Go."
  654. p
  655. move 45 - st(t).whr, t
  656. lop rl, t
  657. CASE 14
  658. ce 7, "Take a walk on the boardwalk."
  659. ce 8, "Advance to Boardwalk."
  660. p
  661. move 39 - st(t).whr, t
  662. lop rl, t
  663. CASE 15
  664. ce 7, "You have been elected chairman of the board."
  665. ce 8, "Pay each player $50."
  666. p
  667. popp t, 50
  668. CASE 16
  669. ce 7, "Your building and loan matures. Collect $150."
  670. st(t).c = st(t).c + 150
  671. p
  672.  
  673. SUB dche (t)
  674. FOR look = 1 TO 16
  675. IF che(look) > 0 THEN uche = uche + 1
  676. IF uche = 16 THEN sche
  677. box
  678. ce 5, RTRIM$(st(t).ft)
  679. cd = INT(RND * 16) + 1
  680. LOOP UNTIL che(cd) = 0
  681. che(cd) = 1
  682. ce 6, "Community Chest"
  683. ce 7, "Advance to Go. (Collect $200.)"
  684. p
  685. move 40 - st(t).whr, t
  686. p
  687. ce 7, "Bank error in your favor. Collect $200."
  688. p
  689. st(t).c = st(t).c + 200
  690. ce 7, "Christmas fund matures. Collect $100."
  691. p
  692. st(t).c = st(t).c + 100
  693. ce 7, "Doctor's fee. Pay $50."
  694. p
  695. pay t, 50
  696. p
  697. IF j THEN fr& = fr& + 50
  698. ce 7, "From sale of stock you get $45."
  699. p
  700. st(t).c = st(t).c + 45
  701. ce 7, "Get out of Jail free."
  702. ce 8, "This card may be kept until used or traded."
  703. che(6) = 2
  704. st(t).cheg = -1
  705. p
  706. ce 7, "Go directly to Jail."
  707. ce 8, "Do not pass Go, Do not collect $200."
  708. p
  709. ar t
  710. ce 7, "Grand opera opening. Collect $50 from every player."
  711. p
  712. popp 3 - t, 50
  713. ce 7, "Income tax refund. Collect $20."
  714. p
  715. st(t).c = st(t).c + 20
  716. CASE 10
  717. ce 7, "Life insurance matures. Collect $100."
  718. p
  719. st(t).c = st(t).c + 100
  720. CASE 11
  721. ce 7, "Pay hospital $100."
  722. p
  723. pay t, 100
  724. p
  725. IF j THEN fr& = fr& + 100
  726. CASE 12
  727. ce 7, "Pay school tax of $150."
  728. p
  729. pay t, 150
  730. p
  731. IF j THEN fr& = fr& + 150
  732. CASE 13
  733. ce 7, "Recieve for services $25."
  734. p
  735. st(t).c = st(t).c + 25
  736. CASE 14
  737. ce 7, "You are assesed for street repairs."
  738. ce 8, "$40 per house, $115 per hotel."
  739. bca t, 40, 115
  740. CASE 15
  741. ce 7, "You have won second prize in a beauty contest."
  742. ce 8, "Collect $10."
  743. p
  744. st(t).c = st(t).c + 10
  745. CASE 16
  746. ce 7, "You inherit $100."
  747. p
  748. st(t).c = st(t).c + 100
  749.  
  750. FUNCTION di (d1, d2)
  751. d1 = INT(RND * 6) + 1
  752. d2 = INT(RND * 6) + 1
  753. di = d1 + d2
  754. ce 14, CHR$(218) + STRING$(5, 196) + CHR$(191) + CHR$(218) + STRING$(5, 196) + CHR$(191)
  755. ce 15, top(d1) + top(d2)
  756. ce 16, mdd(d1) + mdd(d2)
  757. ce 17, bot(d1) + bot(d2)
  758. ce 18, CHR$(192) + STRING$(5, 196) + CHR$(217) + CHR$(192) + STRING$(5, 196) + CHR$(217)
  759.  
  760. SUB dy (wt)
  761. PRINT wt;
  762. COLOR lot(wt).hue
  763. PRINT lot(wt).ab;
  764. PRINT " $";
  765. IF lot(wt).hk THEN PRINT lts(INT(.5 + lot(wt).c * uf!)) ELSE PRINT lts(lot(wt).c / 2)
  766.  
  767. SUB fd (rl1, rl2, d1, d2, d3, d4)
  768. d1 = INT(RND * 6) + 1
  769. d2 = INT(RND * 6) + 1
  770. d3 = INT(RND * 6) + 1
  771. d4 = INT(RND * 6) + 1
  772. rl1 = d1 + d2
  773. rl2 = d3 + d4
  774. ce 13, RTRIM$(st(1).ft) + SPACE$(6) + RTRIM$(st(2).ft)
  775. ce 14, CHR$(218) + STRING$(5, 196) + CHR$(191) + CHR$(218) + STRING$(5, 196) + CHR$(191) + SPACE$(6) + CHR$(218) + STRING$(5, 196) + CHR$(191) + CHR$(218) + STRING$(5, 196) + CHR$(191)
  776. ce 15, top(d1) + top(d2) + SPACE$(6) + top(d3) + top(d4)
  777. ce 16, mdd(d1) + mdd(d2) + SPACE$(6) + mdd(d3) + mdd(d4)
  778. ce 17, bot(d1) + bot(d2) + SPACE$(6) + bot(d3) + bot(d4)
  779. ce 18, CHR$(192) + STRING$(5, 196) + CHR$(217) + CHR$(192) + STRING$(5, 196) + CHR$(217) + SPACE$(6) + CHR$(192) + STRING$(5, 196) + CHR$(217) + CHR$(192) + STRING$(5, 196) + CHR$(217)
  780.  
  781. SUB gov (t)
  782. st(1).whr = 0
  783. st(2).whr = 0
  784. x = -1
  785. swbd
  786. IF t = 0 THEN
  787. ce 5, "This game was a tie!"
  788. ce 7, "Thank you for playing " + RTRIM$(st(1).ft) + " and " + RTRIM$(st(2).ft)
  789. ce 5, RTRIM$(st(t).ft) + " has won!!!"
  790. ce 8, "Better luck next time " + RTRIM$(st(3 - t).ft)
  791. crd
  792.  
  793. SUB inc (t)
  794. box
  795. ce 5, RTRIM$(st(t).ft)
  796. ce 6, "Income Tax"
  797. ce 8, "press W to pay 10% of your Worth"
  798. ce 9, "press F to pay $200 Flat rate"
  799. taxopt$ = LCASE$(INKEY$)
  800. LOOP UNTIL taxopt$ = "f" OR taxopt$ = "w"
  801. IF taxopt$ = "f" THEN fee = 200 ELSE fee = INT(.5 + cw(t) / 10)
  802. ce 10, UCASE$(taxopt$) + ", $" + lts(fee) + " due."
  803. p
  804. pay t, fee
  805. p
  806. IF j THEN fr& = fr& + fee
  807.  
  808. SUB init
  809. alto$ = CHR$(2) + CHR$(3) + CHR$(4) + CHR$(5) + CHR$(6) + CHR$(21) + CHR$(157) + CHR$(232) + CHR$(233) + CHR$(236)
  810. FOR wide = 1 TO 10
  811. wide$ = wide$ + MID$(alto$, wide, 1) + " "
  812. wide$ = RTRIM$(wide$)
  813. FOR sq = 1 TO 2
  814. box
  815. ce 5, "Player " + lts(sq) + " first name"
  816. who$ = ""
  817. ltr$ = txk
  818. IF ltr$ = CHR$(8) AND LEN(who$) > 0 THEN
  819. who$ = LEFT$(who$, (LEN(who$) - 1))
  820. IF ltr$ <> CHR$(13) AND ltr$ <> CHR$(8) THEN who$ = who$ + ltr$
  821. IF LEN(who$) < 9 THEN
  822. ce 6, SPACE$(10)
  823. ce 6, who$
  824. LOOP UNTIL ltr$ = CHR$(13) OR LEN(who$) = 10
  825. st(sq).ft = who$
  826. LOOP UNTIL st(1).ft <> st(2).ft AND st(sq).ft <> SPACE$(8)
  827. ce 7, "pick a token"
  828. ce 8, wide$
  829. ce 9, "1 2 3 4 5 6 7 8 9 0"
  830. IF hide > 0 THEN
  831. LOCATE 8, hide * 2 + 29
  832. PRINT " "
  833. LOCATE 9, hide * 2 + 29
  834. PRINT " "
  835. pick$ = INKEY$
  836. pick = VAL(pick$)
  837. IF pick = 0 THEN pick = 10
  838. LOOP UNTIL pick$ >= "0" AND pick$ <= "9" AND pick <> hide
  839. hide = pick
  840. st(sq).tk = MID$(alto$, hide, 1)
  841. st(sq).c = 1500
  842. ce 11, lts(pick) + ", " + st(sq).tk
  843. p
  844. box
  845. fd rl1, rl2, d1, d2, d3, d4
  846. ce 5, "Determining who goes first:"
  847. ce 7, RTRIM$(st(1).ft) + " rolls " + lts(d1) + " + " + lts(d2) + " = " + lts(rl1)
  848. ce 8, RTRIM$(st(2).ft) + " rolls " + lts(d3) + " + " + lts(d4) + " + " + lts(rl2)
  849. IF rl1 = rl2 THEN
  850. ce 10, "No decision. I will try again."
  851. p
  852. LOOP UNTIL rl1 <> rl2
  853. IF rl2 > rl1 THEN SWAP st(1), st(2)
  854. ce 10, "This means " + RTRIM$(st(1).ft) + " goes first."
  855. p
  856.  
  857. SUB inv
  858. FOR look = 0 TO 2
  859. box
  860. IF lot(1).own = look THEN
  861. LOCATE 5, 11
  862. lil 1
  863. IF lot(3).own = look THEN
  864. LOCATE 6, 11
  865. lil 3
  866. IF lot(5).own = look THEN
  867. LOCATE 7, 11
  868. lil 5
  869. IF lot(6).own = look THEN
  870. LOCATE 8, 11
  871. lil 6
  872. IF lot(8).own = look THEN
  873. LOCATE 9, 11
  874. lil 8
  875. IF lot(9).own = look THEN
  876. LOCATE 10, 11
  877. lil 9
  878. IF lot(11).own = look THEN
  879. LOCATE 5, 26
  880. lil 11
  881. IF lot(12).own = look THEN
  882. LOCATE 6, 26
  883. lil 12
  884. IF lot(13).own = look THEN
  885. LOCATE 7, 26
  886. lil 13
  887. IF lot(14).own = look THEN
  888. LOCATE 8, 26
  889. lil 14
  890. IF lot(15).own = look THEN
  891. LOCATE 9, 26
  892. lil 15
  893. IF lot(16).own = look THEN
  894. LOCATE 10, 26
  895. lil 16
  896. IF lot(18).own = look THEN
  897. LOCATE 11, 26
  898. lil 18
  899. IF lot(19).own = look THEN
  900. LOCATE 12, 26
  901. lil 19
  902. IF lot(21).own = look THEN
  903. LOCATE 5, 41
  904. lil 21
  905. IF lot(23).own = look THEN
  906. LOCATE 6, 41
  907. lil 23
  908. IF lot(24).own = look THEN
  909. LOCATE 7, 41
  910. lil 24
  911. IF lot(25).own = look THEN
  912. LOCATE 8, 41
  913. lil 25
  914. IF lot(26).own = look THEN
  915. LOCATE 9, 41
  916. lil 26
  917. IF lot(27).own = look THEN
  918. LOCATE 10, 41
  919. lil 27
  920. IF lot(28).own = look THEN
  921. LOCATE 11, 41
  922. lil 28
  923. IF lot(29).own = look THEN
  924. LOCATE 12, 41
  925. lil 29
  926. IF lot(31).own = look THEN
  927. LOCATE 5, 56
  928. lil 31
  929. IF lot(32).own = look THEN
  930. LOCATE 6, 56
  931. lil 32
  932. IF lot(34).own = look THEN
  933. LOCATE 7, 56
  934. lil 34
  935. IF lot(35).own = look THEN
  936. LOCATE 8, 56
  937. lil 35
  938. IF lot(37).own = look THEN
  939. LOCATE 9, 56
  940. lil 37
  941. IF lot(39).own = look THEN
  942. LOCATE 10, 56
  943. lil 39
  944. ce 14, "unowned properties"
  945. IF j THEN ce 16, "Free Parking has $" + ltsb(fr&)
  946. CASE 1, 2
  947. IF st(look).chag THEN
  948. LOCATE 12, 11
  949. PRINT "GOOJF";
  950. PRINT " Chance"
  951. IF st(look).cheg THEN
  952. LOCATE 12, 56
  953. PRINT "GOOJF";
  954. PRINT " Cm Chst"
  955. ce 14, RTRIM$(st(look).ft) + ", your properties"
  956. ce 15, "you are the " + st(look).tk
  957. IF st(look).c >= 0 THEN ce 16, "you have $" + ltsb(st(look).c) ELSE ce 16, "you need to raise $" + lts(ABS(st(look).c))
  958. p
  959.  
  960. SUB lil (wt)
  961. COLOR lot(wt).hue
  962. PRINT lot(wt).ab;
  963. IF lot(wt).hk THEN
  964. PRINT " mort"
  965. IF lot(wt).own > 0 THEN
  966. SELECT CASE lot(wt).stat
  967. IF lot(wt).mop THEN PRINT " doubl" ELSE PRINT " plain"
  968. SELECT CASE lot(wt).sty
  969. CASE "b"
  970. PRINT " 1 hse"
  971. CASE "r"
  972. PRINT " 1 rr"
  973. CASE "u"
  974. PRINT " 1 utl"
  975. SELECT CASE lot(wt).sty
  976. CASE "b"
  977. PRINT " 2 hses"
  978. CASE "r"
  979. PRINT " 2 rrs"
  980. CASE "u"
  981. PRINT " 2 utls"
  982. SELECT CASE lot(wt).sty
  983. CASE "b"
  984. PRINT " 3 hses"
  985. CASE "r"
  986. PRINT " 3 rrs"
  987. SELECT CASE lot(wt).sty
  988. CASE "b"
  989. PRINT " 4 hses"
  990. CASE "r"
  991. PRINT " 4 rrs"
  992. PRINT " hotel"
  993.  
  994. SUB lop (rl, t)
  995. IF lot(st(t).whr).own = 0 THEN
  996. noo t
  997. IF lot(st(t).whr).own = t THEN
  998. COLOR lot(st(t).whr).hue
  999. ce 12, RTRIM$(lot(st(t).whr).ttl)
  1000. ce 13, "is yours."
  1001. p
  1002. IF lot(st(t).whr).hk THEN
  1003. COLOR lot(st(t).whr).hue
  1004. ce 12, RTRIM$(lot(st(t).whr).ttl)
  1005. ce 13, "is mortgaged."
  1006. p
  1007. SELECT CASE lot(st(t).whr).stat
  1008. IF lot(st(t).whr).mop THEN popp t, lot(st(t).whr).r * 2 ELSE popp t, lot(st(t).whr).r
  1009. IF lot(st(t).whr).sty = "u" THEN popp t, 4 * rl ELSE popp t, lot(st(t).whr).r1
  1010. IF lot(st(t).whr).sty = "u" THEN popp t, 10 * rl ELSE popp t, lot(st(t).whr).r2
  1011. popp t, lot(st(t).whr).r3
  1012. popp t, lot(st(t).whr).r4
  1013. popp t, lot(st(t).whr).rhot
  1014.  
  1015. FUNCTION lts$ (nu)
  1016. lts = LTRIM$(STR$(nu))
  1017.  
  1018. FUNCTION ltsb$ (nu&)
  1019. ltsb = LTRIM$(STR$(nu&))
  1020.  
  1021. SUB mb
  1022. FOR sq = 0 TO 39
  1023. READ lot(sq).ttl
  1024. READ lot(sq).ab
  1025. READ lot(sq).sty
  1026. READ lot(sq).c
  1027. READ lot(sq).r
  1028. READ lot(sq).r1
  1029. READ lot(sq).r2
  1030. READ lot(sq).r3
  1031. READ lot(sq).r4
  1032. READ lot(sq).rhot
  1033. READ lot(sq).bc
  1034. READ lot(sq).hue
  1035. READ lot(sq).od
  1036. READ lot(sq).oa
  1037. READ lot(sq).id
  1038. READ lot(sq).ia
  1039. READ lot(sq).bdn
  1040. READ lot(sq).bac
  1041.  
  1042. SUB md
  1043. p0$ = CHR$(179) + SPACE$(5) + CHR$(179)
  1044. p1a$ = CHR$(179) + "@" + SPACE$(4) + CHR$(179)
  1045. p1b$ = CHR$(179) + SPACE$(2) + "@" + SPACE$(2) + CHR$(179)
  1046. p1c$ = CHR$(179) + SPACE$(4) + "@" + CHR$(179)
  1047. p2$ = CHR$(179) + "@" + SPACE$(3) + "@" + CHR$(179)
  1048. top(1) = p0$
  1049. mdd(1) = p1b$
  1050. bot(1) = p0$
  1051. top(2) = p1a$
  1052. mdd(2) = p0$
  1053. bot(2) = p1c$
  1054. top(3) = p1a$
  1055. mdd(3) = p1b$
  1056. bot(3) = p1c$
  1057. top(4) = p2$
  1058. mdd(4) = p0$
  1059. bot(4) = p2$
  1060. top(5) = p2$
  1061. mdd(5) = p1b$
  1062. bot(5) = p2$
  1063. top(6) = p2$
  1064. mdd(6) = p2$
  1065. bot(6) = p2$
  1066.  
  1067. SUB mini (gr)
  1068. dn = 5
  1069. ac = 11
  1070. mophue = 5
  1071. mopstr$ = "MEDIT/BALTI"
  1072. dn = 6
  1073. ac = 11
  1074. mophue = 11
  1075. mopstr$ = "OREIN/VERMO/CONNE"
  1076. dn = 7
  1077. ac = 11
  1078. mophue = 13
  1079. mopstr$ = "STCHA/STATE/VIRGI"
  1080. dn = 8
  1081. ac = 11
  1082. mophue = 12
  1083. mopstr$ = "STJAM/TENNE/NEWYO"
  1084. dn = 5
  1085. ac = 41
  1086. mophue = 4
  1087. mopstr$ = "KENTU/INDIA/ILLIN"
  1088. dn = 6
  1089. ac = 41
  1090. mophue = 14
  1091. mopstr$ = "ATLAN/VENTN/MARVI"
  1092. dn = 7
  1093. ac = 41
  1094. mophue = 10
  1095. mopstr$ = "PACIF/NORTH/PENAV"
  1096. dn = 8
  1097. ac = 41
  1098. mophue = 9
  1099. mopstr$ = "PARKP/BOARD"
  1100. LOCATE dn, ac
  1101. PRINT gr;
  1102. COLOR mophue
  1103. PRINT mopstr$
  1104.  
  1105. SUB mob (t)
  1106. FOR sq = 0 TO 2
  1107. IF t = 1 THEN LOCATE lot(st(1).whr - sq).od, lot(st(1).whr - sq).oa ELSE LOCATE lot(st(2).whr - sq).id, lot(st(2).whr - sq).ia
  1108. PRINT " "
  1109. IF t = 1 THEN LOCATE lot(st(1).whr - sq - 1).od, lot(st(1).whr - sq - 1).oa ELSE LOCATE lot(st(2).whr - sq - 1).id, lot(st(2).whr - sq - 1).ia
  1110. PRINT st(t).tk
  1111. clk .1
  1112. st(t).whr = (st(t).whr - 3)
  1113.  
  1114. SUB more (t)
  1115. box
  1116. ce 5, RTRIM$(st(t).ft) + ", you have $" + ltsb(st(t).c)
  1117. ce 6, "press 1 to unmortgage properties"
  1118. ce 7, "press 2 to buy houses"
  1119. ce 8, "press 3 to buy hotels"
  1120. ce 9, "press 4 to mortgage properties"
  1121. ce 10, "press 5 to sell houses"
  1122. ce 11, "press 6 to sell hotels"
  1123. ce 12, "press 7 to trade"
  1124. ce 13, "press 8 to see inventories"
  1125. ce 14, "press 9 to view deeds"
  1126. ce 15, "press any other key to continue"
  1127. wtn = VAL(ak)
  1128. unm t
  1129. buhou t
  1130. swbs
  1131. buhot t
  1132. swbs
  1133. mort t
  1134. shou t
  1135. swbs
  1136. shot t
  1137. swbs
  1138. trade
  1139. upd
  1140. inv
  1141. vwd
  1142. LOOP UNTIL wtn = 0
  1143.  
  1144. SUB mort (t)
  1145. DIM gp(39)
  1146. gp(0) = -1
  1147. box
  1148. IF lot(1).own = t AND (NOT lot(1).hk) AND lot(3).stat = 0 THEN
  1149. LOCATE 5, 11
  1150. dy 1
  1151. gp(1) = -1
  1152. IF lot(3).own = t AND (NOT lot(3).hk) AND lot(3).stat = 0 THEN
  1153. LOCATE 6, 11
  1154. dy 3
  1155. gp(3) = -1
  1156. IF lot(5).own = t AND (NOT lot(5).hk) THEN
  1157. LOCATE 7, 11
  1158. dy 5
  1159. gp(5) = -1
  1160. IF lot(6).own = t AND (NOT lot(6).hk) AND lot(9).stat = 0 THEN
  1161. LOCATE 8, 11
  1162. dy 6
  1163. gp(6) = -1
  1164. IF lot(8).own = t AND (NOT lot(8).hk) AND lot(9).stat = 0 THEN
  1165. LOCATE 9, 11
  1166. dy 8
  1167. gp(8) = -1
  1168. IF lot(9).own = t AND (NOT lot(9).hk) AND lot(9).stat = 0 THEN
  1169. LOCATE 10, 11
  1170. dy 9
  1171. gp(9) = -1
  1172. IF lot(11).own = t AND (NOT lot(11).hk) AND lot(14).stat = 0 THEN
  1173. LOCATE 5, 26
  1174. dy 11
  1175. gp(11) = -1
  1176. IF lot(12).own = t AND (NOT lot(12).hk) THEN
  1177. LOCATE 6, 26
  1178. dy 12
  1179. gp(12) = -1
  1180. IF lot(13).own = t AND (NOT lot(13).hk) AND lot(14).stat = 0 THEN
  1181. LOCATE 7, 26
  1182. dy 13
  1183. gp(13) = -1
  1184. IF lot(14).own = t AND (NOT lot(14).hk) AND lot(14).stat = 0 THEN
  1185. LOCATE 8, 26
  1186. dy 14
  1187. gp(14) = -1
  1188. IF lot(15).own = t AND (NOT lot(15).hk) THEN
  1189. LOCATE 9, 26
  1190. dy 15
  1191. gp(15) = -1
  1192. IF lot(16).own = t AND (NOT lot(16).hk) AND lot(19).stat = 0 THEN
  1193. LOCATE 10, 26
  1194. dy 16
  1195. gp(16) = -1
  1196. IF lot(18).own = t AND (NOT lot(18).hk) AND lot(19).stat = 0 THEN
  1197. LOCATE 11, 26
  1198. dy 18
  1199. gp(18) = -1
  1200. IF lot(19).own = t AND (NOT lot(19).hk) AND lot(19).stat = 0 THEN
  1201. LOCATE 12, 26
  1202. dy 19
  1203. gp(19) = -1
  1204. IF lot(21).own = t AND (NOT lot(21).hk) AND lot(24).stat = 0 THEN
  1205. LOCATE 5, 41
  1206. dy 21
  1207. gp(21) = -1
  1208. IF lot(23).own = t AND (NOT lot(23).hk) AND lot(24).stat = 0 THEN
  1209. LOCATE 6, 41
  1210. dy 23
  1211. gp(23) = -1
  1212. IF lot(24).own = t AND (NOT lot(24).hk) AND lot(24).stat = 0 THEN
  1213. LOCATE 7, 41
  1214. dy 24
  1215. gp(24) = -1
  1216. IF lot(25).own = t AND (NOT lot(25).hk) THEN
  1217. LOCATE 8, 41
  1218. dy 25
  1219. gp(25) = -1
  1220. IF lot(26).own = t AND (NOT lot(26).hk) AND lot(29).stat = 0 THEN
  1221. LOCATE 9, 41
  1222. dy 26
  1223. gp(26) = -1
  1224. IF lot(27).own = t AND (NOT lot(27).hk) AND lot(29).stat = 0 THEN
  1225. LOCATE 10, 41
  1226. dy 27
  1227. gp(27) = -1
  1228. IF lot(28).own = t AND (NOT lot(28).hk) THEN
  1229. LOCATE 11, 41
  1230. dy 28
  1231. gp(28) = -1
  1232. IF lot(29).own = t AND (NOT lot(29).hk) AND lot(29).stat = 0 THEN
  1233. LOCATE 12, 41
  1234. dy 29
  1235. gp(29) = -1
  1236. IF lot(31).own = t AND (NOT lot(31).hk) AND lot(34).stat = 0 THEN
  1237. LOCATE 5, 56
  1238. dy 31
  1239. gp(31) = -1
  1240. IF lot(32).own = t AND (NOT lot(32).hk) AND lot(34).stat = 0 THEN
  1241. LOCATE 6, 56
  1242. dy 32
  1243. gp(32) = -1
  1244. IF lot(34).own = t AND (NOT lot(34).hk) AND lot(34).stat = 0 THEN
  1245. LOCATE 7, 56
  1246. dy 34
  1247. gp(34) = -1
  1248. IF lot(35).own = t AND (NOT lot(35).hk) THEN
  1249. LOCATE 8, 56
  1250. dy 35
  1251. gp(35) = -1
  1252. IF lot(37).own = t AND (NOT lot(37).hk) AND lot(39).stat = 0 THEN
  1253. LOCATE 9, 56
  1254. dy 37
  1255. gp(37) = -1
  1256. IF lot(39).own = t AND (NOT lot(39).hk) AND lot(39).stat = 0 THEN
  1257. LOCATE 10, 56
  1258. dy 39
  1259. gp(39) = -1
  1260. ce 13, RTRIM$(st(t).ft)
  1261. ce 14, "Choose a deed to mortgage or 0 to continue"
  1262. IF st(t).c >= 0 THEN ce 17, "you have $" + ltsb(st(t).c) ELSE ce 17, "you need to raise $" + lts(-st(t).c)
  1263. IF (NOT gp(pick)) AND (NOT q) THEN b
  1264. pick = ner(15, 39)
  1265. LOOP UNTIL gp(pick)
  1266. IF pick = 0 THEN EXIT SUB
  1267. lot(pick).hk = -1
  1268. st(t).c = st(t).c + lot(pick).c / 2
  1269.  
  1270. SUB move (dist, t)
  1271. FOR sq = 0 TO dist - 1
  1272. IF t = 1 THEN LOCATE lot((st(1).whr + sq) MOD 40).od, lot((st(1).whr + sq) MOD 40).oa ELSE LOCATE lot((st(2).whr + sq) MOD 40).id, lot((st(2).whr + sq) MOD 40).ia
  1273. PRINT " "
  1274. IF t = 1 THEN LOCATE lot((st(1).whr + sq + 1) MOD 40).od, lot((st(1).whr + sq + 1) MOD 40).oa ELSE LOCATE lot((st(2).whr + sq + 1) MOD 40).id, lot((st(2).whr + sq + 1) MOD 40).ia
  1275. PRINT st(t).tk
  1276. clk .1
  1277. IF st(t).whr + dist >= 40 THEN st(t).c = st(t).c + 200
  1278. IF st(t).whr + dist > 40 THEN
  1279. box
  1280. ce 5, RTRIM$(st(t).ft) + ", you collect $200 for passing Go."
  1281. clk .9
  1282. st(t).whr = (st(t).whr + dist) MOD 40
  1283.  
  1284. FUNCTION ner (dn, max)
  1285. IF max = 0 THEN mk = 2 ELSE mk = INT(LOG(max) / LOG(10)) + 2
  1286. ce dn, SPACE$(10)
  1287. IF num > 0 AND (NOT q) THEN b
  1288. num = 0
  1289. num$ = ""
  1290. numk$ = nerk
  1291. IF numk$ = CHR$(8) AND LEN(num$) > 0 THEN
  1292. num$ = LEFT$(num$, (LEN(num$) - 1))
  1293. IF numk$ <> CHR$(13) AND numk$ <> CHR$(8) THEN num$ = num$ + numk$
  1294. IF LEN(num$) < mk THEN
  1295. ce dn, SPACE$(10)
  1296. ce dn, num$
  1297. LOOP UNTIL numk$ = CHR$(13) OR LEN(num$) = mk
  1298. num = VAL(num$)
  1299. LOOP UNTIL num <= max
  1300. ner = num
  1301.  
  1302. FUNCTION nerb& (dn, max&)
  1303. IF max& = 0 THEN mk = 2 ELSE mk = INT(LOG(max&) / LOG(10)) + 2
  1304. ce dn, SPACE$(10)
  1305. IF num& > 0 AND (NOT q) THEN b
  1306. num& = 0
  1307. num$ = ""
  1308. numk$ = nerk
  1309. IF numk$ = CHR$(8) AND LEN(num$) > 0 THEN
  1310. num$ = LEFT$(num$, (LEN(num$) - 1))
  1311. IF numk$ <> CHR$(13) AND numk$ <> CHR$(8) THEN num$ = num$ + numk$
  1312. IF LEN(num$) < mk THEN
  1313. ce dn, SPACE$(10)
  1314. ce dn, num$
  1315. LOOP UNTIL numk$ = CHR$(13) OR LEN(num$) = mk
  1316. num& = VAL(num$)
  1317. LOOP UNTIL num& <= max&
  1318. nerb& = num&
  1319.  
  1320. FUNCTION nerk$
  1321. tx$ = INKEY$
  1322. LOOP UNTIL tx$ > ""
  1323. CASE "0" TO "9", CHR$(13), CHR$(8)
  1324. valid = -1
  1325. valid = 0
  1326. IF (NOT q) THEN b
  1327. LOOP UNTIL valid
  1328. nerk = tx$
  1329.  
  1330. SUB noo (t)
  1331. box
  1332. COLOR lot(st(t).whr).hue
  1333. ce 5, RTRIM$(lot(st(t).whr).ttl)
  1334. ce 6, "cost $" + lts(lot(st(t).whr).c)
  1335. ce 7, "mortgage value $" + lts(lot(st(t).whr).c / 2)
  1336. SELECT CASE lot(st(t).whr).sty
  1337. CASE "b"
  1338. ce 8, "rent $" + lts(lot(st(t).whr).r)
  1339. ce 9, "rent with one house $" + lts(lot(st(t).whr).r1)
  1340. ce 10, "rent with two houses $" + lts(lot(st(t).whr).r2)
  1341. ce 11, "rent with three houses $" + lts(lot(st(t).whr).r3)
  1342. ce 12, "rent with four houses $" + lts(lot(st(t).whr).r4)
  1343. ce 13, "rent with hotel $" + lts(lot(st(t).whr).rhot)
  1344. ce 14, "houses cost $" + lts(lot(st(t).whr).bc) + " each"
  1345. ce 15, "hotel costs $" + lts(lot(st(t).whr).bc) + " plus 4 houses"
  1346. CASE "u"
  1347. ce 8, "rent with one Utility, four times dice"
  1348. ce 9, "rent with two Utilities, ten times dice"
  1349. CASE "r"
  1350. ce 8, "rent with one Railroad $25"
  1351. ce 9, "rent with two Railroads $50"
  1352. ce 10, "rent with three Railroads $100"
  1353. ce 11, "rent with four Railroads $200"
  1354. ce 16, RTRIM$(st(t).ft) + ", you have $" + ltsb(st(t).c)
  1355. IF cr(t) + st(t).c >= lot(st(t).whr).c THEN ce 17, "press B to Buy"
  1356. ce 18, "press A to Auction"
  1357. wt$ = LCASE$(INKEY$)
  1358. LOOP UNTIL wt$ = "a" OR (wt$ = "b" AND cr(t) + st(t).c >= lot(st(t).whr).c)
  1359. box
  1360. IF wt$ = "b" THEN
  1361. pay t, lot(st(t).whr).c
  1362. COLOR lot(st(t).whr).hue
  1363. ce 10, RTRIM$(lot(st(t).whr).ttl)
  1364. lot(st(t).whr).own = t
  1365. p
  1366. auc t
  1367. upd
  1368.  
  1369. SUB opt (t)
  1370. box
  1371. ce 5, RTRIM$(st(t).ft) + ", you have $" + ltsb(st(t).c)
  1372. ce 6, "press P for Property options"
  1373. ce 7, "press S to Save and exit"
  1374. ce 8, "press Q to Quit game early"
  1375. ce 9, "press any other key to continue"
  1376. wt$ = ak
  1377. CASE "s"
  1378. save t
  1379. CASE "p"
  1380. more t
  1381. CASE "q"
  1382. quit
  1383. done = -1
  1384. LOOP UNTIL done
  1385.  
  1386. SUB p
  1387. ce 19, "press any key."
  1388. ce 19, SPACE$(14)
  1389.  
  1390. SUB pay (t, cge)
  1391. st(t).c = st(t).c - cge
  1392. IF st(t).c < 0 THEN broke t
  1393. ce 12, RTRIM$(st(t).ft) + " paid $" + lts(cge)
  1394.  
  1395. SUB pim (gr, l, m, h)
  1396. l = 1
  1397. m = 2
  1398. h = 3
  1399. ce 6, "MEDIT/BALTI"
  1400. l = 6
  1401. m = 8
  1402. h = 9
  1403. ce 6, "OREIN/VERMO/CONNE"
  1404. l = 11
  1405. m = 13
  1406. h = 14
  1407. ce 6, "STCHA/STATE/VIRGI"
  1408. l = 16
  1409. m = 18
  1410. h = 19
  1411. ce 6, "STJAM/TENNE/NEWYO"
  1412. l = 21
  1413. m = 23
  1414. h = 24
  1415. ce 6, "KENTU/INDIA/ILLIN"
  1416. l = 26
  1417. m = 27
  1418. h = 29
  1419. ce 6, "ATLAN/VENTN/MARVI"
  1420. l = 31
  1421. m = 32
  1422. h = 34
  1423. ce 6, "PACIF/NORTH/PENAV"
  1424. l = 37
  1425. m = 2
  1426. h = 39
  1427. ce 6, "PARKP/BOARD"
  1428.  
  1429. SUB popp (t, cge)
  1430. pay t, cge
  1431. st(3 - t).c = st(3 - t).c + cge
  1432. ce 13, " to " + RTRIM$(st(3 - t).ft)
  1433. p
  1434.  
  1435. SUB quit
  1436. quithue = ((quithue + 1) AND 15) OR 8
  1437. COLOR quithue
  1438. ce 17, "ARE YOU SURE YOU WANT TO QUIT? (Y/N)"
  1439. clk .09
  1440. yn$ = LCASE$(INKEY$)
  1441. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1442. IF yn$ = "y" THEN
  1443. IF st(1).c < 0 THEN gov 2
  1444. IF st(2).c < 0 THEN gov 1
  1445. worth1 = cw(1)
  1446. worth2 = cw(2)
  1447. IF worth1 > worth2 THEN gov 1
  1448. IF worth2 > worth1 THEN gov 2
  1449. gov 0
  1450.  
  1451. SUB rlc (t)
  1452. IF lot(st(t).whr).own = 0 THEN
  1453. noo t
  1454. IF lot(st(t).whr).own = t THEN
  1455. COLOR lot(st(t).whr).hue
  1456. ce 12, RTRIM$(lot(st(t).whr).ttl)
  1457. ce 13, "is yours."
  1458. p
  1459. IF lot(st(t).whr).hk THEN
  1460. COLOR lot(st(t).whr).hue
  1461. ce 12, RTRIM$(lot(st(t).whr).ttl)
  1462. ce 13, "is mortgaged."
  1463. p
  1464. SELECT CASE lot(st(t).whr).stat
  1465. popp t, 50
  1466. popp t, 100
  1467. popp t, 200
  1468. popp t, 400
  1469.  
  1470. SUB rules
  1471. x = -1
  1472. box
  1473. ce 5, "I will start a new game."
  1474. ce 7, "Do you want the Free Parking jackpot? (Y/N)"
  1475. yn$ = LCASE$(INKEY$)
  1476. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1477. ce 8, UCASE$(yn$)
  1478. IF yn$ = "y" THEN
  1479. j = -1
  1480. fr& = 500
  1481. ce 9, "Do you want the land on Go bonus? (Y/N)"
  1482. yn$ = LCASE$(INKEY$)
  1483. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1484. ce 10, UCASE$(yn$)
  1485. IF yn$ = "y" THEN bn = -1
  1486. ce 11, "Do you want unlimited buildings in the bank? (Y/N)"
  1487. yn$ = LCASE$(INKEY$)
  1488. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1489. ce 12, UCASE$(yn$)
  1490. IF yn$ = "n" THEN x = 0
  1491. ce 13, "Do you want to suspend mortgage interest? (Y/N)"
  1492. yn$ = LCASE$(INKEY$)
  1493. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1494. ce 14, UCASE$(yn$)
  1495. IF yn$ = "y" THEN uf! = .5 ELSE uf! = .55
  1496. ce 15, "Should builings sell back at full price? (Y/N)"
  1497. yn$ = LCASE$(INKEY$)
  1498. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1499. ce 16, UCASE$(yn$)
  1500. IF yn$ = "y" THEN sf! = 1 ELSE sf! = .5
  1501. ce 17, "Do you want quiet mode? (Y/N)"
  1502. yn$ = LCASE$(INKEY$)
  1503. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  1504. ce 18, UCASE$(yn$)
  1505. IF yn$ = "y" THEN q = -1
  1506. p
  1507.  
  1508. SUB save (t)
  1509. ce 10, "to be continued."
  1510. OPEN "monopoly.dat" FOR OUTPUT AS #1
  1511. PRINT #1, sf!
  1512. PRINT #1, uf!
  1513. PRINT #1, t
  1514. PRINT #1, fr&
  1515. PRINT #1, bhu
  1516. PRINT #1, bht
  1517. PRINT #1, j
  1518. PRINT #1, bn
  1519. PRINT #1, x
  1520. PRINT #1, q
  1521. FOR sq = 0 TO 39
  1522. PRINT #1, lot(sq).own
  1523. PRINT #1, lot(sq).stat
  1524. PRINT #1, lot(sq).mop
  1525. PRINT #1, lot(sq).hk
  1526. FOR sq = 1 TO 2
  1527. PRINT #1, st(sq).ft
  1528. PRINT #1, st(sq).tk
  1529. PRINT #1, st(sq).c
  1530. PRINT #1, st(sq).whr
  1531. PRINT #1, st(sq).jc
  1532. PRINT #1, st(sq).dc
  1533. PRINT #1, st(sq).chag
  1534. PRINT #1, st(sq).cheg
  1535. FOR sq = 1 TO 16
  1536. PRINT #1, cha(sq)
  1537. PRINT #1, che(sq)
  1538. crd
  1539.  
  1540. SUB scha
  1541. box
  1542. ce 5, "Shuffling Chance cards."
  1543. ce 6, "Please wait."
  1544. clk 2
  1545. IF cha(8) = 2 THEN goojfflag = -1
  1546. FOR flip = 1 TO 16
  1547. cha(flip) = 0
  1548. IF goojfflag THEN cha(8) = 2
  1549.  
  1550. SUB sche
  1551. box
  1552. ce 5, "Shuffling Community Chest cards."
  1553. ce 6, "Please wait."
  1554. clk 2
  1555. IF che(6) = 2 THEN goojfflag = -1
  1556. FOR flip = 1 TO 16
  1557. che(flip) = 0
  1558. IF goojfflag THEN che(6) = 2
  1559.  
  1560. SUB short (t, l, m, h)
  1561. IF lot(h).stat = 5 THEN
  1562. lot(h).stat = 4
  1563. bht = bht + 1
  1564. st(t).c = st(t).c + lot(l).bc * sf!
  1565. IF lot(m).stat = 5 THEN
  1566. lot(m).stat = 4
  1567. bht = bht + 1
  1568. st(t).c = st(t).c + lot(l).bc * sf!
  1569. IF lot(l).stat = 5 THEN
  1570. lot(l).stat = 4
  1571. bht = bht + 1
  1572. st(t).c = st(t).c + lot(l).bc * sf!
  1573. quan = chou(1) + chou(2) - 32
  1574. tot = lot(l).stat + lot(m).stat + lot(h).stat - quan
  1575. lot(h).stat = INT(tot / 2)
  1576. lot(l).stat = INT(tot / 2)
  1577. IF lot(h).stat + lot(l).stat < tot THEN lot(h).stat = lot(h).stat + 1
  1578. lot(h).stat = INT(tot / 3)
  1579. lot(m).stat = INT(tot / 3)
  1580. lot(l).stat = INT(tot / 3)
  1581. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(h).stat = lot(h).stat + 1
  1582. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(m).stat = lot(m).stat + 1
  1583. st(t).c = st(t).c + lot(l).bc * quan * sf!
  1584. bhu = 0
  1585. box
  1586. ce 5, RTRIM$(st(t).ft)
  1587. ce 7, "a housing shortage sale taken place."
  1588. p
  1589.  
  1590. SUB shot (t)
  1591. DIM gm(9)
  1592. gm(0) = -1
  1593. box
  1594. IF lot(3).own = t AND lot(3).stat = 5 THEN
  1595. gm(1) = -1
  1596. mini 1
  1597. IF lot(9).own = t AND lot(9).stat = 5 THEN
  1598. gm(2) = -1
  1599. mini 2
  1600. IF lot(14).own = t AND lot(14).stat = 5 THEN
  1601. gm(3) = -1
  1602. mini 3
  1603. IF lot(19).own = t AND lot(19).stat = 5 THEN
  1604. gm(4) = -1
  1605. mini 4
  1606. IF lot(24).own = t AND lot(24).stat = 5 THEN
  1607. gm(5) = -1
  1608. mini 5
  1609. IF lot(29).own = t AND lot(29).stat = 5 THEN
  1610. gm(6) = -1
  1611. mini 6
  1612. IF lot(34).own = t AND lot(34).stat = 5 THEN
  1613. gm(7) = -1
  1614. mini 7
  1615. IF lot(39).own = t AND lot(39).stat = 5 THEN
  1616. gm(8) = -1
  1617. mini 8
  1618. ce 9, RTRIM$(st(t).ft)
  1619. ce 10, "Choose a monopoly to sell hotels from"
  1620. ce 11, "or 0 to continue"
  1621. IF ws > 0 AND (NOT q) THEN b
  1622. ws$ = INKEY$
  1623. IF ws$ = CHR$(13) THEN ws$ = "0"
  1624. LOOP UNTIL ws$ > ""
  1625. IF ws$ >= "0" AND ws$ <= "8" THEN ws = VAL(ws$) ELSE ws = 9
  1626. LOOP UNTIL gm(ws)
  1627. IF ws = 0 THEN EXIT SUB
  1628. box
  1629. ce 5, RTRIM$(st(t).ft)
  1630. pim ws, l, m, h
  1631. IF lot(l).stat = 5 THEN max = 2 ELSE max = 1
  1632. max = 1
  1633. IF lot(m).stat = 5 THEN max = 2
  1634. IF lot(l).stat = 5 THEN max = 3
  1635. ce 7, "you can sell up to " + lts(max) + " hotel(s)."
  1636. ce 8, "or 0 to continue"
  1637. IF st(t).c >= 0 THEN ce 11, "you have $" + ltsb(st(t).c) ELSE ce 11, "you need to raise $" + lts(-st(t).c)
  1638. ce 12, "hotels sell for $" + lts(lot(l).bc * sf!) + " (minus four houses) each."
  1639. quan = ner(9, max)
  1640. IF quan = 0 THEN EXIT SUB
  1641. tot = lot(l).stat + lot(m).stat + lot(h).stat - quan
  1642. lot(h).stat = INT(tot / 2)
  1643. lot(l).stat = INT(tot / 2)
  1644. IF lot(h).stat + lot(l).stat < tot THEN lot(h).stat = lot(h).stat + 1
  1645. lot(h).stat = INT(tot / 3)
  1646. lot(m).stat = INT(tot / 3)
  1647. lot(l).stat = INT(tot / 3)
  1648. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(h).stat = lot(h).stat + 1
  1649. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(m).stat = lot(m).stat + 1
  1650. st(t).c = st(t).c + lot(l).bc * quan * sf!
  1651. IF (NOT x) THEN
  1652. bht = bht + quan
  1653. bhu = bhu - 4 * quan
  1654. IF bhu < 0 THEN short t, l, m, h
  1655.  
  1656. SUB shou (t)
  1657. DIM gm(9)
  1658. gm(0) = -1
  1659. box
  1660. IF lot(3).own = t AND lot(3).stat > 0 AND lot(3).stat < 5 THEN
  1661. gm(1) = -1
  1662. mini 1
  1663. IF lot(9).own = t AND lot(9).stat > 0 AND lot(9).stat < 5 THEN
  1664. gm(2) = -1
  1665. mini 2
  1666. IF lot(14).own = t AND lot(14).stat > 0 AND lot(14).stat < 5 THEN
  1667. gm(3) = -1
  1668. mini 3
  1669. IF lot(19).own = t AND lot(19).stat > 0 AND lot(19).stat < 5 THEN
  1670. gm(4) = -1
  1671. mini 4
  1672. IF lot(24).own = t AND lot(24).stat > 0 AND lot(24).stat < 5 THEN
  1673. gm(5) = -1
  1674. mini 5
  1675. IF lot(29).own = t AND lot(29).stat > 0 AND lot(29).stat < 5 THEN
  1676. gm(6) = -1
  1677. mini 6
  1678. IF lot(34).own = t AND lot(34).stat > 0 AND lot(34).stat < 5 THEN
  1679. gm(7) = -1
  1680. mini 7
  1681. IF lot(39).own = t AND lot(39).stat > 0 AND lot(39).stat < 5 THEN
  1682. gm(8) = -1
  1683. mini 8
  1684. ce 9, RTRIM$(st(t).ft)
  1685. ce 10, "Choose a monopoly to sell houses from"
  1686. ce 11, "or 0 to continue"
  1687. IF ws > 0 AND (NOT q) THEN b
  1688. ws$ = INKEY$
  1689. IF ws$ = CHR$(13) THEN ws$ = "0"
  1690. LOOP UNTIL ws$ > ""
  1691. IF ws$ >= "0" AND ws$ <= "8" THEN ws = VAL(ws$) ELSE ws = 9
  1692. LOOP UNTIL gm(ws)
  1693. IF ws = 0 THEN EXIT SUB
  1694. box
  1695. ce 5, RTRIM$(st(t).ft)
  1696. pim ws, l, m, h
  1697. max = lot(l).stat + lot(h).stat
  1698. max = lot(l).stat + lot(m).stat + lot(h).stat
  1699. ce 7, "you can sell up to " + lts(max) + " house(s)."
  1700. ce 8, "or 0 to continue"
  1701. IF st(t).c >= 0 THEN ce 11, "you have $" + ltsb(st(t).c) ELSE ce 11, "you need to raise $" + lts(-st(t).c)
  1702. ce 12, "houses sell for $" + lts(lot(l).bc * sf!) + " each."
  1703. quan = ner(9, max)
  1704. IF quan = 0 THEN EXIT SUB
  1705. tot = lot(l).stat + lot(m).stat + lot(h).stat - quan
  1706. lot(h).stat = INT(tot / 2)
  1707. lot(l).stat = INT(tot / 2)
  1708. IF lot(h).stat + lot(l).stat < tot THEN lot(h).stat = lot(h).stat + 1
  1709. lot(h).stat = INT(tot / 3)
  1710. lot(m).stat = INT(tot / 3)
  1711. lot(l).stat = INT(tot / 3)
  1712. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(h).stat = lot(h).stat + 1
  1713. IF lot(h).stat + lot(l).stat + lot(m).stat < tot THEN lot(m).stat = lot(m).stat + 1
  1714. st(t).c = st(t).c + lot(l).bc * quan * sf!
  1715. IF (NOT x) THEN bhu = bhu + quan
  1716.  
  1717. SUB sml (wt)
  1718. PRINT wt;
  1719. lil wt
  1720.  
  1721. SUB swbd
  1722. box
  1723. LOCATE 22, 66
  1724. PRINT "MEDIT"
  1725. LOCATE 22, 52
  1726. PRINT "BALTI"
  1727. LOCATE 22, 31
  1728. PRINT "ORIEN"
  1729. LOCATE 22, 17
  1730. PRINT "VERMO"
  1731. LOCATE 22, 10
  1732. PRINT "CONNE"
  1733. LOCATE 20, 3
  1734. PRINT "STCHA"
  1735. LOCATE 16, 3
  1736. PRINT "STATE"
  1737. LOCATE 14, 3
  1738. PRINT "VIRGI"
  1739. LOCATE 10, 3
  1740. PRINT "STJAM"
  1741. LOCATE 6, 3
  1742. PRINT "TENNE"
  1743. LOCATE 4, 3
  1744. PRINT "NEWYO"
  1745. LOCATE 2, 10
  1746. PRINT "KENTU"
  1747. LOCATE 2, 24
  1748. PRINT "INDIA"
  1749. LOCATE 2, 31
  1750. PRINT "ILLIN"
  1751. LOCATE 2, 45
  1752. PRINT "ATLAN"
  1753. LOCATE 2, 52
  1754. PRINT "VENTN"
  1755. LOCATE 2, 66
  1756. PRINT "MARVI"
  1757. LOCATE 4, 73
  1758. PRINT "PACIF"
  1759. LOCATE 6, 73
  1760. PRINT "NORTH"
  1761. LOCATE 10, 73
  1762. PRINT "PENAV"
  1763. LOCATE 16, 73
  1764. PRINT "PARKP"
  1765. LOCATE 20, 73
  1766. PRINT "BOARD"
  1767. LOCATE 22, 38
  1768. PRINT "READR"
  1769. LOCATE 18, 3
  1770. PRINT "ELECT"
  1771. LOCATE 12, 3
  1772. PRINT "PENRR"
  1773. LOCATE 2, 38
  1774. PRINT "B&ORR"
  1775. LOCATE 2, 59
  1776. PRINT "WATER"
  1777. LOCATE 12, 73
  1778. PRINT "SHORT"
  1779. LOCATE 22, 73
  1780. PRINT "<-GO<"
  1781. LOCATE 22, 59
  1782. PRINT "COMMU"
  1783. LOCATE 22, 45
  1784. PRINT "INCTX"
  1785. LOCATE 22, 24
  1786. PRINT "CHANC"
  1787. LOCATE 22, 3
  1788. PRINT "JUSTV"
  1789. LOCATE 8, 3
  1790. PRINT "COMMU"
  1791. LOCATE 2, 3
  1792. PRINT "FREEP"
  1793. LOCATE 2, 17
  1794. PRINT "CHANC"
  1795. LOCATE 2, 73
  1796. PRINT "GOTOJ"
  1797. LOCATE 8, 73
  1798. PRINT "COMMU"
  1799. LOCATE 14, 73
  1800. PRINT "CHANC"
  1801. LOCATE 18, 73
  1802. PRINT "LUXTX"
  1803.  
  1804. SUB swbs
  1805. FOR sq = 1 TO 39
  1806. IF lot(sq).sty = "b" THEN
  1807. LOCATE lot(sq).bdn, lot(sq).bac
  1808. IF (NOT lot(sq).mop) THEN
  1809. PRINT " "
  1810. SELECT CASE lot(sq).stat
  1811. CASE 0 TO 4
  1812. COLOR 0, 10
  1813. PRINT USING "#"; lot(sq).stat
  1814. COLOR 0, 4
  1815. PRINT "H"
  1816. COLOR 15, 0
  1817.  
  1818. SUB tiny (wt)
  1819. PRINT wt;
  1820. COLOR lot(wt).hue
  1821. PRINT lot(wt).ab
  1822.  
  1823. SUB tj (t)
  1824. st(t).jc = st(t).jc + 1
  1825. box
  1826. ce 5, RTRIM$(st(t).ft) + ", in Jail, turn " + lts(st(t).jc) + " with $" + ltsb(st(t).c)
  1827. IF cr(t) + st(t).c >= 50 THEN ce 6, "press M to Make bail (pay $50)"
  1828. IF st(t).chag OR st(t).cheg THEN ce 7, "press C to use 'get out of jail free' Card"
  1829. ce 8, "press R to Roll dice"
  1830. how$ = LCASE$(INKEY$)
  1831. LOOP UNTIL how$ = "r" OR (how$ = "m" AND cr(t) + st(t).c >= 50) OR (how$ = "c" AND (st(t).chag OR st(t).cheg))
  1832. box
  1833. CASE "r"
  1834. ce 5, RTRIM$(st(t).ft) + ", roll " + lts(st(t).jc) + " done, with $" + ltsb(st(t).c)
  1835. rlout = di(d1, d2)
  1836. ce 10, lts(d1) + " + " + lts(d2) + " = " + lts(rlout)
  1837. p
  1838. IF d1 = d2 THEN
  1839. st(t).jc = 0
  1840. st(t).whr = 10
  1841. box
  1842. IF t = 1 THEN LOCATE lot(10).od, lot(10).oa ELSE LOCATE lot(10).id, lot(10).ia
  1843. PRINT st(t).tk
  1844. move rlout, t
  1845. act rlout, t
  1846. IF st(t).jc = 3 THEN
  1847. IF st(t).chag OR st(t).cheg THEN
  1848. ce 6, "press M to Make bail (pay $50)"
  1849. ce 7, "press C to use 'get out of jail free' Card"
  1850. payout$ = LCASE$(INKEY$)
  1851. IF (NOT st(t).chag) AND (NOT st(t).cheg) THEN payout$ = "m"
  1852. LOOP UNTIL payout$ = "m" OR payout$ = "c"
  1853. SELECT CASE payout$
  1854. CASE "m"
  1855. pay t, 50
  1856. IF j THEN fr& = fr& + 50
  1857. CASE "c"
  1858. IF st(t).chag AND st(t).cheg THEN
  1859. ce 10, "Pick a card."
  1860. ce 11, "Press A for chAnce"
  1861. ce 12, "press O for cOmmunity che"
  1862. wtc$ = LCASE$(INKEY$)
  1863. IF (NOT st(t).chag) THEN wtc$ = "o"
  1864. IF (NOT st(t).cheg) THEN wtc$ = "a"
  1865. LOOP UNTIL wtc$ = "a" OR wtc$ = "o"
  1866. IF wtc$ = "a" THEN
  1867. ce 13, "Chance card used."
  1868. st(t).chag = 0
  1869. cha(8) = 1
  1870. ce 13, "Community Chest card used."
  1871. st(t).cheg = 0
  1872. che(6) = 1
  1873. p
  1874. st(t).jc = 0
  1875. st(t).whr = 10
  1876. box
  1877. IF t = 1 THEN LOCATE lot(10).od, lot(10).oa ELSE LOCATE lot(10).id, lot(10).ia
  1878. PRINT st(t).tk
  1879. move rlout, t
  1880. act rlout, t
  1881. opt t
  1882. CASE "m"
  1883. pay t, 50
  1884. IF j THEN fr& = fr& + 50
  1885. st(t).jc = 0
  1886. p
  1887. box
  1888. IF t = 1 THEN LOCATE lot(10).od, lot(10).oa ELSE LOCATE lot(10).id, lot(10).ia
  1889. PRINT st(t).tk
  1890. st(t).whr = 10
  1891. tn t
  1892. CASE "c"
  1893. IF st(t).chag AND st(t).cheg THEN
  1894. ce 10, "Pick a card."
  1895. ce 11, "Press A for chAnce"
  1896. ce 12, "press O for cOmmunity che"
  1897. wtc$ = LCASE$(INKEY$)
  1898. IF (NOT st(t).chag) THEN wtc$ = "o"
  1899. IF (NOT st(t).cheg) THEN wtc$ = "a"
  1900. LOOP UNTIL wtc$ = "a" OR wtc$ = "o"
  1901. IF wtc$ = "a" THEN
  1902. ce 13, "Chance card used."
  1903. st(t).chag = 0
  1904. cha(8) = 1
  1905. ce 13, "Community Chest card used."
  1906. st(t).cheg = 0
  1907. che(6) = 1
  1908. p
  1909. box
  1910. IF t = 1 THEN LOCATE lot(10).od, lot(10).oa ELSE LOCATE lot(10).id, lot(10).ia
  1911. PRINT st(t).tk
  1912. st(t).jc = 0
  1913. st(t).whr = 10
  1914. tn t
  1915.  
  1916. SUB tn (t)
  1917. box
  1918. ce 5, RTRIM$(st(t).ft) + " press any key to roll the dice."
  1919. p
  1920. box
  1921. ce 5, RTRIM$(st(t).ft)
  1922. rl = di(d1, d2)
  1923. ce 7, lts(d1) + " + " + lts(d2) + " = " + lts(rl)
  1924. IF d1 = d2 THEN st(t).dc = st(t).dc + 1 ELSE st(t).dc = 0
  1925. SELECT CASE st(t).dc
  1926. clk 1.5
  1927. ce 8, "first doubles"
  1928. clk 1.5
  1929. ce 8, "second doubles"
  1930. clk 1.5
  1931. ce 8, "Third doubles"
  1932. ar t
  1933. IF st(t).whr > -10 THEN
  1934. move rl, t
  1935. act rl, t
  1936. opt t
  1937. LOOP UNTIL st(t).dc = 0
  1938.  
  1939. SUB trade
  1940. DIM wit(41), cg(1 TO 2)
  1941. FOR gvr = 1 TO 2
  1942. REDIM mt(41)
  1943. mt(0) = -1
  1944. box
  1945. IF lot(1).own = gvr AND lot(3).stat = 0 THEN
  1946. LOCATE 5, 11
  1947. sml 1
  1948. mt(1) = -1
  1949. IF lot(3).own = gvr AND lot(3).stat = 0 THEN
  1950. LOCATE 6, 11
  1951. sml 3
  1952. mt(3) = -1
  1953. IF lot(5).own = gvr THEN
  1954. LOCATE 7, 11
  1955. sml 5
  1956. mt(5) = -1
  1957. IF lot(6).own = gvr AND lot(9).stat = 0 THEN
  1958. LOCATE 8, 11
  1959. sml 6
  1960. mt(6) = -1
  1961. IF lot(8).own = gvr AND lot(9).stat = 0 THEN
  1962. LOCATE 9, 11
  1963. sml 8
  1964. mt(8) = -1
  1965. IF lot(9).own = gvr AND lot(9).stat = 0 THEN
  1966. LOCATE 10, 11
  1967. sml 9
  1968. mt(9) = -1
  1969. IF lot(11).own = gvr AND lot(14).stat = 0 THEN
  1970. LOCATE 5, 25
  1971. sml 11
  1972. mt(11) = -1
  1973. IF lot(12).own = gvr THEN
  1974. LOCATE 6, 25
  1975. sml 12
  1976. mt(12) = -1
  1977. IF lot(13).own = gvr AND lot(14).stat = 0 THEN
  1978. LOCATE 7, 25
  1979. sml 13
  1980. mt(13) = -1
  1981. IF lot(14).own = gvr AND lot(14).stat = 0 THEN
  1982. LOCATE 8, 25
  1983. sml 14
  1984. mt(14) = -1
  1985. IF lot(15).own = gvr THEN
  1986. LOCATE 9, 25
  1987. sml 15
  1988. mt(15) = -1
  1989. IF lot(16).own = gvr AND lot(19).stat = 0 THEN
  1990. LOCATE 10, 25
  1991. sml 16
  1992. mt(16) = -1
  1993. IF lot(18).own = gvr AND lot(19).stat = 0 THEN
  1994. LOCATE 11, 25
  1995. sml 18
  1996. mt(18) = -1
  1997. IF lot(19).own = gvr AND lot(19).stat = 0 THEN
  1998. LOCATE 12, 25
  1999. sml 19
  2000. mt(19) = -1
  2001. IF lot(21).own = gvr AND lot(24).stat = 0 THEN
  2002. LOCATE 5, 40
  2003. sml 21
  2004. mt(21) = -1
  2005. IF lot(23).own = gvr AND lot(24).stat = 0 THEN
  2006. LOCATE 6, 40
  2007. sml 23
  2008. mt(23) = -1
  2009. IF lot(24).own = gvr AND lot(24).stat = 0 THEN
  2010. LOCATE 7, 40
  2011. sml 24
  2012. mt(24) = -1
  2013. IF lot(25).own = gvr THEN
  2014. LOCATE 8, 40
  2015. sml 25
  2016. mt(25) = -1
  2017. IF lot(26).own = gvr AND lot(29).stat = 0 THEN
  2018. LOCATE 9, 40
  2019. sml 26
  2020. mt(26) = -1
  2021. IF lot(27).own = gvr AND lot(29).stat = 0 THEN
  2022. LOCATE 10, 40
  2023. sml 27
  2024. mt(27) = -1
  2025. IF lot(28).own = gvr THEN
  2026. LOCATE 11, 40
  2027. sml 28
  2028. mt(28) = -1
  2029. IF lot(29).own = gvr AND lot(29).stat = 0 THEN
  2030. LOCATE 12, 40
  2031. sml 29
  2032. mt(29) = -1
  2033. IF lot(31).own = gvr AND lot(34).stat = 0 THEN
  2034. LOCATE 5, 55
  2035. sml 31
  2036. mt(31) = -1
  2037. IF lot(32).own = gvr AND lot(34).stat = 0 THEN
  2038. LOCATE 6, 55
  2039. sml 32
  2040. mt(32) = -1
  2041. IF lot(34).own = gvr AND lot(34).stat = 0 THEN
  2042. LOCATE 7, 55
  2043. sml 34
  2044. mt(34) = -1
  2045. IF lot(35).own = gvr THEN
  2046. LOCATE 8, 55
  2047. sml 35
  2048. mt(35) = -1
  2049. IF lot(37).own = gvr AND lot(39).stat = 0 THEN
  2050. LOCATE 9, 55
  2051. sml 37
  2052. mt(37) = -1
  2053. IF lot(39).own = gvr AND lot(39).stat = 0 THEN
  2054. LOCATE 10, 55
  2055. sml 39
  2056. mt(39) = -1
  2057. IF st(gvr).chag THEN
  2058. LOCATE 12, 11
  2059. PRINT 40;
  2060. PRINT "GOOJF"
  2061. mt(40) = -1
  2062. IF st(gvr).cheg THEN
  2063. LOCATE 12, 55
  2064. PRINT 41;
  2065. PRINT "GOOJF"
  2066. mt(41) = -1
  2067. ce 13, RTRIM$(st(gvr).ft) + ", you have $" + ltsb(st(gvr).c)
  2068. ce 14, "Choose a deed to trade or 0 to continue"
  2069. pick = 0
  2070. IF (NOT mt(pick)) AND (NOT q) THEN b
  2071. pick = ner(15, 41)
  2072. LOOP UNTIL mt(pick)
  2073. CASE 1 TO 39
  2074. lot(pick).own = 0
  2075. CASE 40
  2076. st(gvr).chag = 0
  2077. CASE 41
  2078. st(gvr).cheg = 0
  2079. wit(pick) = gvr
  2080. LOOP UNTIL pick = 0
  2081. ce 16, "cash to give"
  2082. cg(gvr) = nerb(17, st(gvr).c)
  2083. IF cg(1) > cg(2) THEN
  2084. box
  2085. popp 1, cg(1) - cg(2)
  2086. IF cg(2) > cg(1) THEN
  2087. box
  2088. popp 2, cg(2) - cg(1)
  2089. IF wit(40) > 0 THEN st(3 - wit(40)).chag = -1
  2090. IF wit(41) > 0 THEN st(3 - wit(41)).cheg = -1
  2091. FOR flip = 1 TO 39
  2092. IF wit(flip) > 0 AND (NOT lot(flip).hk) THEN
  2093. lot(flip).own = 3 - wit(flip)
  2094. wit(flip) = 0
  2095. FOR flip = 1 TO 39
  2096. IF wit(flip) > 0 THEN
  2097. lot(flip).own = 3 - wit(flip)
  2098. box
  2099. ce 5, RTRIM$(st(3 - wit(flip)).ft) + ", you have $" + ltsb(st(3 - wit(flip)).c)
  2100. COLOR lot(flip).hue
  2101. ce 6, RTRIM$(lot(flip).ttl)
  2102. ce 7, "is mortgaged."
  2103. IF st(3 - wit(flip)).c >= INT(.5 + lot(flip).c * uf!) THEN
  2104. ce 8, "Do you want to unmortgage it now? (Y/N)"
  2105. y = INT(.5 + lot(flip).c * uf!)
  2106. n = INT(.5 + lot(flip).c * (uf! - .5))
  2107. ce 9, "Y will cost $" + lts(y)
  2108. IF n > 0 THEN ce 10, "N will cost $" + lts(n)
  2109. yn$ = LCASE$(INKEY$)
  2110. LOOP UNTIL yn$ = "y" OR yn$ = "n"
  2111. yn$ = "n"
  2112. IF yn$ = "y" THEN
  2113. pay 3 - wit(flip), y
  2114. lot(flip).hk = 0
  2115. IF n > 0 THEN
  2116. pay 3 - wit(flip), n
  2117. ce 14, "mortgaged property fee."
  2118. p
  2119.  
  2120. tx$ = INKEY$
  2121. LOOP UNTIL tx$ > ""
  2122. CASE "a" TO "z", CHR$(13), CHR$(8)
  2123. valid = -1
  2124. valid = 0
  2125. IF (NOT q) THEN b
  2126. LOOP UNTIL valid
  2127. txk = tx$
  2128.  
  2129. SUB unm (t)
  2130. DIM gp(39)
  2131. gp(0) = -1
  2132. box
  2133. IF lot(1).own = t AND lot(1).hk AND st(t).c >= INT(.5 + lot(1).c * uf!) THEN
  2134. LOCATE 5, 11
  2135. dy 1
  2136. gp(1) = -1
  2137. IF lot(3).own = t AND lot(3).hk AND st(t).c >= INT(.5 + lot(3).c * uf!) THEN
  2138. LOCATE 6, 11
  2139. dy 3
  2140. gp(3) = -1
  2141. IF lot(5).own = t AND lot(5).hk AND st(t).c >= INT(.5 + lot(5).c * uf!) THEN
  2142. LOCATE 7, 11
  2143. dy 5
  2144. gp(5) = -1
  2145. IF lot(6).own = t AND lot(6).hk AND st(t).c >= INT(.5 + lot(6).c * uf!) THEN
  2146. LOCATE 8, 11
  2147. dy 6
  2148. gp(6) = -1
  2149. IF lot(8).own = t AND lot(8).hk AND st(t).c >= INT(.5 + lot(8).c * uf!) THEN
  2150. LOCATE 9, 11
  2151. dy 8
  2152. gp(8) = -1
  2153. IF lot(9).own = t AND lot(9).hk AND st(t).c >= INT(.5 + lot(9).c * uf!) THEN
  2154. LOCATE 10, 11
  2155. dy 9
  2156. gp(9) = -1
  2157. IF lot(11).own = t AND lot(11).hk AND st(t).c >= INT(.5 + lot(11).c * uf!) THEN
  2158. LOCATE 5, 26
  2159. dy 11
  2160. gp(11) = -1
  2161. IF lot(12).own = t AND lot(12).hk AND st(t).c >= INT(.5 + lot(12).c * uf!) THEN
  2162. LOCATE 6, 26
  2163. dy 12
  2164. gp(12) = -1
  2165. IF lot(13).own = t AND lot(13).hk AND st(t).c >= INT(.5 + lot(13).c * uf!) THEN
  2166. LOCATE 7, 26
  2167. dy 13
  2168. gp(13) = -1
  2169. IF lot(14).own = t AND lot(14).hk AND st(t).c >= INT(.5 + lot(14).c * uf!) THEN
  2170. LOCATE 8, 26
  2171. dy 14
  2172. gp(14) = -1
  2173. IF lot(15).own = t AND lot(15).hk AND st(t).c >= INT(.5 + lot(15).c * uf!) THEN
  2174. LOCATE 9, 26
  2175. dy 15
  2176. gp(15) = -1
  2177. IF lot(16).own = t AND lot(16).hk AND st(t).c >= INT(.5 + lot(16).c * uf!) THEN
  2178. LOCATE 10, 26
  2179. dy 16
  2180. gp(16) = -1
  2181. IF lot(18).own = t AND lot(18).hk AND st(t).c >= INT(.5 + lot(18).c * uf!) THEN
  2182. LOCATE 11, 26
  2183. dy 18
  2184. gp(18) = -1
  2185. IF lot(19).own = t AND lot(19).hk AND st(t).c >= INT(.5 + lot(19).c * uf!) THEN
  2186. LOCATE 12, 26
  2187. dy 19
  2188. gp(19) = -1
  2189. IF lot(21).own = t AND lot(21).hk AND st(t).c >= INT(.5 + lot(21).c * uf!) THEN
  2190. LOCATE 5, 41
  2191. dy 21
  2192. gp(21) = -1
  2193. IF lot(23).own = t AND lot(23).hk AND st(t).c >= INT(.5 + lot(23).c * uf!) THEN
  2194. LOCATE 6, 41
  2195. dy 23
  2196. gp(23) = -1
  2197. IF lot(24).own = t AND lot(24).hk AND st(t).c >= INT(.5 + lot(24).c * uf!) THEN
  2198. LOCATE 7, 41
  2199. dy 24
  2200. gp(24) = -1
  2201. IF lot(25).own = t AND lot(25).hk AND st(t).c >= INT(.5 + lot(25).c * uf!) THEN
  2202. LOCATE 8, 41
  2203. dy 25
  2204. gp(25) = -1
  2205. IF lot(26).own = t AND lot(26).hk AND st(t).c >= INT(.5 + lot(26).c * uf!) THEN
  2206. LOCATE 9, 41
  2207. dy 26
  2208. gp(26) = -1
  2209. IF lot(27).own = t AND lot(27).hk AND st(t).c >= INT(.5 + lot(27).c * uf!) THEN
  2210. LOCATE 10, 41
  2211. dy 27
  2212. gp(27) = -1
  2213. IF lot(28).own = t AND lot(28).hk AND st(t).c >= INT(.5 + lot(28).c * uf!) THEN
  2214. LOCATE 11, 41
  2215. dy 28
  2216. gp(28) = -1
  2217. IF lot(29).own = t AND lot(29).hk AND st(t).c >= INT(.5 + lot(29).c * uf!) THEN
  2218. LOCATE 12, 41
  2219. dy 29
  2220. gp(29) = -1
  2221. IF lot(31).own = t AND lot(31).hk AND st(t).c >= INT(.5 + lot(31).c * uf!) THEN
  2222. LOCATE 5, 56
  2223. dy 31
  2224. gp(31) = -1
  2225. IF lot(32).own = t AND lot(32).hk AND st(t).c >= INT(.5 + lot(32).c * uf!) THEN
  2226. LOCATE 6, 56
  2227. dy 32
  2228. gp(32) = -1
  2229. IF lot(34).own = t AND lot(34).hk AND st(t).c >= INT(.5 + lot(34).c * uf!) THEN
  2230. LOCATE 7, 56
  2231. dy 34
  2232. gp(34) = -1
  2233. IF lot(35).own = t AND lot(35).hk AND st(t).c >= INT(.5 + lot(35).c * uf!) THEN
  2234. LOCATE 8, 56
  2235. dy 35
  2236. gp(35) = -1
  2237. IF lot(37).own = t AND lot(37).hk AND st(t).c >= INT(.5 + lot(37).c * uf!) THEN
  2238. LOCATE 9, 56
  2239. dy 37
  2240. gp(37) = -1
  2241. IF lot(39).own = t AND lot(39).hk AND st(t).c >= INT(.5 + lot(39).c * uf!) THEN
  2242. LOCATE 10, 56
  2243. dy 39
  2244. gp(39) = -1
  2245. ce 13, RTRIM$(st(t).ft)
  2246. ce 14, "Choose a deed to unmortgage or 0 to continue"
  2247. ce 17, "you have $" + ltsb(st(t).c)
  2248. IF (NOT gp(pick)) AND (NOT q) THEN b
  2249. pick = ner(15, 39)
  2250. LOOP UNTIL gp(pick)
  2251. IF pick = 0 THEN EXIT SUB
  2252. lot(pick).hk = 0
  2253. box
  2254. pay t, INT(.5 + lot(pick).c * uf!)
  2255. p
  2256.  
  2257. SUB upd
  2258. chk 1, 1, 3
  2259. chk 6, 8, 9
  2260. chk 11, 13, 14
  2261. chk 16, 18, 19
  2262. chk 21, 23, 24
  2263. chk 26, 27, 29
  2264. chk 31, 32, 34
  2265. chk 37, 37, 39
  2266. IF lot(12).own = lot(28).own AND lot(12).own > 0 THEN
  2267. lot(12).stat = 2
  2268. lot(28).stat = 2
  2269. lot(12).stat = SGN(lot(12).own)
  2270. lot(28).stat = SGN(lot(28).own)
  2271. FOR rtt = 5 TO 35 STEP 10
  2272. rro = rro * 10 + lot(rtt).own
  2273. lot(rtt).stat = 0
  2274. CASE 1111, 2222
  2275. lot(5).stat = 4
  2276. lot(15).stat = 4
  2277. lot(25).stat = 4
  2278. lot(35).stat = 4
  2279. CASE 111, 222, 1222, 2111
  2280. lot(15).stat = 3
  2281. lot(25).stat = 3
  2282. lot(35).stat = 3
  2283. CASE 1011, 1211, 2022, 2122
  2284. lot(5).stat = 3
  2285. lot(25).stat = 3
  2286. lot(35).stat = 3
  2287. CASE 1101, 1121, 2202, 2212
  2288. lot(5).stat = 3
  2289. lot(15).stat = 3
  2290. lot(35).stat = 3
  2291. CASE 1110, 1112, 2220, 2221
  2292. lot(5).stat = 3
  2293. lot(15).stat = 3
  2294. lot(25).stat = 3
  2295. IF lot(5).own = lot(15).own AND lot(5).own > 0 THEN
  2296. lot(5).stat = 2
  2297. lot(15).stat = 2
  2298. IF lot(5).own = lot(25).own AND lot(5).own > 0 THEN
  2299. lot(5).stat = 2
  2300. lot(25).stat = 2
  2301. IF lot(5).own = lot(35).own AND lot(5).own > 0 THEN
  2302. lot(5).stat = 2
  2303. lot(35).stat = 2
  2304. IF lot(15).own = lot(25).own AND lot(15).own > 0 THEN
  2305. lot(15).stat = 2
  2306. lot(25).stat = 2
  2307. IF lot(15).own = lot(35).own AND lot(15).own > 0 THEN
  2308. lot(15).stat = 2
  2309. lot(35).stat = 2
  2310. IF lot(25).own = lot(35).own AND lot(25).own > 0 THEN
  2311. lot(25).stat = 2
  2312. lot(35).stat = 2
  2313. FOR rtt = 5 TO 35 STEP 10
  2314. IF lot(rtt).stat = 0 THEN lot(rtt).stat = SGN(lot(rtt).own)
  2315. swbs
  2316.  
  2317. SUB utc (t)
  2318. IF lot(st(t).whr).own = 0 THEN
  2319. noo t
  2320. IF lot(st(t).whr).own = t THEN
  2321. COLOR lot(st(t).whr).hue
  2322. ce 12, RTRIM$(lot(st(t).whr).ttl)
  2323. ce 13, "is yours."
  2324. p
  2325. IF lot(st(t).whr).hk THEN
  2326. COLOR lot(st(t).whr).hue
  2327. ce 12, RTRIM$(lot(st(t).whr).ttl)
  2328. ce 13, "is mortgaged."
  2329. p
  2330. crl = di(d1, d2)
  2331. ce 11, lts(d1) + " + " + lts(d2) + " = " + lts(crl) + ", $" + lts(10 * crl) + " due."
  2332. p
  2333. popp t, 10 * crl
  2334.  
  2335. SUB vwd
  2336. box
  2337. LOCATE 5, 11
  2338. tiny 1
  2339. LOCATE 6, 11
  2340. tiny 3
  2341. LOCATE 7, 11
  2342. tiny 5
  2343. LOCATE 8, 11
  2344. tiny 6
  2345. LOCATE 9, 11
  2346. tiny 8
  2347. LOCATE 10, 11
  2348. tiny 9
  2349. LOCATE 5, 25
  2350. tiny 11
  2351. LOCATE 6, 25
  2352. tiny 12
  2353. LOCATE 7, 25
  2354. tiny 13
  2355. LOCATE 8, 25
  2356. tiny 14
  2357. LOCATE 9, 25
  2358. tiny 15
  2359. LOCATE 10, 25
  2360. tiny 16
  2361. LOCATE 11, 25
  2362. tiny 18
  2363. LOCATE 12, 25
  2364. tiny 19
  2365. LOCATE 5, 40
  2366. tiny 21
  2367. LOCATE 6, 40
  2368. tiny 23
  2369. LOCATE 7, 40
  2370. tiny 24
  2371. LOCATE 8, 40
  2372. tiny 25
  2373. LOCATE 9, 40
  2374. tiny 26
  2375. LOCATE 10, 40
  2376. tiny 27
  2377. LOCATE 11, 40
  2378. tiny 28
  2379. LOCATE 12, 40
  2380. tiny 29
  2381. LOCATE 5, 55
  2382. tiny 31
  2383. LOCATE 6, 55
  2384. tiny 32
  2385. LOCATE 7, 55
  2386. tiny 34
  2387. LOCATE 8, 55
  2388. tiny 35
  2389. LOCATE 9, 55
  2390. tiny 37
  2391. LOCATE 10, 55
  2392. tiny 39
  2393. ce 13, "choose a deed to view or 0 to continue"
  2394. wt = ner(14, 39)
  2395. IF wt = 0 THEN EXIT DO
  2396. SELECT CASE lot(wt).sty
  2397. CASE "b"
  2398. box
  2399. COLOR lot(wt).hue
  2400. ce 5, RTRIM$(lot(wt).ttl)
  2401. ce 6, "cost $" + lts(lot(wt).c)
  2402. ce 7, "mortgage value $" + lts(lot(wt).c / 2)
  2403. ce 8, "rent $" + lts(lot(wt).r)
  2404. ce 9, "rent with one house $" + lts(lot(wt).r1)
  2405. ce 10, "rent with two houses $" + lts(lot(wt).r2)
  2406. ce 11, "rent with three houses $" + lts(lot(wt).r3)
  2407. ce 12, "rent with four houses $" + lts(lot(wt).r4)
  2408. ce 13, "rent with hotel $" + lts(lot(wt).rhot)
  2409. ce 14, "houses cost $" + lts(lot(wt).bc) + " each"
  2410. ce 15, "hotel costs $" + lts(lot(wt).bc) + " plus 4 houses"
  2411. IF lot(wt).own = 0 THEN
  2412. ce 16, "unowned"
  2413. ce 16, "owned by " + RTRIM$(st(lot(wt).own).ft)
  2414. IF lot(wt).hk THEN
  2415. ce 17, "mortgaged, $" + lts(INT(.5 + lot(wt).c * uf!)) + " to unmortgage."
  2416. SELECT CASE lot(wt).stat
  2417. ce 17, "with no buildings"
  2418. ce 17, "with one house"
  2419. ce 17, "with two houses"
  2420. ce 17, "with three houses"
  2421. ce 17, "with four houses"
  2422. ce 17, "with hotel"
  2423. p
  2424. CASE "u"
  2425. box
  2426. COLOR lot(wt).hue
  2427. ce 5, RTRIM$(lot(wt).ttl)
  2428. ce 6, "cost $150"
  2429. ce 7, "mortgage value $75"
  2430. ce 8, "rent with one Utility, four times dice"
  2431. ce 9, "rent with two Utilities, ten times dice"
  2432. IF lot(wt).own = 0 THEN
  2433. ce 16, "unowned"
  2434. ce 16, "owned by " + RTRIM$(st(lot(wt).own).ft)
  2435. IF lot(wt).hk THEN ce 17, "mortgaged, $" + lts(INT(.5 + lot(wt).c * uf!)) + " to unmortgage."
  2436. SELECT CASE lot(wt).stat
  2437. ce 18, "one Utility"
  2438. ce 18, "two utlities"
  2439. p
  2440. CASE "r"
  2441. box
  2442. COLOR lot(wt).hue
  2443. ce 5, RTRIM$(lot(wt).ttl)
  2444. ce 6, "cost $200"
  2445. ce 7, "mortgage value $100"
  2446. ce 8, "rent with one Railroad $25"
  2447. ce 9, "rent with two Railroads $50"
  2448. ce 10, "rent with three Railroads $100"
  2449. ce 11, "rent with four Railroads $200"
  2450. IF lot(wt).own = 0 THEN
  2451. ce 16, "unowned"
  2452. ce 16, "owned by " + RTRIM$(st(lot(wt).own).ft)
  2453. IF lot(wt).hk THEN ce 17, "mortgaged, $" + lts(INT(.5 + lot(wt).c * uf!)) + " to unmortgage."
  2454. SELECT CASE lot(wt).stat
  2455. ce 18, "one Railroad"
  2456. ce 18, "two Railroads"
  2457. ce 18, "three Railroads"
  2458. ce 18, "four Railroads"
  2459. p
  2460. CASE "o"
  2461. IF (NOT q) THEN b
  2462. LOOP UNTIL wt = 0
  2463.  
  2464.  
I apologise with all QB64 coders not mentioned here, I preferred to use code taken from sample folder of QB64.
Hey I must apologise also with curator of the QB64 website! I have posted a code more than 1000 lines and you can find fun that linecode's number restarts from 1 after 1000!
Thanks to read

stavo guardando questo codice tante righe di codice scritte complimenti chi a creato questo programma
senza i commenti questo codice è leggibile per un altro programmatore?
se avessi solo un'ora per salvare il mondo, passerei 55 minuti per definire bene il problema e 5 a trovare la soluzione

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #21 on: November 09, 2020, 09:54:19 am »
Ciao Kiara87
ho postato quel codice per mostrare come con una programmazione strutturata è possibile scrivere programmi molto grandi senza perdere la leggibilità del codice...
ma iniziare da questo per te NON è il massimo, dovresti analizzare 3214 linee di codice!
sicuramente le variabili qui sono le famose variabili savefinger abbreviate al massimo e per niente autoesplicative e quindi richiedono un po' di tempo per essere individuate anche se la UDT dovrebbe essere di aiuto (TYPE...END TYPE) visto che questo è il gioco del monopoli scritto in QB4.5 o QBasic (sono la dichiarazione delle SUB e FUNCTION a farlo supporre).
Prova gli esempi che trovi nella wiki, e poi una ampia fonte di programmi sono appunto nella cartella PROGRAMS\SAMPLES, alcuni sono più complessi altri più semplici, alcuni lunghi migliaia di righe altri poche righe. Inizia in piccolo e prosegui spedito.
Nell'eseguire il programma caricato con F5 o RUN potresti non vedere niente o delle performance anormali, in tal caso inserisci nel loop principale un _LIMIT 10 e riprova. Sai sono programmi scritti per CPU quali il 286,il 386 e 486 max 40/100Mhz, oggi abbiamo i3,i5,i7 1.6/40 Ghz . Pensa che 1 Ghz = 1000 Mhz. :-)
Programming isn't difficult, only it's  consuming time and coffee

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #22 on: November 09, 2020, 11:29:09 am »
I have daily used a spiral notebooks (not Golden, in fact most is throw away trash but handy to get ideas out of my head) and worked out sketches of how I might do this or that critical operation in program. Much of it is habitual, establish habits of how to do this or that thing.

What's a Golden and why is it so good?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #23 on: November 09, 2020, 11:44:07 am »
What's a Golden and why is it so good?

This is Golden Spiral 
https://www.qb64.org/forum/index.php?topic=3220.msg124992#msg124992

;-))

It's good because it's not BullSh*t  ;-))

It IS logarithmic! means continuous and thus subject to calculus Not discrete and not calculus subject.

Good because it's continuous and forever and everywhere like eternal truths of mathematics. :)

Are you a believer? ;)

« Last Edit: November 09, 2020, 11:45:55 am by bplus »

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #24 on: November 09, 2020, 12:13:47 pm »
On the matter of Flow Charts and White Boards with markers - I'm one of those people who learn the hard way - do,fail, do again and one of my most difficult programming learning items is logic. I find my logic is very different from the computer's logic. A flow chart on a white board helps a lot to figure out where to place a routine or insert a piece of data. I find it most helpful in loops where i can compare what I see the computer displaying from what I had expected on my flow chart.

And when it comes to learning - the smartest thing i ever did was join this site.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #25 on: November 09, 2020, 12:29:45 pm »
Quote
I find it most helpful in loops where i can compare what I see the computer displaying from what I had expected on my flow chart.

Oh man if you had an specific example of that, I think it would be helpful in showing flow chart.

On the subject of loops and cycles, I think I started with FOR index = start TO finish STEP incrementer... NEXT because it works hand in hand with arrays the index to the FOR counter becomes the same as the index to an array ie array(index), so the FOT NEXT loop is a natural for processing array data.

The FOR... NEXT loop has a built in exit condition when the index exceeds the finish value. Hard to make infinite loops unless you mess with the index in the loop. All the other loop structures require you to decide and declare the exit condition.
« Last Edit: November 09, 2020, 12:32:21 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #26 on: November 09, 2020, 12:56:20 pm »
For @Kiara87

Here is an exercise with 1 array and a couple of loops that involves prime numbers and non primes called composites:

Dimension an array of integers then fill it with index number 1 to 100, starting with 2 the first prime number mark all numbers divisible by 2 with a value of 2 in the array, then do 3's then do 5's skipping 4 because it was marked with 2 once you get to 10 the square root of 100 you will know all the primes and composites of numbers from 2 to 100, if the number is still then same as it's index it is prime otherwise it is a composite with it's lowest divisor marked in the array.

You don't have to go higher than 10 because a composite below 100 will always have a factor less than 10 (in fact you could go up to 120 because 121 is first composite number 11 takes out.

So what are all the primes from 1 to 100 skipping 1 of course because it essential in defining a prime.

or do it the hard way, for the numbers 1 to 100 if you can find a number that divides it by checking all number less, if non divide it then it is prime if one divides it then replace value in array with the smallest number that does.

A number x divides another n if INT(n/x) = n/x or n MOD x = 0 ie no remainder when n is divided by x.

Maybe @TempodiBasic  or  @Kernelpanic  can help translate to Italian?
« Last Edit: November 09, 2020, 01:09:07 pm by bplus »

Offline Kiara87

  • Forum Regular
  • Posts: 164
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #27 on: November 09, 2020, 03:33:50 pm »
For @Kiara87

Here is an exercise with 1 array and a couple of loops that involves prime numbers and non primes called composites:

Dimension an array of integers then fill it with index number 1 to 100, starting with 2 the first prime number mark all numbers divisible by 2 with a value of 2 in the array, then do 3's then do 5's skipping 4 because it was marked with 2 once you get to 10 the square root of 100 you will know all the primes and composites of numbers from 2 to 100, if the number is still then same as it's index it is prime otherwise it is a composite with it's lowest divisor marked in the array.

You don't have to go higher than 10 because a composite below 100 will always have a factor less than 10 (in fact you could go up to 120 because 121 is first composite number 11 takes out.

So what are all the primes from 1 to 100 skipping 1 of course because it essential in defining a prime.

or do it the hard way, for the numbers 1 to 100 if you can find a number that divides it by checking all number less, if non divide it then it is prime if one divides it then replace value in array with the smallest number that does.

A number x divides another n if INT(n/x) = n/x or n MOD x = 0 ie no remainder when n is divided by x.

Maybe @TempodiBasic  or  @Kernelpanic  can help translate to Italian?

@Kernelpanic doesn't speak Italian I don't think you understand well with the translator
while @TempodiBasic is Italian, he can express himself better in Italian

from what I understand I have to create a program that signs even numbers and odd numbers with for to next?
se avessi solo un'ora per salvare il mondo, passerei 55 minuti per definire bene il problema e 5 a trovare la soluzione

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #28 on: November 09, 2020, 03:50:05 pm »
I object to the word "spaghetti" being maligned.  It's my favorite food.  It's also, according
to Michael Collins, the only food Al Bean ate. 

Flow charts imply planning.  The trouble with planning is that if one does too much of it, one
never gets to coding.  I'm only half joking - planning dulls enthusiasm.  I suggest getting a
project accomplished any which way, then doing it over properly.  Usually most of the code can
be recycled.  And eventually one becomes experienced enough that a half-baked plan turns out
to be the right one. 

On the other hand, this saying has ominous parallels:

A couple of months in the laboratory can frequently save a couple of hours in the library.
   - Frank (Henry) Westheimer, American chemist and teacher
It works better if you plug it in.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: WHILE AND DO LOOP CYCLES
« Reply #29 on: November 09, 2020, 03:57:20 pm »
@Kernelpanic doesn't speak Italian I don't think you understand well with the translator
while @TempodiBasic is Italian, he can express himself better in Italian

from what I understand I have to create a program that signs even numbers and odd numbers with for to next?

Apologies to @Kernelpanic I misunderstood, you are German?

@Kiara87  No odds/evens, find Prime Numbers from 2 to 100 with the help of an array to store findings. (You don't have to, of course, just trying to find ways to for you to practice with arrays.)