MatanH
06-13-2011, 08:36 AM
here is my cheating device :D
global roll_colorGuesser
try (destroyDialog roll_colorGuesser) catch ()
rollout roll_colorGuesser "I know what color is it"
(
-- Local Variable Declerations
------------------------------------------
local w = 70
local h = 30
local dnc = dotnetclass "System.Drawing.Color"
local colors = #(
#AliceBlue,
#AntiqueWhite,
#Aqua,
#Aquamarine,
#Azure,
#Beige,
#Bisque,
#Black,
#BlanchedAlmond,
#Blue,
#BlueViolet,
#Brown,
#BurlyWood,
#CadetBlue,
#Chartreuse,
#Chocolate,
#Coral,
#CornflowerBlue,
#Cornsilk,
#Crimson,
#Cyan,
#DarkBlue,
#DarkCyan,
#DarkGoldenrod,
#DarkGray,
#DarkGreen,
#DarkKhaki,
#DarkMagenta,
#DarkOliveGreen,
#DarkOrange,
#DarkOrchid,
#DarkRed,
#DarkSalmon,
#DarkSeaGreen,
#DarkSlateBlue,
#DarkSlateGray,
#DarkTurquoise,
#DarkViolet,
#DeepPink,
#DeepSkyBlue,
#DimGray,
#DodgerBlue,
#Firebrick,
#FloralWhite,
#ForestGreen,
#Fuchsia,
#Gainsboro,
#GhostWhite,
#Gold,
#Goldenrod,
#Gray,
#Green,
#GreenYellow,
#Honeydew,
#HotPink,
#IndianRed,
#Indigo,
#Ivory,
#Khaki,
#Lavender,
#LavenderBlush,
#LawnGreen,
#LemonChiffon,
#LightBlue,
#LightCoral,
#LightCyan,
#LightGoldenrodYellow,
#LightGray,
#LightGreen,
#LightPink,
#LightSalmon,
#LightSeaGreen,
#LightSkyBlue,
#LightSlateGray,
#LightSteelBlue,
#LightYellow,
#Lime,
#LimeGreen,
#Linen,
#Magenta,
#Maroon,
#MediumAquamarine,
#MediumBlue,
#MediumOrchid,
#MediumPurple,
#MediumSeaGreen,
#MediumSlateBlue,
#MediumSpringGreen,
#MediumTurquoise,
#MediumVioletRed,
#MidnightBlue,
#MintCream,
#MistyRose,
#Moccasin,
#NavajoWhite,
#Navy,
#OldLace,
#Olive,
#OliveDrab,
#Orange,
#OrangeRed,
#Orchid,
#PaleGoldenrod,
#PaleGreen,
#PaleTurquoise,
#PaleVioletRed,
#PapayaWhip,
#PeachPuff,
#Peru,
#Pink,
#Plum,
#PowderBlue,
#Purple,
#Red,
#RosyBrown,
#RoyalBlue,
#SaddleBrown,
#Salmon,
#SandyBrown,
#SeaGreen,
#SeaShell,
#Sienna,
#Silver,
#SkyBlue,
#SlateBlue,
#SlateGray,
#Snow,
#SpringGreen,
#SteelBlue,
#Tan,
#Teal,
#Thistle,
#Tomato,
#Transparent,
#Turquoise,
#Violet,
#Wheat,
#White,
#WhiteSmoke,
#Yellow,
#YellowGreen
)
-- User Interface
------------------------------------------
edittext etxColor ""
listBox lbxColors ""
bitmap bmpColor "" width:w height:h visible:false
-- Functions
------------------------------------------
fn getColors txt =
(
if txt.count > 0 then
for c in colors where matchPattern (toLower (c as string)) pattern:((toLower txt) + "*") collect c as string
else
#()
)
fn updateColor =
(
if lbxColors.selection > 0 then (
local c = dnc.FromName lbxColors.selected
bmpColor.bitmap = bitmap w h color:(color c.r c.g c.b)
bmpColor.visible = true
) else
bmpColor.visible = false
)
fn checkColor txt =
(
lbxColors.items = getColors txt
if lbxColors.items.count > 0 and lbxColors.selection == 0 then
lbxColors.selection = 1
updateColor()
)
fn openDialog =
(
createDialog roll_colorGuesser width:200
)
fn init =
(
setFocus etxColor
)
fn done =
(
gc light:true
)
-- Event Handlers
------------------------------------------
on etxColor changed arg do checkColor arg
on lbxColors selected arg do updateColor()
on roll_colorGuesser open do init()
on roll_colorGuesser close do done()
) -- end of rollout
roll_colorGuesser.openDialog()
this is a scripting challenge after all so lets see if someone can come up with a better way to cheat! (and not just print screen and edit in ps)
Papigiulio
06-13-2011, 08:43 AM
Dont need photoshop to cheat, the game is reconfigured randomly, can be he clicked new game until it got 16 correct at once. :) And even then, very lucky heh
MatanH
06-13-2011, 08:48 AM
Dont need photoshop to cheat, the game is reconfigured randomly, can be he clicked new game until it got 16 correct at once. :) And even then, very lucky heh
If I'm not mistaking the odds would be 1 : 2004189184
for that and in that case the time should be 00:00:00.. Denis, you should have used a random picker that gives 0 matches in initial state ;)
I did not cheat in photoshop. What would that prove, that I have the PS skills of a 9 year old?
Here is my cheating device. It's much shorter, and has less to do with the actual subject matter and more of punishing Denis for polluting the global scope. :)
(
for i = 1 to 16 do ns[i].text = ccc[i]
local iData = dotNetObject "DataObject" ccc[1]
local ddEffectsMove = (dotNetClass "DragDropEffects").move
local eventArgs = dotNetObject "DragEventArgs" iData 0 0 0 ddEffectsMove ddEffectsMove
onDragDrop ns[1] eventArgs
)
MatanH
06-13-2011, 09:01 AM
I did not cheat in photoshop. What would that prove, that I have the PS skills of a 9 year old?
Here is my cheating device. It's much shorter, and has less to do with the actual subject matter and more of punishing Denis for polluting the global scope. :)
(
for i = 1 to 16 do ns[i].text = ccc[i]
local iData = dotNetObject "DataObject" ccc[1]
local ddEffectsMove = (dotNetClass "DragDropEffects").move
local eventArgs = dotNetObject "DragEventArgs" iData 0 0 0 ddEffectsMove ddEffectsMove
onDragDrop ns[1] eventArgs
)
Very nice!
If I'm not mistaking the odds would be 1 : 2004189184
How is this calculated? I thought it's supposed to be !16 = 20,922,789,888,000 ?
If it is not clear how I found Denis's variable names, this is how:
(
currentVars = globalVars.gather()
fileIn "C:\\what_color.mse"
denisVars = for v in (globalVars.gather()) where findItem currentVars v == 0 collect v
)
MatanH
06-13-2011, 09:08 AM
How is this calculated? I thought it's supposed to be !16 = 20,922,789,888,00 ?
Right it is 16! (20,922,789,888,000)
At first I quickly calculated it using mxs with integers but I guess it was to big for an int, walframe alpha confirms your number :shrug:
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.