Frank Poupard

Ranch Hand
+ Follow
since Feb 27, 2016
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Frank Poupard

I solved the problem in this way :

There may be better way though!
2 years ago

Rob Spoor wrote:Each index should be an int or something that's assignable to one, so you can also use byte, short or char. One of them should probably be lig, the other one col. Definitely not the two Strings you're using now.


Thanks but could you elaborate a bit more? How to deal with the type char here ?
2 years ago
Hi,
I'll like to store some mixed data types, i.e int and char in a 2 dimensional array. I did some conversion but I'm still having issues.
The goal is to store in a for example 15*15 grid, alphanumeric values, 'A0', 'A1', till 'A14' for the first rank, then 'B0', 'B1' etc... to the last 'O14'.
I'm doing some stuff with that afterwards but just want to focuse on the following code :



the last line gives this error :

Multiple markers at this line
- Type mismatch: cannot convert from
String to int
- Type mismatch: cannot convert from
String to int



Any idea what I should do ? Thanks in advance;
2 years ago
I messed around with editing... I wanted to add I'm using Python 3.5
2 years ago

Hello, I'm trying to build a simple TCP client but I get the following error :

File "simpleTCP.py", line 8, in <module>
client.send("GET / HTTP/1.1\r\nHost: cnn.com\r\n\r\n")
TypeError: a bytes-like object is required, not 'str'



Any idea what is going wrong ? Thanks.

2 years ago
Hi, I wrote the dummy code above but it's always printing 'hello', i.e, only the first thread is running...Any idea why? Is it this due to this famous GIL ? I'm quite new to multithreading...so thanks for your help !


3 years ago
Thanks for your answer.

As for your actual example, I don't see why a Board object would be passed its Cells from outside. Seems to me that it would be managing its own Cells


Could you be more specific ? It looks like I have overlooked something important...
3 years ago
Thanks for your feedback...I edit some typos btw.
This is a general question, but how can I test thoses classes (I mean separately from the other classes)?
3 years ago
Hello, I'm writing a little game and I have some issues with designing some classes. For instance, I need a class Board, containing some Cells. These cells will have some methods (and they are of different types, so I'll create subclasses)


Here is what I get in short :




My question is the following : is this design correct ? To me, it does not seems very logical to have an object of type Cell as a parameter of another class, i.e. Board. But at the same time, I don't know how to do it. Isn't it a chicken or the egg dilemma ?! Hope you make myself clear !
Thanks for your insights.
3 years ago

Is it really
char[][] terr2d = Projet.getTerrain2d();
and not
char[][] terr2d = Project.getTerrain2d();
?


Sorry, I messed up with languages. There were mistakes also in the for loop, which anyway was only here for the sake of testing. I made it worked finally ! Everything is clear now, thanks.
3 years ago
I realized I should have written


instead of

But still, I get the error, "Type mismatch: cannot convert from int to boolean"

I think I make the difference between static and non static context (I guess we are here in non static context because no object is involved here, only the Class Project as a whole) but something probably escapes me...
3 years ago
Thanks both of you. So, I have made the following changes but still get some errors. I get now the error in the same test method : "Cannot make a static reference to the non-static field
field2dim". Don't really know what to do !




3 years ago
Hello, this is probably a basic question but I have some issue with the following classe : I would like to re-use the variable field2d which is an array of char (declared in the main method of the class Project) in another class.
For example, I would like to iterate over this array but I got the following error : « field cannot be resolved to a variable » in the for loop. What I have overlooked? thanks!




3 years ago