Shadows of the Knight - Episode 1 - Puzzle discussion


#85

Could someone help me with it because i have no idea how to solve it unless i hard code it?I am writing the program in c++.


#86

Try to cut the grid in half with each guess. You can google 'binary search' for some examples of how this is accomplished.


#87

first of all i cant understand what to do and how to do... pls help how to start this puzzle...i am beginner


#88

guys i wanna run a virtual loop (doesn t make an output) in the end of it i shall have the Y and X of the bomb
.
BUT I DON T KNOW WHAT IS THE INPUT VALUE OF "bombDir" when batman get to it ???


#89

Hello everyone, could someone help me understand how to apply the binary search even though I know the directions and not the target value?


#90

Too much of guessing. No mention how W, H, N, X0, Y0 are generated? Seems randomly by you, I started to put conditions into values. Where is bomb location, shall I create a variable or your engine creates it? I don't get it at, please advise.


#91

im having trouble on tower could you help me see what im doing wrong


#92

Made it. I got some practice.


#93

I have not fully understand why it will help but thank you


#94

here is my c++ code ,but it just pass a few test, most of the failed tests is about the late time , i think the range should be revised , but i dont nknow how to develop this code

 #include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
int main()
{
    int W; // width of the building.
    int H; // height of the building.
    cin >> W >> H; cin.ignore();
    int N; // maximum number of turns before game over.
    cin >> N; cin.ignore();
    int X0;
    int Y0;
    int first_x =0 ;
    int first_y = 0;
    int last_x = W;
    int last_y = H;
    //the batman start location.
    cin >> X0 >> Y0; cin.ignore();

    // game loop
    while (1) {
        string bombDir; // the direction of the bombs from batman's current location (U, UR, R, DR, D, DL, L or UL)       
        cin >> bombDir; cin.ignore();

        // Write an action using cout. DON'T FORGET THE "<< endl"
        if(bombDir[0] == 'U')
        {
            last_y --;
        }
        else if(bombDir[0] == 'D')
        {
            first_y ++;
        }
        if(bombDir[1] =='L')
        {
            last_x--;

        }
        else if(bombDir[1] == 'R')
        {
           first_x ++;
        }
    X0 = first_x + (last_x-first_x)/2;
    Y0 = first_y + (last_y - first_y)/2;
    cout <<X0<<" "<<Y0<< endl;   
    }
   

    return 0;
}

Shadows of the Knight - Episode 2 - Puzzle discussion
#95

can you help me ,some test i got the bomb explode


#96

I don’t get what I’m supposed to be doing for this episode. I type the coordinates into print, but my progress isn’t getting recorded, and the test cases keep saying ‘check again’, even when I’ve typed in the right coordinates.
I’m using JavaScript.


#97

You type the coordinates: what coordinates ?
What are the right coordinates in your mind ?
Do you take into account the inputs ?