Skip to content

Commit

Permalink
Ground truth for a bunch more tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
mcobzarenco committed May 23, 2023
1 parent ba77e6f commit fb72eed
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 4 deletions.
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)
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-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
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/grid-coordinate.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
</style>

<script>
var EXPECTED_CIRCLE_ID;

var MAX_X = 2; // x on grid will range from -2 to 2.
var MAX_Y = 2; // y on grid will range from -2 to 2.

Expand Down Expand Up @@ -84,6 +86,7 @@
d3.select('#query').html('Click on the grid coordinate <span class="bold">' + expectedCoords + '</span>.');

drawCartesianGrid(svg);
EXPECTED_CIRCLE_ID = CSS.escape(expectedCoords);

d3.selectAll('circle').on('click', function(){
var circleId = this.getAttribute('id');
Expand Down
3 changes: 3 additions & 0 deletions miniwob/html/miniwob/identify-shape.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#area-buttons button { margin: 2px; }
</style>
<script>
var EXPECTED_SHAPE;

var generateShape = function(){
var grid = {};
grid.shapes = [];
Expand Down Expand Up @@ -59,6 +61,7 @@
var svg_elt = d3.select('#area_svg');
shapes.renderGrid(svg_elt, grid); // instantiate the actual SVG shapes
var expectedType = grid.shapes[0].type !== 'shape' ? grid.shapes[0].type : grid.shapes[0].text;
EXPECTED_SHAPE = expectedType;
return expectedType;
}

Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/unicode-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<script src="../core/d3.v3.min.js"></script>
<script src="../common/ui_utils.js"></script>
<script>
var TARGET_BUTTON;
var buttons = ['ÖK', 'Cancél', '♥♥♥', '确定', '取消', 'ヘルプ'];

var genProblem = function() {
Expand Down Expand Up @@ -47,6 +48,7 @@
}

var correct_text = core.sample(elements).html();
TARGET_BUTTON = correct_text;
for(var i = 0, len = elements.length; i < len; i++) {
var e = elements[i];
if(e.html() === correct_text) {
Expand Down
5 changes: 5 additions & 0 deletions miniwob/html/miniwob/use-autocomplete.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
</style>

<script>
var TARGET_ITEM;
var TARGET_PREFIX;

var genProblem = function() {
ITEMS = ui_utils.COUNTRIES;
d3.select('#tags')[0][0].value ='';
Expand All @@ -37,9 +40,11 @@
});

var gtitem = ITEMS[gtix];
TARGET_ITEM = gtitem;

var nf = core.randi(2, 5);
var f = gtitem.slice(0,nf);
TARGET_PREFIX = f;

var ne = core.randi(2, 5);
var e = gtitem.slice(gtitem.length - ne);
Expand Down
2 changes: 2 additions & 0 deletions miniwob/html/miniwob/visual-addition.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</style>

<script>
var TARGET_TEXT;
core.EPISODE_MAX_TIME = 15000; // set episode interval to 15 seconds
var PROBLEM_TEMPLATE =
`
Expand All @@ -41,6 +42,7 @@
var digitTwo = core.sample(DIGITS);

var expectedAnswer = (digitOne + digitTwo).toString();
TARGET_TEXT = expectedAnswer;

var visualOne = '';
for(var i=0;i<digitOne;i++) visualOne += VISUAL_TEMPLATE;
Expand Down

0 comments on commit fb72eed

Please sign in to comment.