IEnumerable <WordList> MakeWordList(int listSize, int wordNumber) { var wordCount = 0; var lists = new List <WordList>(); for (int l = 0; l < listSize; l++) { var words = new List <WordStore>(); for (int w = 0; w < wordNumber; w++) { var word = new WordStore() { WordId = wordCount, DictionaryId = l, Word = $"Word{l - w}" }; words.Add(word); wordCount++; } var list = new WordList() { DictionaryId = l }; list.SetList(words); lists.Add(list); } return(lists); }
public List<GameObject> ParseWordFromRow(List<List<GameObject>> blockWord) { string wordString = ""; List<string> validWords = new List<string>(); Dictionary<string, int> wordScores = new Dictionary<string, int>(); var words = WordStore.GetWords(); foreach (List<GameObject> blockList in blockWord) { wordString = ParseWord(blockList); foreach (string validWord in words) { if (wordString.Contains(validWord)) { validWords.Add(validWord); } } if(validWords != null && validWords.Count > 0) { foreach (var validWord in validWords) { var score = scoreHandler.CalculateScore(validWord); wordScores.Add(validWord, score); } var highestScoringWord = wordScores.OrderByDescending(x => x.Value).First().Key; return FilterBlocks(blockList, highestScoringWord); } //Set the string back to empty if the word was not found. wordString = string.Empty; } return new List<GameObject>(); }
public TestSelectCollectionWindow(WordStore wordStore) { InitializeComponent(); store = wordStore; this.collectionComboBox.SelectedValuePath = "Key"; this.collectionComboBox.DisplayMemberPath = "Key"; this.languageComboBox.SelectedValuePath = "Key"; this.languageComboBox.DisplayMemberPath = "Key"; collectionComboBox.ItemsSource = store.mWordCollections; }
public void PlayGame() { var language = Languages.GetLanguage(); WordStore.GenerateWords(language); int timeLimit = 90; int.TryParse(timeField.text, out timeLimit); PlayerPrefs.SetInt("timelimit", timeLimit); StartCoroutine(LoadLevel("Level")); }
/// <summary> /// Determine the type of each of the source elements and fill the tokens collection /// </summary> /// <param name="elements">Array of split elements</param> void Tokenise(string[] elements) { tokens = new List <Token>(elements.Length); int position = 0; foreach (string el in elements) { // ensure the word is in lower case and has no space string element = el.ToLower().Trim(); if (String.IsNullOrWhiteSpace(element)) { continue; } if (WordStore.IsIgnored(element)) { // token added as an ignored word tokens.Add(new Token(element, TokenType.Ignored, position)); IgnoreCount++; } else { // this is a preposition if (WordStore.IsPreposition(element)) { tokens.Add(new Token(element, TokenType.Preposition, position)); } // this is a direction else if (WordStore.IsDirection(element)) { tokens.Add(new Token(element, TokenType.Direction, position)); } // this is a command, but only accept the first command found else if (CommandManager.IsCommand(element, position) && Command == default(Token)) { Command = new Token(element, TokenType.Command, position); tokens.Add(Command); } else { tokens.Add(new Token(element, TokenType.Unrecognised, position)); } } position++; // TODO: these two vars could be consolidated, but does it look stupid passing WordCount as position? WordCount++; } elements = null; }
protected override Response ProcessInternal(Engine engine, Tokeniser tokens) { var directionWord = tokens.Direction; if (directionWord == null || !WordStore.IsDirection(directionWord)) { return(new Response("Go where?")); } var direction = WordStore.GetDirection(directionWord); var ego = engine.GameState.Ego; var response = new Response(); Room newRoom; if (direction == Direction.Back) { if (ego.PreviousRoom != null) { newRoom = ego.PreviousRoom; } else { return(new Response("You've not been anywhere yet!")); } } else { newRoom = ego.CurrentRoom.GetNextRoom(direction); } if (newRoom == null) { return(new Response("You try to walk " + directionWord + ", but realise how bad a mistake that wasa when you walk straight into a solid wall. Your nose will hurt for days.")); } if (!newRoom.IsAccessible) { response.AddMessage("You try, but find that the door is locked."); } else { ego.MoveTo(newRoom); response.AddMessage(newRoom.Describe()); } response.Merge(engine.RunOccurrences(new GoRoom.Trigger(newRoom))); return(response); }
public void Add() { var data = new WordStore() { WordId = long.MinValue, DictionaryId = 0, Word = "TestData" }; realmer.Add(data); var destination = realmer.SelectAll <WordStore>(); realmer.Close(); Assert.Equal(1, (int)destination.Count()); var selected = destination.First(); Assert.True(comparer.EqualsObject(data, selected)); }
public WordStorageEditWindow(WordStore store) { InitializeComponent(); EditedStore = store; Resources["Collections"] = EditedStore.mWordCollections; }
/// <summary> /// Get the direction string for a Direction /// </summary> /// <param name="d">The direction</param> /// <returns>The direction string</returns> public static string GetExitDirection(this Direction d) { return(WordStore.GetDirectionWord(d)); }