Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-06-2012, 08:01 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
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.

Last edited by Mark Sir Link; 04-06-2012 at 08:46 AM..
Reply With Quote
  #2  
Old 04-06-2012, 09:59 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Are we to complete this task in GS2?
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #3  
Old 04-06-2012, 10:06 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
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)

Last edited by Mark Sir Link; 04-06-2012 at 11:16 AM.. Reason: yep
Reply With Quote
  #4  
Old 04-06-2012, 10:07 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Gunderak View Post
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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:06 PM.


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