Wordle comparison: Difference between revisions
→{{header|FutureBasic}}: Replaced with more compact revised code
(→{{header|FutureBasic}}: Replaced with more compact revised code) |
|||
Line 357:
=={{header|FutureBasic}}==
This compact
<syntaxhighlight lang="futurebasic">
clear local fn
▲short x, y = -29
str255 n : str15 c : c[0] = w2[0] : short r
▲clear local fn wordleCompare( wordle as str15, guess as str15, cArray(15) as colorRef )
if w2[r] = w1[r] then c[r] = 2 else n[w1[r]]++
next
if c[r] == 0 then if n[w2[r]] then n[w2[r]]-- : c[r] = 1
▲ for r = 1 to guess[0]
next
end fn = c▼
</syntaxhighlight>
▲end fn
This function uses the array to display output mimicking the appearance of WORDLE.
<syntaxhighlight lang="futurebasic">
local fn show( wordle as str15, guess as str15 )▼
mda(0) = {fn ColorDarkGray,fn ColorWithRGB(.7,.6,.3,1),fn ColorWithRGB(.3,.6,.3,1)}
color = fn
text @"menlo bold",
print %( 20, y ) wordle : text ,,fn
for r = 1 to guess[0]
rect fill ( x, y
print %( x + 7.5, y + 1 ) chr$( guess[r] ); : x +=
next
x = 80 : y += 28
end fn
window 1, @"FB Wordle Compare
WindowSetBackgroundColor( 1, fn Colorblack )
fn
fn
fn
fn
fn
fn
fn
fn
fn
handleevents
</syntaxhighlight>
{{out}}
[[File:
=={{header|Go}}==
|