QBASIC grid help

by rob (no login)

 

Imagine a 2D grid with sequentially numbered cells. Each cell contains a random dollar amount in the range $10 to +$10. The player, who cannot see the amounts in the cells, is allowed 10 guesses. As the guesses are made, the dollar amount for the cells chosen are displayed and accumulated and the current performance displayed. After the 10 guesses have all been made, the player is informed of the results and permitted to play again if he/she desires.



Write a BASIC program to play this game. Your program should get the grid dimensions from the user, randomly create the dollar amounts for each cell, display the grid with sequentially numbered cells, then allow the user to guess. Update the display (in place) to show the progress of the game. Do not permit a user to select a cell more than once per game.



You will need to use a two-dimensional array to contain the locations of the money. The LOCATE statement is essential for proper display of the treasure hunters progress.

its due tommorow and i can set up my array and a few little other things but for the most part i dont have a clue


e.g.

DIM array(10, 10) AS INTEGER, picked(10, 10) AS INTEGER
FOR i = 1 TO 10
FOR j = 1 TO 10
array(i, j) = INT(RND(1)*21)-10
NEXT
NEXT

Posted on Apr 29, 2009, 6:42 AM

Respond to this message   

Goto Forum Home

Response TitleAuthor and Date
You should do your own homeworkPharoah on Apr 29
* You could use RANDOMIZE TIMER for better RND. on Apr 29
 *Didn't notice that. Yes, use RANDOMIZE TIMER, else you'll get the same results each time.Pharoah on Apr 29
  * Please don't encourage me :-) on Apr 29
Re:Ben on Apr 29
 I think it's supposed to give negative numbersPharoah on Apr 29
  I seeBen on Apr 29
   Ben you are supplying code to a person that has not even tried that hard. on Apr 29
    If they really don't care....Ben on Apr 30
     I wish my school had home ecPharoah on Apr 30
     Oh, they care! But they just want to have somebody else do it. on Apr 30
 Re: Teachers on May 2
* Program code removed. Let's stick to the Homework policy; OK, people? on Apr 29
 * OK Pete, if you INSIST! on Apr 29

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement