Skip to content

Commit

Permalink
1.3.13 Increase rps padding and add max height
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisse committed Oct 27, 2020
1 parent 05a920d commit d8d21f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion kaggle_environments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from . import errors
from . import utils

__version__ = "1.3.12"
__version__ = "1.3.13"

__all__ = ["Agent", "environments", "errors", "evaluate", "http_request",
"make", "register", "utils", "__version__",
Expand Down
18 changes: 9 additions & 9 deletions kaggle_environments/envs/rps/rps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ async function renderer(context) {
const sign_icons = ["\u{1f44a}", "\u{270b}", "\u{2702}\u{fe0f}", "\u{1f596}", "\u{1f98e}"]

// Common Dimensions.
const maxSize = 960;
const maxWidth = 960;
const maxHeight = 280;
const canvasSize = Math.min(height, width);
const unit = 8;
const offset = canvasSize > 400 ? canvasSize * 0.1 : unit / 2;
Expand All @@ -44,13 +45,12 @@ async function renderer(context) {

// Canvas setup and reset.
let c = canvas.getContext("2d");
canvas.width = Math.min(maxSize, width);
canvas.height = Math.min(maxSize, height);
canvas.width = Math.min(maxWidth, width);
canvas.height = Math.min(maxHeight, height);
c.clearRect(0, 0, canvas.width, canvas.height);

// ------------------------------------------------------------------------------------//

console.log(environment);
if (step < environment.steps.length - 1) {
const state = environment.steps[step + 1]
const last_state = environment.steps[step]
Expand All @@ -60,11 +60,11 @@ async function renderer(context) {
const p2_move = state[0].observation.lastOpponentAction;

const ctx = canvas.getContext("2d");
const row_width = Math.min(maxSize, width) / 3;
const label_x = 0;
const player1_x = row_width;
const player2_x = 2 * row_width;
const middle_x = (player1_x + player2_x) / 2;
const padding = 20;
const row_width = (Math.min(maxWidth, width) - padding * 2) / 3;
const label_x = padding;
const player1_x = padding + row_width;
const player2_x = padding + 2 * row_width;
const label_y = 40;
const sign_id_y = 80;
const sign_name_y = 120;
Expand Down

0 comments on commit d8d21f0

Please sign in to comment.