There is no Spoon - Episode 1 puzzle discussion


#93

I just joined this website and I’m trying to play the game but i have no idea what I’m doing. Wheres the tutorial? Wheres the grid I’m supposed to be working off of? All I got is the input window, that loop of the robot shooting, and the test cases that all fail.


#94

Here’s the tutorial: https://www.codingame.com/training/easy/onboarding


#95

Hi can we check the input data of each test?? I have an error, but I cannot check it since I do not know what the input data was.


#96

For the horizontal test on the site, I believe the input is actually:
5
1
0.0.0


#97

Yep. I too got this issue on C++


#98

Hi all,
Passed all the test cases but submission only outputs 75%, failing Broken square and Tunnel cases. I can’t seem to spot what is specific for those two, and would make my code go wrong… Any ideas?
Thanks,


#99

j’ai le même problème que pat_n_roll.

L’énoncé dit explicitement:

  • “the next node to the right” et
  • “the next node to the bottom”,

donc, je voudrait savoir c’est quoi la sortie attendu pour “0 . 0 . 0”,

merci


#100

Hi I solved the puzzle in python and it worked perfectly in my local IDE but when I copied the same code into online coding game IDE it gives a different and a wrong answer… is this a bug or am I doing something wrong ?


#102

My C++ code fails one test: tunnel.
So I copied it to my development environment, hardcoded the grid and tested. It runs just fine! I checked node by node, and the result is perfectly OK.
Within Coding Game it fails at the first node for no reason!
So I fail to get 100% because of a bug in the website… :disappointed_relieved:


#103

For this grid:
0.0.0

This is the expected output:
0 0 2 0 -1 -1
2 0 4 0 -1 -1
4 0 -1 -1 -1 -1


#104

Same thing for me: Tunnel fails at the first node!
I copied my C++ code to VIsual Studio, hardcoded the input data, and checked the output node by node. Everything seems fine. Absolutely no reason to fail in any node, let alone the first one!!


#105

In what world are matrices indexed in the way this test is asking?
Matrix indices are usually as follows:
[(0,0) (0, 1) (0, 2) … (0, N)]
[(1, 0) (1, 1) (1, 2) … (1, N)]
[ … ]
[(M, 0) (M, 1) (M, 2) … (M, N)]

and NOT like:
[(0, 0) (1, 0) (2, 0) … (N, 0)]


#107

Hi, I need some help, I wrote a code, that works fine in IDE, but not in codingame page. here is a code:

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

using namespace std;

int main()
{
	int width; // the number of cells on the X axis
	cin>> width; //cin.ignore();
	int height; // the number of cells on the Y axis
	cin >> height; //cin.ignore();
	vector <double> nodes;
	vector <double>::const_iterator iter;
	string rezult;
	for (int i = 0; i < height; i++) {
		string line; // width characters, each either 0 or .
		getline(cin, line);
		int x = 0;
		for (x = line.find(".", x++); x != string::npos; x = line.find(".", x + 1)) {
			int y = i;
			double xy = x + ((y-1) / 10.);
			nodes.push_back(xy);
			cout << xy << endl;
			
		}
		
	}
	for (unsigned int i = 0; i < nodes.size(); ++i) {
		bool rNeighb = false;
		bool bNeighb = false;
				
                if (nodes[i+1]!=nodes.size()&& nodes[i + 1] == (nodes[i] + 1.)) {
			rNeighb = true;
		}

		iter = find(nodes.begin(), nodes.end(), (nodes[i] + 0.1));
		if (iter != nodes.end()) {
			bNeighb = true;
		}

		double nRez = nodes[i];
		string snRez=to_string(nRez);
                snRez.erase (snRez.begin()+3, snRez.end());
                snRez.replace (1,1," ");
		double rRez = (nodes[i] + 1.);
                string srRez=to_string(rRez);
                srRez.erase (srRez.begin()+3, srRez.end());
                srRez.replace (1,1," ");
		double bRez = (nodes[i] + 0.1);
                string sbRez=to_string(bRez);
                sbRez.erase (sbRez.begin()+3, sbRez.end());
                sbRez.replace (1,1," ");

		if (rNeighb==true && bNeighb==true) {
			rezult = (snRez)+ (" ") + (srRez)+ (" ") + (sbRez);
		}
		else if (rNeighb==true && bNeighb==false) {
			rezult = (snRez)+ (" ") + (srRez)+(" -1 -1");
		}
		else if (rNeighb==false && bNeighb==true) {
			rezult = (snRez)+ (" -1 -1 ") + (sbRez);
		}
		else if (rNeighb == false && bNeighb == false) {
			rezult = (snRez)+ (" -1 -1 ") + ("-1 -1");
		}
		cout << rezult << endl;
	}



	// Write an action using cout. DON'T FORGET THE "<< endl"
	// To debug: cerr << "Debug messages..." << endl;


	
	// Three coordinates: a node, its right neighbor, its bottom neighbor
	//cout << "0 0 1 0 0 1" << endl;
}

Why this code dont work in codingame?


#108

your code goes in timeout, so it seems your print is never reached


#109

Indeed I missed this at first read and it was only when i saw the second test that i had any idea what was going on.


#110

Hello I program with python 3.4 and I have a little problem with this:

> absisse = int(input())  # the number of cells on the X axis
> ordonnee = int(input())  # the number of cells on the Y axis
> cord=dict()

> for x in range(absisse):        # on dresse un tableau de cordonnées vide
>     for y in range(ordonnee):
>         cord[(x,y)]=False

> for y in range(ordonnee):       # on remplie le tableau de cordonnée suivant si il est rempli ou non
>     line = input()
>     for x,i in enumerate(line):
>         if i=="0":
>             cord[(x,y)]=True

> for key,i in cord.items():      # on affiche le voisinage de chaque noeuds 
>     x,y=key
>     x1=x+1
>     y1=y+1
>     resultat=''

>     if i==True:
>         resultat+=(str(x)+" "+str(y))
>         while x1<absisse or resultat==8:
>             if cord[(x1,y)]==True:
>                 resultat+=' '+str(x1)+' '+str(y)+' '
>             else:
>                 x1+=1
>         if len(resultat)<8:
>             resultat+=' -1 -1 '

>         while y1<ordonnee or resultat==11:
>             if cord[(x,y1)]==True:
>                 resultat+=str(x)+' '+str(y1)
>             else:
>                 y1+=1
>         if len(resultat)<11:
>             resultat+=' -1 -1 '
>     print(resultat)

The consol says to me:

Timeout: the program did not provide 1 input lines in due time…

I dont know how resolve this problem… My code is perfect but…
Somebody could help me?
Thank you :wink:

Grégoire pineau


#111

It seems that the issue in the while condition

Variable resultat couldn’t be equal to 8 after assignment

And the cycle never ends.


#112

I need help because i don’t even see how to start.I’m a dumb trying to be a bit more clever so please give me a hint!


#113

interesting puzzle. It’s good to practice recursive function.


#114

I don’t pass the “tunnel” test…
Here’s my code :

admin edit no need to paste code