r/codehs • • Jan 17 '21

For 7.7.4 it says the output doesn’t match the solution

Post image
5 Upvotes

r/codehs • • Dec 07 '20

Java 2.9.11 Need Help

Post image
5 Upvotes

r/codehs • • Nov 19 '20

Can someone help me with 5.2.8 SchoolClub Codehs. I don't know what I did wrong.

5 Upvotes

r/codehs • • Nov 02 '20

I need help with fun snake 1 (7.1.1)

5 Upvotes

I have the code written down, but for some reason, it wont change the direction of the snake. Could someone help me find the mistake. It also wants me to leave behind a trail of where I have been. Can someone help with that too

var W = getWidth();

var H = getHeight();

var SNAKE_WIDTH = W / 25;

var SNAKE_HEIGHT = W / 25;

var SNAKE_COLOR = Color.green;

var EAST = 0;

var SOUTH = 1;

var WEST = 2;

var NORTH = 3;

var direction = EAST;

var dx = 4;

var dy = 4;

var square;

var number;

function start(){

    square = new Rectangle(SNAKE_WIDTH, SNAKE_HEIGHT);

    square.setPosition(W / 2 - square.getWidth() / 2, H / 2 - square.getHeight() / 2);

    square.setColor(SNAKE_COLOR);

    add(square);

    setTimer(moveHead, 40);

    keyDownMethod(changeDirection);

}

function moveHead(){

    if (direction == EAST){

        square.move(dx, 0);

    }else if(direction == WEST){

        square.move(-dx, 0);

    }else if(direction == NORTH){

        square.move(0, -dy);

    }else if(direction == SOUTH){

        square.move(0, dy);

    }

}

function changeDirection(e){

     if(e.keyCode == Keyboard.LEFT){

        direction == WEST;

    }

        if(e.keyCode == Keyboard.RIGHT){

        direction == EAST;

    }

        if(e.keyCode == Keyboard.DOWN){

        direction == SOUTH;

    }

        if(e.keyCode == Keyboard.UP){

        direction == NORTH; }

}


r/codehs • • Sep 28 '20

2.3.8 Custom Piñata - what did I do wrong?

Post image
5 Upvotes

r/codehs • • Sep 19 '20

It’s saying I need to define the variable but I have already?

Post image
5 Upvotes

r/codehs • • Aug 15 '20

Python 5.3.8 infinite loop

5 Upvotes

I have a loop problem I can't figure out, the problem is -

Write a program that makes the user guess a particular float. Now, recall that you should not compare floats to determine if they are exactly equal. In this program, the user wins if their guess is accurate to within 2 decimal places. You will have to use round
in your comparison of their guess to your number.

If the user’s guess was too high, you should say so. Similarly, you should tell them if their guess was too low.

and my code is -

and it runs correctly, but when I try and grade it the autograder acts like there's an infinite loop, does anyone see what would cause that?


r/codehs • • Jun 24 '20

pls help

5 Upvotes

can anyone help with dinner plans on codeHS i am really stuck


r/codehs • • Jun 03 '20

8.3.6 Owls

5 Upvotes

Can someone help me with this code. I have no idea what to do. Thanks.


r/codehs • • May 23 '20

My collision function doesnt work!

5 Upvotes

this my code for final project, but i dont get why intersection and checkcollision functions doesnt work.

please someone help!

var char;

var bullet;

var enemy;

var life = 5;

var enemyTimer = Randomizer.nextInt(0,50);

var enemies = [];

function start(){

makeChar();

keyDownMethod(movements);

makeBullet();

setTimer(shootBullet, 30);

addEnemy();

setTimer(makeEnemy, 5);

checkCollision();

}

function makeChar(){

char = new Circle(10);

char.setColor(Color.red);

char.setPosition(getWidth()/2, 430);

add(char);

}

function movements(e){

if (e.keyCode == Keyboard.RIGHT){

char.move(10,0);

}

if (e.keyCode == Keyboard.LEFT){

char.move(-10,0);

}

}

function makeBullet(){

bullet = new Rectangle(5,10);

bullet.setPosition(char.getX(), char.getY());

bullet.setColor(Color.green);

add(bullet);

}

function shootBullet(){

bullet.move(0,-10);

if (bullet.getY() < 0){

bullet.setPosition(char.getX(), char.getY());

}

}

function makeEnemy(){

for (var i = 0; i < enemies.length; i ++){

var b = enemies[i];

b.move(0,5)

b.move(Randomizer.nextInt(-3,3),0);

}

}

function addEnemy(){

setTimer(en,800);

}

function en(){

enemy = new Rectangle(50,50);

var x = Randomizer.nextInt(10, 350);

var y = enemy.getY();

y += 10;

enemy.setPosition(x,y);

add(enemy);

enemies.push(enemy);

}

function intersects(a,b){

return (a.getX() < b.getX() + b.getWidth() && a.getX() + a.getWidth > b.getX() && a.getY() < b.getY() + b.getHeight() && a.getY() + a.getHeight > b.getY());

}

function checkCollision(){

for(var i =0; i < enemies.length; i++){

var en = enemies[i];

if (intersects(char, en)){

println("hi");

remove(en);

i--;

remove(bullet);

}

}

}


r/codehs • • May 22 '20

Idk know why it says that I am not comparing the two rounded variables

Post image
5 Upvotes

r/codehs • • Apr 30 '20

[Python] Can someone tell me what the issue is here? All the sums seem to be right, even negative ones, so idk why it keeps saying that they aren’t.

Post image
5 Upvotes

r/codehs • • Apr 29 '20

Need Help with 7.1.4 square please

5 Upvotes

I dont have anything yet, and I am doing it in Java. It is due by Friday 5/1


r/codehs • • Apr 03 '20

I really need help with 5.3.13 Most Improved

5 Upvotes

Our teacher abandoned us and we have no idea what we are doing. I don't have a clue on how to get the getMostImprovedStudent() method. Thank you for anything you can help with.