{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-16T00:12:35.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-16T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":53985,"title":"Check whether a Wordle guess is consistent with previous feedback","description":"The game Wordle resembles the classic game Mastermind. Players try to guess a five-letter word, and after each guess they are told whether each letter is not in the word, in the word but not in the guessed position, or in the word and in the guessed position. Cody Problem 53960 asked us to score a letter in a guess: -1 if it is not in the word, 0 if it is but in a different position, and 1 if it is in the correct position. \r\nIn Wordle’s hard mode, the subsequent guesses must be consistent with previous feedback. If the previous guess of ZEROS receives the feedback of [-1 -1 0 1 -1], then FLOOR would be a valid guess because the second O is in the same position as before and the R is in the word but in a different position. MOURN would not be valid because the O is not in the fourth position. CAROM would not be valid because R is in the same (incorrect) position. SPOOR would not be valid because it has an S.\r\nPay special attention to repeated letters. If FLOOR receives the feedback of [-1 -1 0 1 -1], then ONION would be a valid guess, whereas BATON and GOODS would not be valid.\r\nWrite a function that takes the previous guess, the feedback vector, and the current guess and returns true if the current guess is consistent with the feedback and false otherwise.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 300px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 150px; transform-origin: 407px 150px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 33.45px 8px; transform-origin: 33.45px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe game \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.nytimes.com/games/wordle/index.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eWordle\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 90.2417px 8px; transform-origin: 90.2417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e resembles the classic game \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44236\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMastermind\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 190.183px 8px; transform-origin: 190.183px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Players try to guess a five-letter word, and after each guess they are told whether each letter is not in the word, in the word but not in the guessed position, or in the word and in the guessed position. \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/53960\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 53960\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 242.283px 8px; transform-origin: 242.283px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asked us to score a letter in a guess: -1 if it is not in the word, 0 if it is but in a different position, and 1 if it is in the correct position. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 361.475px 8px; transform-origin: 361.475px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn Wordle’s hard mode, the subsequent guesses must be consistent with previous feedback. If the previous guess of ZEROS receives the feedback of [-1 -1 0 1 -1], then FLOOR would be a valid guess because the second O is in the same position as before and the R is in the word but in a different position. MOURN would not be valid because the O is not in the fourth position. CAROM would not be valid because R is in the same (incorrect) position. SPOOR would not be valid because it has an S.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 371.033px 8px; transform-origin: 371.033px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePay special attention to repeated letters. If FLOOR receives the feedback of [-1 -1 0 1 -1], then ONION would be a valid guess, whereas BATON and GOODS would not be valid.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 371.692px 8px; transform-origin: 371.692px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes the previous guess, the feedback vector, and the current guess and returns true if the current guess is consistent with the feedback and false otherwise.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isWordleGuessValid(w1,w2,f)\r\n   tf = strcmp(w1,w2);","test_suite":"%%\r\nw1 = 'ZEROS';\r\nw2 = 'FLOOR';\r\nf  = [-1 -1 0 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'ZEROS';\r\nw2 = 'MOURN';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'ZEROS';\r\nw2 = 'CAROM';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'ZEROS';\r\nw2 = 'SPOOR';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%% \r\nw1 = 'FLOOR';\r\nw2 = 'ONION';\r\nf  = [-1 -1 0 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%% \r\nw1 = 'FLOOR';\r\nw2 = 'BATON';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%% \r\nw1 = 'FLOOR';\r\nw2 = 'GOODS';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'WHILE';\r\nw2 = 'KNOLL';\r\nf  = [-1 -1 -1 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'WHILE';\r\nw2 = 'COULD';\r\nf  = [-1 -1 -1 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'WHILE';\r\nw2 = 'WHALE';\r\nf  = [-1 -1 -1 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'CHAIN';\r\nw2 = 'CHIDE';\r\nf  = [1 1 -1 0 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'CHAIN';\r\nw2 = 'CHINS';\r\nf  = [1 1 -1 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'CHAIN';\r\nw2 = 'WITCH';\r\nf  = [1 1 -1 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'VALID';\r\nw2 = 'VIALS';\r\nf  = [1 0 0 0 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'VALID';\r\nw2 = 'SALVE';\r\nf  = [1 0 0 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'VALID';\r\nw2 = 'VAILS';\r\nf  = [1 0 0 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'EERIE';\r\nw2 = 'EAGLE';\r\nf  = [0 1 -1 -1 1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'EERIE';\r\nw2 = 'PEEVE';\r\nf  = [0 1 -1 -1 1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'EERIE';\r\nw2 = 'REEVE';\r\nf  = [0 1 -1 -1 1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nfiletext = fileread('isWordleGuessValid.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'system'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2022-10-02T00:32:19.000Z","deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-01-30T17:53:15.000Z","updated_at":"2022-10-02T00:32:19.000Z","published_at":"2022-01-30T17:54:21.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe game \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.nytimes.com/games/wordle/index.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWordle\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e resembles the classic game \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44236\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMastermind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Players try to guess a five-letter word, and after each guess they are told whether each letter is not in the word, in the word but not in the guessed position, or in the word and in the guessed position. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/53960\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 53960\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e asked us to score a letter in a guess: -1 if it is not in the word, 0 if it is but in a different position, and 1 if it is in the correct position. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn Wordle’s hard mode, the subsequent guesses must be consistent with previous feedback. If the previous guess of ZEROS receives the feedback of [-1 -1 0 1 -1], then FLOOR would be a valid guess because the second O is in the same position as before and the R is in the word but in a different position. MOURN would not be valid because the O is not in the fourth position. CAROM would not be valid because R is in the same (incorrect) position. SPOOR would not be valid because it has an S.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePay special attention to repeated letters. If FLOOR receives the feedback of [-1 -1 0 1 -1], then ONION would be a valid guess, whereas BATON and GOODS would not be valid.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes the previous guess, the feedback vector, and the current guess and returns true if the current guess is consistent with the feedback and false otherwise.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":53985,"title":"Check whether a Wordle guess is consistent with previous feedback","description":"The game Wordle resembles the classic game Mastermind. Players try to guess a five-letter word, and after each guess they are told whether each letter is not in the word, in the word but not in the guessed position, or in the word and in the guessed position. Cody Problem 53960 asked us to score a letter in a guess: -1 if it is not in the word, 0 if it is but in a different position, and 1 if it is in the correct position. \r\nIn Wordle’s hard mode, the subsequent guesses must be consistent with previous feedback. If the previous guess of ZEROS receives the feedback of [-1 -1 0 1 -1], then FLOOR would be a valid guess because the second O is in the same position as before and the R is in the word but in a different position. MOURN would not be valid because the O is not in the fourth position. CAROM would not be valid because R is in the same (incorrect) position. SPOOR would not be valid because it has an S.\r\nPay special attention to repeated letters. If FLOOR receives the feedback of [-1 -1 0 1 -1], then ONION would be a valid guess, whereas BATON and GOODS would not be valid.\r\nWrite a function that takes the previous guess, the feedback vector, and the current guess and returns true if the current guess is consistent with the feedback and false otherwise.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 300px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 150px; transform-origin: 407px 150px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 42px; text-align: left; transform-origin: 384px 42px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 33.45px 8px; transform-origin: 33.45px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe game \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.nytimes.com/games/wordle/index.html\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eWordle\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 90.2417px 8px; transform-origin: 90.2417px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e resembles the classic game \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44236\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eMastermind\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 190.183px 8px; transform-origin: 190.183px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e. Players try to guess a five-letter word, and after each guess they are told whether each letter is not in the word, in the word but not in the guessed position, or in the word and in the guessed position. \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/53960\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eCody Problem 53960\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 242.283px 8px; transform-origin: 242.283px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e asked us to score a letter in a guess: -1 if it is not in the word, 0 if it is but in a different position, and 1 if it is in the correct position. \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 105px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 52.5px; text-align: left; transform-origin: 384px 52.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 361.475px 8px; transform-origin: 361.475px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eIn Wordle’s hard mode, the subsequent guesses must be consistent with previous feedback. If the previous guess of ZEROS receives the feedback of [-1 -1 0 1 -1], then FLOOR would be a valid guess because the second O is in the same position as before and the R is in the word but in a different position. MOURN would not be valid because the O is not in the fourth position. CAROM would not be valid because R is in the same (incorrect) position. SPOOR would not be valid because it has an S.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 371.033px 8px; transform-origin: 371.033px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ePay special attention to repeated letters. If FLOOR receives the feedback of [-1 -1 0 1 -1], then ONION would be a valid guess, whereas BATON and GOODS would not be valid.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 371.692px 8px; transform-origin: 371.692px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function that takes the previous guess, the feedback vector, and the current guess and returns true if the current guess is consistent with the feedback and false otherwise.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function tf = isWordleGuessValid(w1,w2,f)\r\n   tf = strcmp(w1,w2);","test_suite":"%%\r\nw1 = 'ZEROS';\r\nw2 = 'FLOOR';\r\nf  = [-1 -1 0 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'ZEROS';\r\nw2 = 'MOURN';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'ZEROS';\r\nw2 = 'CAROM';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'ZEROS';\r\nw2 = 'SPOOR';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%% \r\nw1 = 'FLOOR';\r\nw2 = 'ONION';\r\nf  = [-1 -1 0 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%% \r\nw1 = 'FLOOR';\r\nw2 = 'BATON';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%% \r\nw1 = 'FLOOR';\r\nw2 = 'GOODS';\r\nf  = [-1 -1 0 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'WHILE';\r\nw2 = 'KNOLL';\r\nf  = [-1 -1 -1 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'WHILE';\r\nw2 = 'COULD';\r\nf  = [-1 -1 -1 1 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'WHILE';\r\nw2 = 'WHALE';\r\nf  = [-1 -1 -1 1 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'CHAIN';\r\nw2 = 'CHIDE';\r\nf  = [1 1 -1 0 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'CHAIN';\r\nw2 = 'CHINS';\r\nf  = [1 1 -1 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'CHAIN';\r\nw2 = 'WITCH';\r\nf  = [1 1 -1 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'VALID';\r\nw2 = 'VIALS';\r\nf  = [1 0 0 0 -1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'VALID';\r\nw2 = 'SALVE';\r\nf  = [1 0 0 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'VALID';\r\nw2 = 'VAILS';\r\nf  = [1 0 0 0 -1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'EERIE';\r\nw2 = 'EAGLE';\r\nf  = [0 1 -1 -1 1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'EERIE';\r\nw2 = 'PEEVE';\r\nf  = [0 1 -1 -1 1];\r\nassert(isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nw1 = 'EERIE';\r\nw2 = 'REEVE';\r\nf  = [0 1 -1 -1 1];\r\nassert(~isWordleGuessValid(w1,w2,f))\r\n\r\n%%\r\nfiletext = fileread('isWordleGuessValid.m');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'system'); \r\nassert(~illegal)","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":46909,"edited_by":46909,"edited_at":"2022-10-02T00:32:19.000Z","deleted_by":null,"deleted_at":null,"solvers_count":8,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2022-01-30T17:53:15.000Z","updated_at":"2022-10-02T00:32:19.000Z","published_at":"2022-01-30T17:54:21.000Z","restored_at":null,"restored_by":null,"spam":null,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe game \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.nytimes.com/games/wordle/index.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWordle\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e resembles the classic game \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44236\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMastermind\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Players try to guess a five-letter word, and after each guess they are told whether each letter is not in the word, in the word but not in the guessed position, or in the word and in the guessed position. \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/53960\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eCody Problem 53960\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e asked us to score a letter in a guess: -1 if it is not in the word, 0 if it is but in a different position, and 1 if it is in the correct position. \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn Wordle’s hard mode, the subsequent guesses must be consistent with previous feedback. If the previous guess of ZEROS receives the feedback of [-1 -1 0 1 -1], then FLOOR would be a valid guess because the second O is in the same position as before and the R is in the word but in a different position. MOURN would not be valid because the O is not in the fourth position. CAROM would not be valid because R is in the same (incorrect) position. SPOOR would not be valid because it has an S.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePay special attention to repeated letters. If FLOOR receives the feedback of [-1 -1 0 1 -1], then ONION would be a valid guess, whereas BATON and GOODS would not be valid.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function that takes the previous guess, the feedback vector, and the current guess and returns true if the current guess is consistent with the feedback and false otherwise.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"}],"term":"tag:\"word games\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"word games\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"word games\"","","\"","word games","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1cda8\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fbf30a1cd08\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1c268\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1d348\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fbf30a1d208\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fbf30a1cee8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fbf30a1ce48\u003e":"tag:\"word games\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1ce48\u003e":"tag:\"word games\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"word games\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"word games\"","","\"","word games","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1cda8\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fbf30a1cd08\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1c268\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1d348\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fbf30a1d208\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fbf30a1cee8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fbf30a1ce48\u003e":"tag:\"word games\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fbf30a1ce48\u003e":"tag:\"word games\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":53985,"difficulty_rating":"medium"}]}}