Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add target variables for 'enter-time' task #85

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion miniwob/html/miniwob/bisect-angle.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</style>

<script>
var POINT_X0, POINT_Y0, POINT_X1, POINT_Y1;
var RADIUS_PADDING = 3; // 3px for circle radius
var QUERY_PADDING = 50; // 50px for #query height

Expand Down Expand Up @@ -119,11 +120,16 @@
while(jsonCircles.length < 3){
var newCircle = { cx: core.randi(5,135), cy: core.randi(10, 120), fill : 'black', class: 'init-black', r: 3.5 };
var usablePoint = pointsSpacedOut(newCircle, jsonCircles)
console.log
if(!usablePoint) continue;
else jsonCircles.push(newCircle);

}

POINT_X0 = jsonCircles[1]["cx"];
POINT_Y0 = jsonCircles[1]["cy"];
POINT_X1 = jsonCircles[2]["cx"];
POINT_Y1 = jsonCircles[2]["cy"];

return jsonCircles;
}

Expand Down
6 changes: 3 additions & 3 deletions miniwob/html/miniwob/chase-circle.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// eventually ends the episode.
var translateCircle = function(translates) {
if(translates !== 0){
d3.select('#circ').transition().duration(2000)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes to chase-circle should also be removed

d3.select('#circ').transition().duration(core.EPISODE_MAX_TIME / 5)
.attr('cx', Math.random() * 120 + 20) // change this to random 2px
.attr('cy', Math.random() * 120 + 20) // change this to random 2px
.each('end', function(){
Expand All @@ -30,15 +30,15 @@
} else {
// end this episode slightly earlier, otherwise if set to 2000ms
// the episode will automatically end and give a -1.0 score.
d3.select('#circ').transition().duration(1900)
d3.select('#circ').transition().duration(core.EPISODE_MAX_TIME / 5.5)
.attr('cx', Math.random() * 120 + 20)
.attr('cy', Math.random() * 120 + 20)
.each('end', function(){
if(exitTime !== null) {
missedFrames += new Date().getTime() - exitTime;
exitTime = null;
}
var score = (10000 - missedFrames)/10000;
var score = (core.EPISODE_MAX_TIME - missedFrames) / core.EPISODE_MAX_TIME;
missedFrames = 0;
core.endEpisode(score);
});
Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/choose-date-easy.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</style>

<script>
var TARGET_DATE_STRING;
var START_DATE = new Date(2016, 11, 1); // December 1, 2015
var END_DATE = new Date(2016, 11, 31); // December 31, 2016
core.EPISODE_MAX_TIME = 20000; // set episode interval to 20 seconds
Expand All @@ -29,6 +30,7 @@
d3.select('#datepicker')[0][0].value = '';

var q = ui_utils.toDateString(d);
TARGET_DATE_STRING = q;

d3.select('#query').html('Select ' + q + ' as the date and hit submit.');

Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/choose-date-medium.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</style>

<script>
var TARGET_DATE_STRING;
var START_DATE = new Date(2016, 10, 1); // November 1, 2015
var END_DATE = new Date(2016, 11, 31); // December 31, 2016
core.EPISODE_MAX_TIME = 20000; // set episode interval to 20 seconds
Expand All @@ -29,6 +30,7 @@
d3.select('#datepicker')[0][0].value = '';

var q = ui_utils.toDateString(d);
TARGET_DATE_STRING = q;

d3.select('#query').html('Select ' + q + ' as the date and hit submit.');

Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/choose-date-nodelay.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</style>

<script>
var TARGET_DATE_STRING;
var START_DATE = new Date(2016, 0, 1); // January 1, 2015
var END_DATE = new Date(2016, 11, 31); // December 31, 2016
core.EPISODE_MAX_TIME = 20000; // set episode interval to 20 seconds
Expand All @@ -30,6 +31,7 @@
$('#datepicker').datepicker('hide');

var q = ui_utils.toDateString(d);
TARGET_DATE_STRING = q;

d3.select('#query').html('Select ' + q + ' as the date and hit submit.');

Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/choose-date.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</style>

<script>
var TARGET_DATE_STRING;
var START_DATE = new Date(2016, 0, 1); // January 1, 2015
var END_DATE = new Date(2016, 11, 31); // December 31, 2016
core.EPISODE_MAX_TIME = 20000; // set episode interval to 20 seconds
Expand All @@ -29,6 +30,7 @@
d3.select('#datepicker')[0][0].value = '';

var q = ui_utils.toDateString(d);
TARGET_DATE_STRING = q;

d3.select('#query').html('Select ' + q + ' as the date and hit submit.');

Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/click-collapsible-2-nodelay.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
</style>

<script>
var TARGET_TEXT;

var createLinks = function(div){
for(var i=0;i<3;i++){
var header = '<h3> Section #' + (i+1) + '</h3>';
Expand Down Expand Up @@ -61,6 +63,7 @@
createLinks(div);
var any = core.getOpt(core.QueryString, 'any', false); // click any link?
var correctText = bindClickEvents();
TARGET_TEXT = correctText;

// generate query text in the UI
d3.select('#query').html('Expand the sections below, to find and click on the link "' + correctText + '".');
Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/click-collapsible-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
</style>

<script>
var TARGET_TEXT;

var createLinks = function(div){
for(var i=0;i<3;i++){
var header = '<h3> Section #' + (i+1) + '</h3>';
Expand Down Expand Up @@ -61,6 +63,7 @@
createLinks(div);
var any = core.getOpt(core.QueryString, 'any', false); // click any link?
var correctText = bindClickEvents();
TARGET_TEXT = correctText;

// generate query text in the UI
d3.select('#query').html('Expand the sections below, to find and click on the link "' + correctText + '".');
Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/click-color.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
</style>

<script>
var TARGET_COLOR_BOX;

var COLORS = ['red', 'blue', 'olive', 'lime', 'black', 'white', 'grey', 'purple', 'orange', 'yellow', 'cyan', 'pink', 'magenta'];
var QUERY_COLOR = `<div id="query-color"></div>`
var MAX_COLORS = 4;
Expand Down Expand Up @@ -60,6 +62,7 @@

var currentColors = generateColors();
var expectedColor = core.sample(currentColors);
TARGET_COLOR_BOX = expectedColor;
displayProblem(expectedColor);

d3.selectAll('.color').on('click', function(){
Expand Down
5 changes: 5 additions & 0 deletions miniwob/html/miniwob/click-pie.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<script src="../common/special/click-pie/wheelnav.min.js"></script>
<script src="../common/ui_utils.js"></script>
<script>
var TARGET_ITEM;
var NUM_ITEMS;

var createItems = function(){
var alphanumericList = core.shuffle(ui_utils.alphanumericList.slice());
var setLength = core.randi(4,9)*-1;
Expand All @@ -49,6 +52,8 @@

var genProblem = function() {
var wheel = createItems();
TARGET_ITEM = wheel.items.navItems.findIndex((x) => wheel.problemSet[x.itemIndex] == wheel.expectedItem) + 1;
NUM_ITEMS = wheel.problemSet.length;

d3.select('#query').html('Expand the pie menu below and click on the item labeled "<span class="bold">' + wheel.expectedItem + '</span>".');

Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/click-shape.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#area_svg { width: 160px; height: 160px; }
</style>
<script>
var GROUND_TRUTH_INDEX;

// generate a new random grid of shapes
var createShapes = function(){
var grid = shapes.genGrid();
Expand All @@ -24,6 +26,7 @@

var chooseShape = function(grid){
var gtix = core.randi(0, grid.shapes.length);
GROUND_TRUTH_INDEX = gtix;
var gtdesc = shapes.generalDesc(grid.shapes[gtix]);
d3.select('#query').html('Click on a ' + gtdesc.text); // render query
return gtdesc;
Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/click-test-transfer.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
</style>

<script>
var TARGET_BUTTON;

var genProblem = function() {
var correct = (WOB_DATA_MODE == 'test') ? 'TWO' : 'ONE';
TARGET_BUTTON = correct;

var L = core.randi(0, 118); var U = core.randi(0, 118) + 50;
var btn = d3.select('#subbtn');
Expand Down
5 changes: 5 additions & 0 deletions miniwob/html/miniwob/drag-items.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
</style>

<script>
var DESTINATION_LABEL;
var SOURCE_LABEL;

var OLDIX;
var genProblem = function() {
var ITEMS = core.shuffle(ui_utils.PEOPLE_NAMES.slice());
Expand All @@ -36,6 +39,7 @@
}

var ix = core.randi(0,n) + 1; // ground truth item index, 1-indexed
SOURCE_LABEL = ix - 1
var poss = [];

if (ix !== 1) { poss.push(['to the top.', 1]); }
Expand All @@ -56,6 +60,7 @@

// generate a query
var s = core.sample(poss);
DESTINATION_LABEL = s[1] - 1
var target_description = s[0];
var target_index = s[1];
d3.select('#query').html('Drag ' + ITEMS[ix-1] + ' ' + target_description);
Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/enter-password.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
<script src="../core/d3.v3.min.js"></script>
<script src="../common/ui_utils.js"></script>
<script>
var TARGET_TEXT;
core.EPISODE_MAX_TIME = 15000; // set episode interval to 15 seconds

var genProblem = function() {
d3.select('#password')[0][0].value ='';
d3.select('#verify')[0][0].value ='';

var password = ui_utils.generateString(2,6);
TARGET_TEXT = password;
d3.select('#query').html('Enter the password "<span class="bold">' + password + '</span>" into both text fields and press submit.');

// reward awarder
Expand Down
8 changes: 6 additions & 2 deletions miniwob/html/miniwob/enter-text-2.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<script src="../common/ui_utils.js"></script>

<script>
var TARGET_TEXT;

var randomizeInputs = function(){
// move the text field around
var s = '';
Expand All @@ -31,15 +33,17 @@
var capitalize = Math.floor(Math.random(0,1)*2) === 1;
if(capitalize){
var expectedQ = q.toUpperCase();
TARGET_TEXT = expectedQ;
q = q.toLowerCase();
var queryText = 'all upper case letters';
} else {
var expectedQ = q.toLowerCase();
TARGET_TEXT = expectedQ;
q = q.toUpperCase();
var queryText = 'all lower case letters';
}
return {query: q, queryText: queryText, expectedText: expectedQ};
}
return {query: q, queryText: queryText, expectedText: expectedQ};
}
Comment on lines +45 to +46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Dedent these two lines.


var bindClickEvent = function(expectedText){
d3.select('#subbtn').on('click', function(){
Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/enter-text-dynamic.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<script src="../core/d3.v3.min.js"></script>
<script src="../common/ui_utils.js"></script>
<script>
var TARGET_TEXT;

var genProblem = function() {
d3.select('#tt')[0][0].value ='';

Expand All @@ -28,6 +30,7 @@

// generate a query
var q = ui_utils.generateString(1,6);
TARGET_TEXT = q;
d3.select('#query').html('Enter "<span class="bold">' + q + '</span>" into the text field and press Submit.');

// reward awarder
Expand Down
Loading
Loading