« first day (1136 days earlier)      last day (3813 days later) » 

2:00 AM
@Pawnguy7 You've got to be able to handle implementing A* from the pseudocode on Wikipedia without my help.
 
I have a problematic alternative: work or sleep or whiskey ;0
 
@CoffeeMaker that's a big nose
 
:-(
there
 
@CoffeeMaker that's a straight nose
 
@DeadMG well, it built
 
2:01 AM
lol
 
That is about all that can be said.
It moved towards the food... and through walls.
Oh, and it was slow.
 
show me ur codes.
 
@Pawnguy7 you've mastered the syntax - congrats ;p
 
I downvoted you and then I also binned you.
 
@BartoszKP lol
 
2:02 AM
:DD
 
I have like 800 lines of commented out attempts in this file :\
 
well, show me the stuff that isn't commented out
 
Technically that is commented out, but that was the A* one.
 
I'm still working on Lua wrapper lol
 
It was kind of cool though.
They got faster when they were near the food.
 
2:03 AM
that is a horrible hash dude
 
your hash is broken
your heuristic is broken.
 
@Pawnguy7 lol, you use a cvs yet you comment out huge blocks of code - what for?
 
that's probably the worst hash function I've ever seen
 
@Rapptz It wasn't meant to be good
It was meant to compile.
That in itself took an hour :\
 
yeah but.. dude..
sf::Vector2i(10, 11); sf::Vector2i(11, 10); has a collision
 
2:05 AM
Yes.
 
your O(N) search in reconstruct_path is WTF, unordered_map has O(1) search you know.
 
@Rapptz (1000, 1) and (1, 1000) collide, that seems a bit worse
 
@Rapptz Strictly, it will just slow things down (potentially a lot) unless == is broken as well.
but the real problem is that his heuristic is totally broken.
not sure about the rest.
 
Broken?
 
oh, wait a minute, I misread it.
that's a simple straight-line distance, isn't it?
 
2:07 AM
@BartoszKP My last commit was a while ago.
 
@DeadMG he's comparing values not keys (I don't know why)
 
@DeadMG I think. Something like that was recommended in that tutorial.
 
@DeadMG with obsolete abs but yes
 
@Pawnguy7 Yeah. That's fine enough for a first go.
 
@BartoszKP why obsolete?
 
2:08 AM
tuning the heuristic is mostly only useful for optimizing phases- for the first phase you just want to make sure that it's consistent/admissible.
 
Yes. It is basically like the hash function :D
 
@BartoszKP what's the non-obsolete one?
 
I don't know how to do either, really.
 
@Pawnguy7 because you take a square of it later so it will be positive anyway
 
Maybe I can be like fred, and add a bunch of shifts everywhere.
@BartoszKP oh... right
 
2:08 AM
@Jefffrey one that is used when it's really needed ; p
 
How did I ever start doing that.
Oh wait, I used to use Manhattan distance.
 
@Pawnguy7 maybe you had manhattan distance earlier
 
I guess I am copy/paste thinking at this point.
 
@BartoszKP I thought you were saying that std::abs was obsolete.
 
@Jefffrey in this code, yes
 
2:10 AM
@BartoszKP Not its use, the function itself.
 
@Pawnguy7 Laurent should really provide std::hash<..> for his types
 
Laurent?
 
@Rapptz I don't know. Is it typical for libraries?
@Borgleader made SFML
 
yes
 
@Jefffrey I meant the use, sorry for the confusion : D
 
2:10 AM
@Borgleader SFML's author
 
Laurent does not like me :D
@Rapptz have a better hash in mind?
 
I can probably send him a pull request, see if he'll accept it.
 
How many types do you have in mind?
 
alright
 
2:12 AM
Summation of std::hashed components seems okay.
 
well here's half your problem.
 
just sf::Vector2<T> and sf::Vector3<T>
 
your open and closed sets are just vectors.
that's not how they're supposed to work.
 
they're the only comparable types in his library I think
oh, time too.
 
Nothing else?
 
2:13 AM
the closed set can be an unordered_set, because all you care about is whether or not the current node is in it.
 
not that I know of
 
Then again, I don't know what else you would store in a map.
 
the open set needs to be a std::set or something like that, because you're performing an ugly n log n sort every single iteration.
no wonder your performance is abominable.
 
Though that probably isn't a valid reason.
 
@Rapptz sf::String
 
2:14 AM
oh right.
he has his own string class.
 
Every library seem to have their own string class.
 
@DeadMG I don't know what it is about this psuedocode, but it is not intuitive to me
Then again, never seen pseudocode with maps either.
 
I was thinking of making one, but not std::string-clone, just a constexpr string
 
also wat with the indentation.
 
@DeadMG looks like I might have a tab problem
 
2:17 AM
float dist_between(sf::Vector2i first, sf::Vector2i second)
{
return 1;
}

:D?
 
What else would the distance be?
 
user3010322
...
 
user3010322
What
 
@Pawnguy7 you are probably using both spaces and tabs
 
user3010322
o.0
 
user3010322
2:18 AM
@Pawnguy7 second - first, maybe.
 
@Jefffrey Not sure, I C&Ped the code form wikipedia
 
lol..
 
@ThePhD it is always one unit away, though
 
@Pawnguy7 Oh no!
 
@Pawnguy7 that's why you should always use just spaces and never have to worry about such stupid surprises ;0
 
2:19 AM
@Pawnguy7 Add an assertion to check that it's really the case.
 
user3010322
@Rapptz What's your Lua wrapper look like so far?
 
user3010322
Is it going to be hard to port like Lia? ._.
 
@DeadMG if you can only move in four orthogonal directions, what else can you get?
 
@ThePhD I doubt it.
 
@Pawnguy7 Bugs.
 
2:20 AM
The only C++11 stuff I'm using is auto, type_traits, variadic templates and.. move semantics.
 
@DeadMG is the function called somewhere else than between neighbors?
 
@Pawnguy7 BUGS
 
user3010322
@Rapptz It's the "type_traits" bit I'm worried about. >_>
 
never ever ever assume that bugs don't happen and produce results you can't understand.
 
@Pawnguy7 if two orthogonal vectors with common start point are equal length, then the distance between their ends is sqrt(2)
 
2:21 AM
@ThePhD They're the ones in std::..
seriously, nothing crazy!
 
user3010322
@Rapptz IS IT REALLY PART OF THE STD, THOUGH?!
 
Oh I'm going to use tuple and indices too
Does VS support that?
 
What is the concept behind std::set?
 
user3010322
Uh.
 
My snake code is 1.414 times worse than it should be.
3
 
user3010322
2:22 AM
Yeah.
 
it does if you're using a version with variadics.
 
@Rapptz 2010+ I think.
std::tuple, that is.
 
user3010322
@Rapptz Can always just implement it as a native type list, though:
 
then it should compile fine in MSVC unless it sucks :v
 
@Pawnguy7 It's a set, where lookup/erasure are based on a BST.
 
user3010322
2:22 AM
template <typename... Tn>
struct type_list : indices<sizeof...( Tn )> {};
 
@DeadMG I don't know what a set is :\ is it... a list/vector with no duplicates?
 
user3010322
^ Wish this is how tuples were packed in the first place, jesus. Implicit indices would be amazing, especially for std::get<N> ._.
 
@Pawnguy7 Er, give or take.
 
TIL std::pair doesn't have std::hash defined for it
 
either a set has an element, or it doesn't.
 
2:24 AM
@Pawnguy7 Like an std::map with the key as the value.
 
user3010322
@Rapptz It'd have to take care to do the combining. Sounds like a minefield t me.
 
Or more like the key is the value.
 
even boost does it
 
Why have a key and value if they are the same?
 
2:25 AM
@Pawnguy7 Sorry. See edit.
 
they meant if they're both the same
 
and SO is down...
 
SO offline - backups, probably.
 
@DeadMG here is where maths come in handy - basic set theory makes people understand what a set is ;P
 
@MarkGarcia why refer to them separately?
 
2:26 AM
@BartoszKP No, that's just "This is a set.".
 
@Pawnguy7 You only store the key. The key is also the value. Some call the set as a "bag".
 
@DeadMG ..?
 
@MarkGarcia So it is like a vector, but you has the values so you can find them faster?
 
You just put things in there, some operations are for finding out if there's a specific value inside it, some operations for getting those values.
@Pawnguy7 Yep. Exactly.
 
What if the hashes of two are the same?
 
2:29 AM
@Pawnguy7 The world ends.
 
@Pawnguy7 if x == y => hash(x) == hash(y) (so hash(x) != hash(y) ==> x != y), but hash(x) == hash(y) doesn't imply x == y (they are compared explicitly then to verify equality).
 
@Pawnguy7 operator== is used to distinguish them.
 
@Pawnguy7 That's for std::unordered_set. More or less the same behavior as unordered_map.
We are dealing with an issue in our primary data cluster, we are trying to return service ASAP.
 
I like how chat's alive.
 
Some penalty running on CTP.
 
2:33 AM
I need to download VS2013
all those C++11 features calling to me
 
anyone plays chess?
 
@DeadMG do it!
 
Is set.insert the proper version of push_back?
@BartoszKP I did
 
@Pawnguy7 No, not really.
 
What is? :D
 
2:34 AM
set.insert inserts into the set... it's not the same as pushing back into a vector.
 
use emplace
 
@Pawnguy7 do you have chess.com account?
 
I guess you could argue that insert is the same as push_back in that when it completes, the value is definitely held within the set.
also btw
holy shit, you really need lambdas.
 
Why do you have an emplace and not a push?
@DeadMG Where?
 
er, quite a few places.
give me a sec and I'll find them all.
 
2:35 AM
hehh insert
 
fuck.
 
@Pawnguy7 emplace is for insert where emplace_back is for push_back.
 
googling for Lua help is going to be difficult now :(
thank god for google cache
 
@BartoszKP I think I had chesscube before they ruined it
If you want to play there was some no-account site though.
@MarkGarcia I don't follow
 
I don't get why Lua broke so many things in their API
 
2:39 AM
What are your thoughts on Hungarian notation?
 
it's retarded
 
@Pawnguy7 std::vector::insert and std::vector::push_back. See that they both take an iterator. The difference is that emplace constructs the object in-place.
 
it sucks
 
@Domecraft I use it for naming widgets in my GUI
 
What's so bad about hungarian notation
 
2:43 AM
@Pawnguy7 Here's my first-pass refactoring
 
And it's back...
 
@Domecraft what's good about it?
@MartinJames welcome to the club.
:)
 
oh I forgot to insert the start node into the open set, lol.
 
@DeadMG I think your lambda lost the wrapping
 
ah maybe it did.
oh well.
I'd just leave the wrapping out for now, personally.
 
2:46 AM
@Pawnguy7 if you have time now - let's play
 
er
 
@DeadMG Don't we want the AI to consider it?
 
actually, I think the wrapping might fuck you.
 
Well, actually I use <x>_t to identify typedefs/using so, I might be using the hungarian notation myself
 
pretty hard.
now that I think about it.
 
2:47 AM
Oh?
Not required, really.
@Jefffrey don't your members have m_?
 
@Jefffrey That's not hungarian.
 
In computer science, a consistent (or monotone) heuristic function is an estimated path cost to a goal for a search that approximates the actual path cost in an incremental way without taking any step back. Formally, for every node N and every successor P of N generated by any action a, the estimated cost of reaching the goal from N is no greater than the step cost of getting to P plus the estimated cost of reaching the goal from P. In other words: : h(N) \leq c(N,P) + h(P) and : h(G) = 0.\, where :* h is the consistent heuristic function :* N is any node in the graph :* P is any descenda...
 
that's a C/C++/POSIX convention
 
@Pawnguy7 not anymore. It's deprecated in favor of _.
 
@Jefffrey deprecated convention?
 
2:48 AM
your straight-line heuristic covers the second condition just fine- the distance from goal to goal is zero.
but
the first one is broken by wrapping.
 
@Pawnguy7 yeah, I like to do that a lot
 
@Jefffrey I always liked _
 
@DeadMG how about this: if the food is more than half the level away, check if the other distance is shorter
If that makes sense.
 
@Rapptz Thanks god, then.
 
the last "big change" to my style was in november of last year when I switched from myFunction to my_function
 
2:49 AM
Not counting for walls, of course.
 
just ditch the wrapping for now, I would say.
 
That might be a problem though.
@DeadMG sure
 
@Rapptz that's a very nice change
 
you can come back to it once you know the heuristic works (it's definitely consistent without the wrapping).
 
@Rapptz what do you use for classes?
 
2:51 AM
It probably would have easier if I stuck with Lua 5.1 instead of Lua 5.2
@Jefffrey same thing
 
basically, A* only guarantees that the result is an optimal path if the heuristic is consistent.
 
can someone explain pointers in layman's terms
 
I really hate things like missing operators for algorithms.
@CoffeeMaker they point at things
All there is to it.
 
is there any difference between them and any other reference
 
What do you mean by any other reference?
 
2:56 AM
like int x = 1
isn't x just a pointer that points to 1
 
lol no.
 
No.
 
Welp!
 
Let's say we have a pointer.
 
dude.
 
2:58 AM
A pointer points to a memory location.
 
help vampires and the feeding thereof.
don't make me smack you
 
Oh.
In that case, I am quite positive google has information.
@DeadMG did you compile this?
 
intellisense didn't cry.
that doesn't necessary mean the compiler won't, of coures.
probably the std::set constructor that the compiler won't accept.
 
I seem to be comparing something without operator==
 
well thanks for at least attempting an explanation unlike others
brb google
 
2:59 AM
@Pawnguy7 vector2i has one, right?
 
@DeadMG yes
 
... ok
 
When I got this earlier, it was...
 
then what the fuck is "someting"
could you be more vague?
 
Something to do with std::find on the unordered_map.
 

« first day (1136 days earlier)      last day (3813 days later) »