Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Programming Exercise: License Plate Company (https://forums.graalonline.com/forums/showthread.php?t=134266182)

Mark Sir Link 04-06-2012 08:01 AM

Programming Exercise: License Plate Company
 
taken from http://code.ign.com/foo

Quote:

You own a license plate manufacturing company. Write a program that takes a population and determines the simplest pattern that will produce enough unique plates. Since all the plates that match the pattern will be generated, find the pattern that produces the least excess plates. Use a combination of letters (A-Z) and numbers (0-9).
Simplest pattern seems open to interpretation, meaning that a mixture of numbers and letters is probably acceptable, IE, A03B21C, but then all plates must follow that same ordering of letters and numbers

EDIT: AAA-### should yield the same maximum combination of plates as mixing them together. I apologize.

Gunderak 04-06-2012 09:59 AM

Are we to complete this task in GS2?

Mark Sir Link 04-06-2012 10:06 AM

assuming you convert the population to base 26, you have the worst case number of license plates, 26^number of digits of population in base 26

you ought to be able to work linearly backward from that point to determine the best combination of numbers and letters, knowing that 26^digit places * 10^digit places will yield the total combinations for either.

Clearly the digit places of either of those should never exceed or equal the digits of the worst case scenario, since from the beginning you know the worst case would be 26^digit places of population in base 26, and can only improve from there, (IE start at places - 1 going backwards for letters, and 1 moving upwards for numbers)

Mark Sir Link 04-06-2012 10:07 AM

Quote:

Originally Posted by Gunderak (Post 1691227)
Are we to complete this task in GS2?

It's not necessary, and if you can explain what a function would output in GS2 you don't have to necessarily write it, granted you explain what the expected input is and what the output would be.


All times are GMT +2. The time now is 08:47 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.