Smart Mobile Studio
  • News
  • Forums
  • Download
  • Store
  • Showcases
    • Featured demos
    • The Smart Contest 2013, Round 1 – Graphics
  • Documentation
    • Get the book
    • System requirements
    • Prerequisites
    • Getting started
      • Introduction
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • Themes and styles
    • Project types
      • Visual project
      • Game project
      • Console project
    • Layout manager
    • Networking
      • TW3HttpRequest
      • TW3JSONP
      • Loading files
  • About

Gematria, playing with numbers

Posted on 07.02.2012 by Jon Lennart Posted in Developers log
The platonic world view

The platonic world view

Ever seen those extremely annoying banner-ads that proclaim that you name has a magical meaning? Ever wonder how they manage to extract values from something as simple as a name? Well if you promise not to make another banner then i’ll share the secret (he said with a scary voice).

Ye old gematria

This is an old routine for calculating those sublime and mystical numbers of ancient lore. It was converted from ordinary Delphi without much problems. It only needed a minor adjustment on the array constants to work. This shows just how easy it can be to port over ordinary object pascal from other systems and get them running on your website or mobile device.

Note: In the charset constant below I have used ordinary, modern Latin characters. This will of-course go terribly wrong if you attempt to decode ancient Greek or Hebrew. You will need to manually replace the modern characters with the unicode versions of the old alphabets (this code out-dates unicode and widechar).

Enjoy the mystery 🙂

[sourcecode language=”delphi”]
type
TJLGematria = (gmCommon,gmHebrew,gmBeatus,gmSepSephos);

const
JL_GEMATRIA_HEBREW: Array [0..25] of Integer =
([0,2,100,4,0,80,3,5,10,10,20,30,40,50,0,
80,100,200,300,9,6,6,6,60,10,7]);

const
JL_GEMATRIA_COMMON: Array [0..25] of Integer =
([1,2,700,4,5,500,3,8,10,10,20,30,40,50,
70,80,600,100,200,300,400,6,800,60,10,7]);

const
JL_GEMATRIA_BEATUS: Array [0..25] of Integer =
([1,2,90,4,5,6,7,8,10,10,20,30,40,50,70,
80,100,200,300,400,6,6,6,60,10,7]);

const
JL_GEMATRIA_SEPSEPHOS: Array [0..25] of Integer =
([1,2,3,4,5,6,7,8,10,100,10,20,30,40,50,
3,70,80,200,300,400,6,80,60,10,800]);

Function JL_CharToGematria(Value:String;
Const Codex:TJLGematria):Integer;
const
Charset = ‘abcdefghijklmnopqrstuvwxyz’;
var
FIndex: Integer;
FTemp: String;
Begin
result:=0;
FTemp:=value;
FTemp:=lowercase(FTemp);
FIndex:=pos(FTemp,Charset);
If FIndex>0 then
Begin
dec(FIndex);
Case codex of
gmCommon: inc(result,JL_GEMATRIA_COMMON[FIndex]);
gmHebrew: inc(result,JL_GEMATRIA_HEBREW[FIndex]);
gmBeatus: inc(result,JL_GEMATRIA_BEATUS[FIndex]);
gmSepSephos: inc(result,JL_GEMATRIA_SEPSEPHOS[FIndex]);
end;
end;
end;

Function JL_StrToGematria(Value:String;
Const Codex:TJLGematria):Integer;
var
x: Integer;
Begin
result:=0;
value:=lowercase(trim(value));
If length(value)>0 then
for x:=1 to length(value) do
inc(result,JL_CharToGematria(Value[x],Codex));
end;
[/sourcecode]

« The final battle begins, persians on the run
Smart device orientation »

Pages

  • About
  • Feature Matrix
  • Forums
  • News
  • Release History
  • Download
  • Showcases
    • The Smart Contest 2013, Round 1 – Graphics
  • Store
  • Documentation
    • Creating your own controls
    • Debugging, exceptions and error handling
    • Differences between Delphi and Smart
    • Get the book
    • Getting started
      • Introduction
      • Local storage, session storage and global storage
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • pmSmart Box Model
      • Themes and styles
    • Layout manager
    • Networking
      • Loading files
      • TW3HttpRequest
      • TW3JSONP
    • Prerequisites
    • Real data, talking to sqLite
    • System requirements
    • Project types
      • Visual project
      • Game project
      • Console project

Archives

  • December 2019
  • December 2018
  • November 2018
  • July 2018
  • June 2018
  • February 2018
  • September 2017
  • April 2017
  • November 2016
  • October 2016
  • September 2016
  • April 2016
  • March 2016
  • January 2016
  • October 2015
  • September 2015
  • July 2015
  • April 2015
  • January 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • September 2011

Categories

  • Announcements (25)
  • Developers log (119)
  • Documentation (26)
  • News (104)
  • News and articles (16)

WordPress

  • Register
  • Log in
  • WordPress

Subscribe

  • Entries (RSS)
  • Comments (RSS)
© Optimale Systemer AS