PDA

View Full Version : warm-up before challenge #5


denisT
06-11-2011, 09:09 PM
this is not a tool... technically the code is idle (there is no using for a practical purpose). so i've decided to encrypt it. ;)

try to find right colors by drag-n-dropping their labels:

denisT
06-12-2011, 02:51 AM
hey, people! this is not a free food. give me at least your score... i might be dumb but it takes ~2min for me to Riddle the riddle...

Gravey
06-12-2011, 06:18 AM
first loading the script it took me at least 20 seconds to work out what to do... so i restarted and got 1 min 54. process of elimination and then some guessing came into it

EDIT: second attempt 5.01 ... I think i got lucky with some of the names last time...

denisT
06-12-2011, 06:26 AM
first loading the script it took me at least 20 seconds to work out what to do...

i call it intuitive interface... :)

denisT
06-12-2011, 06:32 AM
EDIT: second attempt 5.01 ... I think i got lucky with some of the names last time...
... and English is your native language...
Gainsboro... heh...

lo
06-12-2011, 06:59 AM
At 4 AM: 5:00
At 10 AM: 1:28

denisT
06-12-2011, 07:08 AM
At 4 AM: 5:00
At 10 AM: 1:28

it's easy to explain... the morning is much more colorful than the night

lo
06-12-2011, 08:22 AM
I am getting better ;)

Papigiulio
06-13-2011, 07:43 AM
Took me a while to figure out how it worked but then on the first try

2:08 w00t

http://img708.imageshack.us/img708/6153/scorehr.jpg

Nice game Denis :)

Papigiulio
06-13-2011, 07:45 AM
I am getting better ;)

hah nice one

lo
06-13-2011, 08:21 AM
hah nice one
Yeah ok, so I may have cheated :cool:

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 ;)

lo
06-13-2011, 08:53 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
)

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!

lo
06-13-2011, 09:03 AM
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 ?

lo
06-13-2011, 09:05 AM
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:

lo
06-13-2011, 09:11 AM
Really cool site, didn't know about it, thanks

denisT
06-13-2011, 10:00 AM
i knew that you found my globals... you could stop the timer as well and shuffle the names all day... ;)

lo
06-13-2011, 12:28 PM
you could stop the timer as well and shuffle the names all day... ;)

Why work hard when Maxscript can do the work for me :)

CGTalk Moderation
06-13-2011, 12:28 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.