Example of script recipes and how to tutorial

Case number:699969-986900
Topic:General
Opened by:mat747
Status:Closed
Type:Suggestion
Opened on:Thursday, October 15, 2009 - 10:38
Last modified:Thursday, June 7, 2012 - 13:54

Example of script recipes and how to tutorial

Could you add example of script recipes to cookbook and how to tutorial in foldit wiki.
To help people new to scripting learn and understand the Lua language.

(Thu, 10/15/2009 - 10:38  |  20 comments)


Joined: 04/13/2009
Groups: Contenders

I actually am working on this (I'm not a dev, just a player!). It might take me a couple more days before I put it up on the wiki. It won't cover everything you discussed -- just walk you through creating one particular script. But it should be enough for most folks to get going w/ Lua on a basic level. I may also add some other script examples if I have time.

I'm struggling a bit w/ what level to write it at. Someone who has never programmed before? Someone who may have programmed/scripted something at some point in their lives and are fairly tech savvy? Someone w/ more extensive experience programming in another programming language?

Any thoughts?

Brick's picture
User offline. Last seen 19 weeks 2 days ago. Offline
Joined: 07/15/2008
Groups: Beta Folders

I would suggest writing it for the lowest level, and include some basic scripting techniques.

I'm afraid that this new feature will create two distinct classes of players - those creating and using scripts, and those who can't because they don't understand scripting. It could be very discouraging to those who can't, and frankly, it creates a very uneven playing field and possibly drive away those people.

I think it also goes against the original premise of Fold.it which is to use the human intuition to help fold. It's obvious that the scripters will be doing just what Rosetta does now - computerized folding.

Joined: 04/13/2009
Groups: Contenders

Brick, that was my thought to write it at the most basic level.

I agree with you a bit about how scripting might change the game and might unfairly advantage people who are comfortable doing some programming. A couple thoughts, though:

1) if it was so easy to fold proteins using a program ... there would be no foldit in the first place! The best and the brightest people in the world have already built and continue to build systems that can fold proteins. The problem is that these systems don't do it all that well. Protein folding is one of several problems in math and science where simply *being human* is the greatest advantage of all. Understanding spatial relations on an intuitive level, thinking three dimensionally, manipulating objects, squishing and poking things, pushing one thing into another or into an empty space, and looking at visual configurations and thinking "that just looks right" or "that doesn't look right" are the skills that each and every one of us has that no protein folding program in the world can replicate. Perhaps someday, to some extent. But for now, we are the ones with the advantage. *

2) that being said, I do think that scripting could help folders utilize their time better and therefore get slightly better scores. For example, as many people already have found out, even if a person only has time to use that amazing intuitive human 3d sense for an hour a day folding proteins, they can run a "cookbook" recipe (or now a script) for the other 23. The parts of the process that are repetitive and mindless (backbone walk, anyone? :) )-- those are the parts that we really don't need our amazing humanness for and that a program would be better suited to. Even now, those who are comfortable with recipes probably have a small advantage if they methodically and appropriately use their recipes. How much of an advantage? I really can't tell you. But anecdotally, ti seems that points to be gained doing many automated folding activities tend to max out pretty quickly. A backbone walk can only yeild so many points, and it will never replace actual, thoughtful, folding. So we can guess that scripting will add another few or few dozen points to some people's scores. Is this fair? Perhaps not. Personally, I enjoy programming and doing nerdy things, so having some basic scripting helps make the game more fun to me (as the cookbook did). But I realize that a lot of folks may not enjoy the same things that I do.

3) one way to mitigate the imbalance is to give people access to the scripts that other people write. This has evened out some of the potential issues with the cookbook, since most folders can at least click on a recipe on the web and then click on it to run it. Eventually, scripts should work the same way (at least, I would hope) the result being a bit of evening out of the playing field.

4) I'm going to create a sidebar in my tutorial as a "quickstart" that basically says: here's how you cut and paste an already created recipe into foldit, click a button, and you're up and running. No coding needed.

mat747's picture
User offline. Last seen 4 weeks 6 days ago. Offline
Joined: 10/15/2008
Groups: Void Crushers

Themarquis taking the time to work on adding information to foldit wiki. I would be happy to discuss any ideas for a wiki tutorial via PM.
Where do you start, I think Brick is right in that the tutorial should from “lowest level” because the less you know about scripting the more you are going to need a tutorial.

Thank you for your reply`s Themarquis, Brick.

Joined: 04/13/2009
Groups: Contenders

Great, matt. I'd love to hear your ideas/suggestions (and anyone else if you want to PM me). I'm hoping to get it posted by the end of this weekend. I have a pretty rough draft right now.

It would also be nice if a few people posted some simple scripts that they might have developed (if any). Having three or four scripts up in addition to my tutorial will help folks get some ideas for what is possible and how the syntax works. My main example in the tutorial will be a simple backbone walk type script that improves a bit on "cookbook" walks. It will introduce people to the idea of loops, variables, conditionals, and commands, hopefully in a way that makes sense to most players, since most folks are at least familiar with walking.

It will also provide the extra benefit of establishing the basic loop structure that they can use (copy/paste if desired) to do just about anything they can imagine to a protein segment-by-segment. The process for programming neophytes who want their own scripts but don't want to dig too deeply into programming structures and whatnot will be to copy/paste the loop I provide and then insert one or more items from the command set into the inside of the loop (heck, they can copy and paste these, as well!) A wide variety of scripts should be possible from those building blocks without the need for any further programming experience!

Hope that makes sense -- I'm still putting this together. I welcome all other suggestions, ideas, and criticisms.

Joined: 04/13/2009
Groups: Contenders

Just a quickie update -- I'm still working on the tutorial, but I've fallen a bit behind. I'd like to get it out this week if possible.

Does anyone have any sample scripts to share that they might want me to include in the tutorial (full credit given, of course). PM me!

Joined: 09/18/2009
Groups: SETI.Germany

Well, maybe the latest script as a sample?
It contains a loop from the beginning to the end of a protein, and a choice.

A question here: where can I get a list and description of all foldit-script commands (like get_xx ... whatever)?

Joined: 11/10/2007
Groups: Window Group

In the cookbook, if you go to "New (Script)" then "Help" you should get a list of all the functions.

Joined: 09/18/2009
Groups: SETI.Germany

Nice to know, thanks a lot!

Joined: 11/10/2007
Groups: Window Group
Topic: Developer Preview » Game: Tools

Changing project.

mcurtis's picture
User offline. Last seen 9 years 25 weeks ago. Offline
Joined: 05/09/2008
Groups: None

I've created a wiki skeleton for Lua Scripting ( http://foldit.wikia.com/wiki/Lua_Scripting )
including one example script ( http://foldit.wikia.com/wiki/Get_segment_score_part )

Joined: 12/06/2008
Groups: Contenders

I'm with Brick, in that scripting should be set up so that anyone, regardless of programming experience, can use it. I can program, but my skills date back to the mid 80's, and are horribly ineffective in this environment. Without making scripting simple, I can't take advantage of this new tool.

If scripting can be made as easy as programming one's VCR or TiVo, I would disagree with Brick that scripting will automatically cause a schism in the ranks. Some people even now don't use the more "advanced" tools like rebuild. Whatever their reason, I doubt that they think they are second-class folders and would leave because they feel disadvantaged.

Adding another tool is just that: adding another tool. Not every carpenter uses every tool on his belt; but they build nice houses, just the same.

Joined: 04/13/2009
Groups: Contenders

All right ... my tutorial is up. As requested, at as close to "total beginner" level as I could get. It is not comprehensive in any sense, but it covers the most basic things a person will want to do and gives lots of ideas for further exploration on their own.

I tried to emphasize the idea of using a basic loop through the protein (cut 'n paste from the tutorial or sample script if desired) and filling the body of the loop with a series of statements of your own choosing. That is prbably 95 percent of what folks will actually want to do, and any mroe advanced stuff can get cut and pasted in or skills to do so acquired as needed.

I spent a. lot. of. time working on how to use the commands from the command list, i.e., "take off the word "void" and then put a number into the parentheses. The number is called a parameter and it tells the command what it needs to know ... " I know there is tediousness there for anyone who has experience programming, but helping folks become adroit with those commands will be key to putting everyone on the same footing with scripting. The fancy stuff like building a bunch of loops or conditionals or whatever ... also important, but not so much (and harder to learn).

http://foldit.wikia.com/wiki/Scripting_Quick_Start_Guide

I would actually love it if an actual beginner could take a look and see if it works for them to provide enough to get up and running. I'll modify as needed based on feedback (and anyone is welcome to modify it themselves, of course)

I agree with your assessment of a potential schism being created, by the way, Boots. Scripting is much more of a powerful tool than I think the devs might realize. That's just IMO based on how I've heard them talk about it. They may see it more as a fun new feature that they're just providing because players have clamored for it. Not as a game changer. Which I think those of us who have been folding for a while know that it will be, because 95 percent of what we do is basically repetitive and algorithmically describable. The five percent that is unique and human ... well ... it's what everyone in the scientific community is really interested in and why Foldit exists. But points are points, and so if it's easier to run a script all night long and grind away at those points than to sit and think and visualize and play ... well, you can guess what folks will tend to want to do.

Joined: 09/18/2009
Groups: SETI.Germany

Nice work, and I'm with your opinion about scripts.
Who knows?
Maybe someday they will implement some algorithms in(to) Rosetta created here on FoldIt.

Joined: 04/13/2009
Groups: Contenders

Thanks to some suggestions from Mat747, the current tutorial is going to be split into three parts -- beginner 1, beginner 2, and intermediate (leaving advanced for someone with more skills to do, perhaps? :) )

Beginner 1 will be up shortly and will include ONLY things a person needs to know to download and run scripts from the web (plus a couple goodies like opening an output window, selecting segments before running a script, etc.) The idea being that many people just want to work with scripts other people have made.

Beginner 2 will include the current material on commands in more depth and with more examples, and will feature a sample script that is a series of statements (no looping, variables, etc.)

Intermediate will be the rest of the material that is up now (variables, loops, more complex commands, etc.) We should also add a section on if statements.

Anyone who is interested in working with lua now can look at the current tutorial (labeled "intermediate") or hold off for a day or two for beginner 1.

mat747's picture
User offline. Last seen 4 weeks 6 days ago. Offline
Joined: 10/15/2008
Groups: Void Crushers
Topic: Game: Tools » General

I think it is great the amount of work that has been done so far, to help us non-scripters.

Crashguard will you add some of your scripts to the tutorial,In the intermediate/advanced skill level.
If you are to busy to do a tutorial, you could add them to an Example page. it would still help players because of the comments you have added to scripts.

Joined: 04/13/2009
Groups: Contenders

Hi folks ...

Shall we start a foldit lua scripting working group for further discussion of tutorial development (and scripting ideas and development in general?)

See this post on the forums: http://fold.it/portal/node/987000

Joined: 09/18/2009
Groups: SETI.Germany

Posted a reply at this node.

Joined: 09/18/2009
Groups: SETI.Germany

Some new answers are here:

http://fold.it/portal/node/986986

spmm's picture
User offline. Last seen 47 weeks 5 days ago. Offline
Joined: 08/05/2010
Groups: Void Crushers
Status: Open » Closed

there is now considerable help for scripters in the wiki - closed

Sitemap

Developed by: UW Center for Game Science, UW Institute for Protein Design, Northeastern University, Vanderbilt University Meiler Lab, UC Davis
Supported by: DARPA, NSF, NIH, HHMI, Amazon, Microsoft, Adobe, RosettaCommons