winzip icon

Locker Problem Maths Simulator

Email
Submitted on: 12/26/2018 2:24:43 PM
By: Eddie Bole 
Level: Beginner
User Rating: By 1 Users
Compatibility: VB 6.0
Views: 1488
 
     A hands on simulator for the maths locker problem. For a set of 26 lockers person 1 opens all lockers. Person 2 then closes every 2nd locker. Then person 3 CLOSES every 3rd if it is OPEN and also OPENS every 3rd if it is CLOSED, and so on .... I used MCListbox which was developed by some guys here on Planet VB. I noticed when you finish the whole 26 lockers the items in line 1 (uppermost) disappears when you scroll the list downwards. I'm not sure if their is a bug in MCListbox 3.3 hybrid or perhaps I needed to do something extra to prevent this from happening. If anyone can sort this bug out it would be appreciated. Regards Ed. Best wishes for the Xmas break.

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 139 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

12/27/2018 11:37:52 AMPaul Bahlawan

Eddie, I suppose I was expecting the program to do the opening and closing, but its doesn't. The rest button opens all the lockers? The answer is perfect squares, of course. 1^2, 2^2, 3^2, 4^2, 5^2 (1, 4, 9, 16, 25)
(If this comment was disrespectful, please report it.)

 
12/27/2018 4:32:12 PMsal

mRowHeight = ScaleHeight / m_iCount

error: division by zero
(If this comment was disrespectful, please report it.)

 
12/28/2018 3:08:40 AMRde

Hi Eddie
I like this, I now get the hands on bit(comment above :)
Reminds me of binary heap a little, even by the fourth guy you can see the effect beginning
Great submission and happy coding :)
(If this comment was disrespectful, please report it.)

 
12/28/2018 3:10:59 AMRde

Ps I don't have mclist
(If this comment was disrespectful, please report it.)

 
12/29/2018 2:51:56 AMEddie Bole

Thanks everyone for their feedback. There was another submission that finds the solution for 100 lockers by clicking a button (by modding), but I wanted the user to interactively go through the process of finding the answer. I originally made it with a list view and some other code, but I then decided to simplify the program to the very basics (I wanted user interaction without being too complicated). The reset button is supposed to open all the lockers, so that the user can start again, if they had made a mistake. Rde McListBox.ctl is included in the zip file. I had run the program on WinXp and Win7, but I am not sure if there are any problems on other operating systems.
(If this comment was disrespectful, please report it.)

 
12/29/2018 2:06:10 PMPaul Bahlawan

It starts with all closed, then Reset opens all. I found it confusing. Also that mclist acts wierd when using the scroll bar (doesn't show item 1) but it's ok with arrow keys.
(If this comment was disrespectful, please report it.)

 
12/31/2018 2:06:05 AMEddie Bole

Yes, I thought that if someone made a mistake and had to restart then I would save them the effort of clicking every single locker door the next time they started level one. The mclist I think has been subclassed and has problems with updating correctly. I really like this control, but it looks like it has update issues. Hmm, frustrated.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.