|
|
Great. Pushing that button has apparently affected my hearing. Well, they've always said the internet was a dangerous place.
|
|
|
|
|
FTFY.
Driven to the ARMs by x86.
|
|
|
|
|
AspDotNetDev wrote: FTFY.
Did you mean:
1.fixed that for you.
2.f*ck this f*ck you
3.For the F*ck, YES!
Whatever it was,
(no pun intended)
Greetings - Jacek
modified on Tuesday, July 5, 2011 5:26 PM
|
|
|
|
|
Number 1. Do you realize yet the typo I was correcting? It's the daily "WTF", not the daily "WPF".
Driven to the ARMs by x86.
|
|
|
|
|
Ah. I am not really into all these shorthands. Thanks. By the way, these two acronyms are equivalent for me (WPF and WTF).
Greetings - Jacek
|
|
|
|
|
Jacek Gajek wrote: these two acronyms are equivalent for me
To me they are Windows Presentation Foundation and What The F***. So I guess they are the same to me too.
Driven to the ARMs by x86.
|
|
|
|
|
AspDotNetDev wrote: Windows Presentation Foundation and What The F***
This is what I meant... C'mon, WTF = Worse Than Failure, don't be oh, rude, oh.
Greetings - Jacek
|
|
|
|
|
Ah yes, like "Read The Free Manual".
Driven to the ARMs by x86.
|
|
|
|
|
Hehe, not heard that one before. RTFM has gone out of fashion though with the elimination of actual manuals to refer to.
|
|
|
|
|
It's funny that you used the wrong term ("shorthands"), followed by the correct term ("acronym"). You are consistent in your inconsistencies.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
John Simmons / outlaw programmer wrote: you used the wrong term ("shorthands"),
How should it go then? shortcuts? shortlegs?
Greetings - Jacek
|
|
|
|
|
|
I was about to delete this, but might as well post it here first.
I'm making pac-man.
The Enemy is the "ghost", Hero is "pacman".
When the value of the map[x,y] = 1 it means there's a wall.
Worst thing is that the ghost is still going through walls.
Lesson for today: don't be lazy and design a decent recursive algorithm
if (Math.Abs(Enemy.X - Hero.X) > Math.Abs(Enemy.Y - Hero.Y))
{
if ((Enemy.X - Hero.X) > 0)
{
if ((map[Enemy.X - 1,Enemy.Y]) != 1)
{
Enemy.X -= 1;
}
else
{
if ((Enemy.Y - Hero.Y) > 0)
{
Enemy.Y -= 1;
}
else Enemy.Y += 1;
}
}
else
{
if ((map[Enemy.X + 1,Enemy.Y] != 1))
{
Enemy.X += 1;
}
else
{
if ((Enemy.Y - Hero.Y) > 0)
{
Enemy.Y -= 1;
}
else Enemy.Y += 1;
}
}
}
else
{
if ((Enemy.Y - Hero.Y) > 0)
{
if ((Enemy.Y - 1) != 1)
{
Enemy.Y -= 1;
}
else
{
if ((Enemy.X - Hero.X) > 0)
{
Enemy.X -= 1;
}
else Enemy.X += 1;
}
}
else
{
if ((Enemy.Y + 1 != 1))
{
Enemy.Y += 1;
}
else
{
if ((Enemy.X - Hero.X) > 0)
{
Enemy.X -= 1;
}
else Enemy.X += 1;
}
}
Giraffes are not real.
|
|
|
|
|
Probility of making a typo in this kind of code is equal to 1. Looking forward to see an updated algorithm in a "Clever Code" forum
I'd try making a 3x3 stochastic matrix which probabilities would depend on 1) player's location (let's say 0.9 xor 0.1), 2) validness of a move through wall (0 xor not-0)
Greetings - Jacek
modified on Monday, July 4, 2011 8:56 AM
|
|
|
|
|
Thanks, for the advice... it almost makes too much sense. Why didn't I think of that?
I'm never going to put my own code in 'clever code', seriously if I ever write something clever it'll be because I stole the idea.
Right now I got what it supposed to be doing, it's exactly the same idea but it has a better structure. I use one "if block" to gather information where the walls are, put the result in a byte and run it through a "select" block where every "case" evaluates the direction of the player. It's more readable and a lot easier (as in, not impossible) to comment on.
I'm getting more ambitious now and I'd like to try some ideas for more complex behavior, based on your suggestion. It also needs to be able to run through any given maze, right now I'm 'cheating' because the navigation is tailored to the only maze in the game.
The project started as a break from the boring database stuff at the job training center, so I didn't have much time to work on it. The rest of the game is only about 200 lines of code and it didn't took long to write, but to get decent enemies working proves to be quite a challenge.
Giraffes are not real.
|
|
|
|
|
Found myself coding something like the following just last week...
Dim bool as Boolean = False
If someExpression Then
bool = True
Else
bool = False
End If
If bool Then
Return True
Else
Return False
End If
Luckily I noticed just in time and simply Returned someExpression
Some days its better to just stay in bed...
It's an OO world.
|
|
|
|
|
Hey... it's ok to learn
(yes|no|maybe)*
|
|
|
|
|
Not at this level
It's an OO world.
|
|
|
|
|
At every level
(yes|no|maybe)*
|
|
|
|
|
I meant I shouldn't be learning how to return true or false depending on a variable's true or falseness which depends on an expressions true or falseness on which it should not depend at all, which would be false if you just started out, but true after almost a year of programming
Just true with me
It's an OO world.
|
|
|
|
|
Naerling wrote: I meant I shouldn't be learning how to return true or false depending on a variable's true or falseness which depends on an expressions true or falseness on which it should not depend at all, which would be false if you just started out, but true after almost a year of programming
Ok... I definitely like that
(yes|no|maybe)*
modified on Friday, July 1, 2011 5:13 AM
|
|
|
|
|
Good one.
At least you caught yourself.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Naerling wrote: falseness
Falacy? Falaciousness? Falacio?
|
|
|
|
|
false
[fawls] Show IPA
adjective, fals·er, fals·est, adverb
–adjective
1. not true or correct; erroneous: a false statement.
2. uttering or declaring what is untrue: a false witness.
3. not faithful or loyal; treacherous: a false friend.
4. tending to deceive or mislead; deceptive: a false impression.
5. not genuine; counterfeit.
6. based on mistaken, erroneous, or inconsistent impressions, ideas, or facts: false pride.
7. used as a substitute or supplement, especially temporarily: false supports for a bridge.
8. Biology . having a superficial resemblance to something that properly bears the name: the false acacia.
9. not properly, accurately, or honestly made, done, or adjusted: a false balance.
10. inaccurate in pitch, as a musical note.
–adverb
11. dishonestly; faithlessly; treacherously: Did he speak false against me?
—Idiom
12. play someone false, to betray someone; be treacherous or faithless.
Origin:
before 1000; Middle English, Old English fals < Latin falsus feigned, false, orig. past participle of fallere to deceive; reinforced by or reborrowed from Anglo-French, Old French fals, feminine false < Latin
—Related forms
false·ly, adverb
false·ness, noun
half-false, adjective
qua·si-false, adjective
qua·si-false·ly, adverb
—Synonyms
1. mistaken, incorrect, wrong, untrue. 2. untruthful, lying, mendacious. 3. insincere, hypocritical, disingenuous, disloyal, unfaithful, inconstant, perfidious, traitorous. 4. misleading, fallacious. 5. artificial, spurious, bogus, forged. False, sham, counterfeit agree in referring to something that is not genuine. False is used mainly of imitations of concrete objects; it sometimes implies an intent to deceive: false teeth; false hair. Sham is rarely used of concrete objects and usually has the suggestion of intent to deceive: sham title; sham tears. Counterfeit always has the implication of cheating; it is used particularly of spurious imitation of coins, paper money, etc.
Falseness!
It's an OO world.
|
|
|
|
|