Wordle comparison: Difference between revisions

(Correcting syntax error.)
imported>Fth
Line 359:
</pre>
 
=={{header|Forth}}==
<syntaxhighlight lang="forth">
: color! ( c i -- ) tuck pad + c! here + 0 swap c! ;
 
: wordle ( a1 u1 a2 u2 -- a3 u3 )
2swap here swap move pad over erase dup 0 do
over i + c@ here i + c@ = if 2 i color! then
loop dup 0 do
2dup here swap rot i + 1 search nip nip if 1 i color! then
loop nip pad swap ;
 
:noname
create s" grey" , , s" yellow" , , s" green" , ,
does> swap 2* cells + 2@ type ; execute color.
 
: .wordle ( a1 u1 a2 u2 -- )
2over type ." v " 2dup type ." => " wordle
over + swap do i c@ color. space loop cr ;
 
:noname
0 s" ROBIN" 2dup 2dup s" SONIC" 2over s" ALERT"
s" BULLY" s" LOLLY" s" ALLOW" 2over
begin ?dup while .wordle repeat ; execute
</syntaxhighlight>
{{out}}
<pre>
ALLOW v LOLLY => yellow yellow green grey grey
BULLY v LOLLY => grey grey green green green
ROBIN v ALERT => grey grey grey yellow grey
ROBIN v SONIC => grey green yellow green grey
ROBIN v ROBIN => green green green green green
</pre>
=={{header|FreeBASIC}}==
<syntaxhighlight lang="freebasic">Function wordle(Byval respuesta As String, Byval supuesto As String) As String
Line 428 ⟶ 460:
BBBBBAA: Expected 5 character guess.
BBAABBB: Expected 5 character target.</pre>
 
 
=={{header|FutureBasic}}==
Anonymous user