Jump to content
Wanted

Today's Coding Exercise 1/1/2014

Recommended Posts

Write a script that finds the top 10 words for this magnet toy

 

https://github.com/OSI1/OfficialSCARInclude/blob/master/Divi/TFunctions/String.scar

https://github.com/OSI1/OfficialSCARInclude/blob/master/Divi/TFunctions/TSA.scar

 

jw2v.jpg

qeoa.jpg

 

http://img844.imageshack.us/img844/2156/rbe8.jpg

http://img202.imageshack.us/img202/9841/qeoa.jpg

 

To save you the annoyance of entering the letters into a script:

 

{

http://forums.scar-divi.com/other-scripts/2613-todays-coding-exercise-1-1-2014-a.html

                                     By Want3d
}

program WordPuzzleSolver;

const
 DictionaryPath = 'C:\Users\James\Documents\SCAR Divi\English\wordsEn.txt';

type
 TDecagonLetterWheel = record
   Letters: TStringArray;
   Points: TIntegerArray;
 end;

var
 Wheels: array[0..7] of TDecagonLetterWheel;  
 Dictionary: string;   

// I thought about putting the points in a seperate array, but then I figured
// it would probably be faster to do direct memory reference  

procedure DeclareWheels; // Define Wheels with letters and points
begin
 Wheels[0].Letters := ['O', 'Y', 'W', 'I', 'E', 'N', 'A', 'S', 'U', 'X']; 
 Wheels[0].Points :=  [ 0,   4,   6,   0,   0,   2,   0,   2,   0,   6];        
 Wheels[1].Letters := ['I', 'B', 'E', 'H', 'O', 'C', 'A', 'T', 'U', 'D']; 
 Wheels[1].Points :=  [ 0,   2,   0,   4,   0,   2,   0,   2,   0,   4];    
 Wheels[2].Letters := ['I', 'L', 'E', 'M', 'O', 'F', 'U', 'Z', 'A', 'N']; 
 Wheels[2].Points :=  [ 0,   2,   0,   4,   0,   2,   0,   8,   0,   2];   
 Wheels[3].Letters := ['E', 'D', 'O', 'H', 'U', 'S', 'I', 'R', 'A', 'P']; 
 Wheels[3].Points :=  [ 0,   4,   0,   4,   0,   2,   0,   2,   0,   4];    
 Wheels[4].Letters := ['E', 'N', 'K', 'A', 'F', 'B', 'O', 'L', 'I', 'R'];   
 Wheels[4].Points :=  [ 0,   2,   8,   0,   2,   2,   0,   2,   0,   2];  
 Wheels[5].Letters := ['T', 'Q', 'I', 'D', 'W', 'A', 'V', 'J', 'E', 'R']; 
 Wheels[5].Points :=  [ 2,   8,   0,   4,   6,   0,   6,   6,   0,   2];    
 Wheels[6].Letters := ['E', 'P', 'G', 'S', 'L', 'A', 'V', 'N', 'T', 'W']; 
 Wheels[6].Points :=  [ 0,   4,   2,   2,   2,   0,   6,   2,   2,   6];   
 Wheels[7].Letters := ['E', 'N', 'T', 'M', 'G', 'U', 'C', 'R', 'O', 'Y']; 
 Wheels[7].Points :=  [ 0,   2,   2,   4,   2,   0,   2,   2,   0,   4]; 
end; 

procedure LoadDictionary;
var
 DictionaryFile: LongInt;
 FailedLoad: Boolean;
begin
 DictionaryFile := OpenFile(DictionaryPath, False);  
 FailedLoad := False;  
 if (not (ReadFileString(DictionaryFile, Dictionary, 1250000))) then
 begin
   WriteLn('Failed To Load Dictionary');
   FailedLoad := True;
 end;    
 CloseFile(DictionaryFile);
 if (FailedLoad) then
   TerminateScript;
end;

function CheckWordOnToy(Word: string): Integer; // See if that word is possible to fit on toy and how many points its worth
var
 StartingWheel: Integer;
begin
 for StartingWheel := 0 to 7 do
 begin

 end;  
 Result := 0;
end;

procedure MainLoop; // To avoid extra global variables
var
 T: LongInt;
begin
 T := GetSystemTime; 
 LoadDictionary;
 WriteLn('Dictionary loaded (' + IntToStr(GetSystemTime - T) + ' ms)');   
 T := GetSystemTime; 
 DeclareWheels;
 WriteLn('Wheels declared (' + IntToStr(GetSystemTime - T) + ' ms)');  
 WriteLn(Dictionary);  
end;

begin
 MainLoop;
end.

 

Basis:

Use 1 - 8 wheels in order to achieve the highest point word.

 

Rules:

1. You are allowed to rearrange the order of the wheels.

2. You must use an English dictionary and link to your source and pastebin/link to your dictionary.

 

http://www-01.sil.org/linguistics/wordlists/english/wordlist/wordsEn.txt

 

3. You are not allowed to use names (Thomas etc.)

4.You must use single words.

5. You are allowed to use plural.

6. You must not use hyphenated or multiple words.

7. You must use SCAR only. No plugins etc.

8. You must post your code and top 10 words and their scores.

9. You don't have to use all the wheels.

 

Beware your standards, consistency, efficiency, and coding lines usage.

 

Good luck everyone. This should be a good learning experience

 

Cheers

 

-Wanted

 

[11:03:45 AM] Ian - BMWxi: Is the highest point word the longest one?

[11:04:21 AM] James Bolduc: it can be any number of letters.. what's important is the sum of the points

[11:04:46 AM] Ian - BMWxi: What determines the points?

[11:04:55 AM] James Bolduc: the numbers by the letters

[11:05:32 AM] Ian - BMWxi: So like scrabble?

[11:05:36 AM] James Bolduc: Exactly

Edited by Wanted
Link to comment
Share on other sites

オンライン カジノは、プレイヤーが自宅にいながらにしてポーカー、ルーレット、ブラックジャック、スロットなどのギャンブル ゲームを楽しむ機会を提供する仮想プラットフォームです。 オンラインカジノは、アクセスのしやすさ、ゲームの種類の多さ、そして大金を獲得する機会があるため、年々人気が高まっています。

オンラインカジノの主な利点は、利便性とアクセスしやすさです。 プレイヤーは、通常のカジノの営業時間に制限されず、いつでもゲームを楽しむことができます。 必要なのは、インターネットにアクセスできるデバイスと、カジノのウェブサイトにアクセスできることだけです。 これにより、プレイヤーは従来のカジノによくありがちなストレスや緊張を感じることなく、快適な環境でプレイすることができます。

オンラインカジノのもう1つの利点は、ゲームの選択肢が豊富なことです。 ユーザーは、それぞれ独自のルールと勝利の機会を提供する何百もの異なるゲームから選択できます。 技術革新のおかげで、オンライン ゲームのグラフィックとサウンドは高品質になり、プレイヤーは興奮と情熱の雰囲気に浸ることができます。

さまざまなゲームに加えて、オンライン カジノはプレーヤーにさまざまなボーナスやプロモーションも提供します。 これらは、スロットのフリースピン、プレイのための追加のお金、または貴重な賞品が得られる特別なトーナメントなどです。 このようなボーナスにより、勝利の可能性が高まり、ゲームがさらに楽しくなります。

もちろん、オンラインカジノでのプレイにはリスクがあります。 ギャンブルには依存性がある可能性があるため、自分の感情を監視し、支出をコントロールすることが重要であることを覚えておくことが重要です。 カジノはまた、責任あるゲーミングをサポートし、自己排除や賭け金制限の機会を提供します オンラインカジノ

全体として、オンライン カジノはギャンブル愛好家にとって便利でエキサイティングなエンターテイメントを提供します。 幅広いゲーム、ボーナスの選択肢があり、いつでもプレイできるため、世界中のプレイヤーの間で人気が高まっています。 ただし、責任あるゲームと、ゲームが単なる楽しみと娯楽の源であるように自分の行動を制御する能力について覚えておくことが重要です。
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...