czardas

Roman (Again)

8 posts in this topic




#2 ·  Posted (edited)

I was always too lazy to write this conversion. Thanks for sharing.

:thumbsup:

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

nice one

Share this post


Link to post
Share on other sites
6 hours ago, UEZ said:

I was always too lazy to write this conversion.

I know the feeling. I'm waiting for someone to come up with a Natural Roman Sort algorithm (King Henry I, II, III, IV etc...). :D

1 person likes this

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks for sharing.

I well remember adding a Roman Numeral element to my old Titlecase Function ... was it turned (or a variation of) into a UDF ... not sure? There is a couple of discussions about the place somewhere ... involving @guinness, @tcurran, you and others ... if I remember rightly.

If and when I ever get around to updating that function, then hopefully I will remember to incorporate your excellent UDF.

Edited by TheSaint
1 person likes this

TheSaints' Robust Chat

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox

userbar.png

Share this post


Link to post
Share on other sites

If someone has some time for a roman challenge, here's one:

A new hotel in Vegas has 2016 rooms and the tenant wants to number every room in roman numerals (in natural sequence).

How many letters of each in ( I V X L ...) will that need? Algorithmic answer only, please.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
3 hours ago, jchd said:

If someone has some time for a roman challenge....

a first attempt:

#include <Array.au3>
#include 'Roman.au3'

Local $aRomanDigit = [['I', 0],['V', 0],['X', 0],['L', 0],['C', 0],['D', 0],['M', 0]]

For $iRoom = 1 To 2016
    _SumRomanDigit($iRoom, $aRomanDigit)
Next

_ArrayDisplay($aRomanDigit, 'Roman digits to buy')

Func _SumRomanDigit($iNum, ByRef $aStack)
    Local $sRoman = _Roman($iNum)
    For $i = 0 To 6 ; check all possible roman digit IVXLCDM
        StringReplace($sRoman, $aStack[$i][0], '') ; count digit
        $aStack[$i][1] += @extended ; sum digit
        If $sRoman = "" Then ExitLoop ; speedup a bit
    Next
EndFunc   ;==>_SumRomanDigi

 


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I'm surprised at the level of interest shown here. Roman numerals are still a popular alternative numbering system though. There are a few other threads about this subject around here somewhere. I'm happy if someone finds it useful. :)

Edited by czardas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now