Image Image Image




Post new topic Reply to topic  [ 86 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
 Post subject: Re: Yet Another Language War
PostPosted: Thu Feb 25, 2010 7:49 pm 
Offline
Senior member
User avatar

Posts: 451
Favourite Bot: gimmick
Same as Java, then.


Top
 Profile E-mail  
 
 Post subject: Re: Yet Another Language War
PostPosted: Thu Feb 25, 2010 7:54 pm 
Offline
Senior member
User avatar

Posts: 458
Location: Now in the mighty PolarBoar variant!
Favourite Bot: ...
TooMuchCoffee wrote:
PolarBear wrote:
BTW, I was suprised that C# doesn't have an assert keyword (or equivalent).
Debug.Assert not equivalent enough for you?

http://msdn.microsoft.com/en-us/library/e63efys0.aspx

With the added benefit of getting them out of the code in release builds.


It's not the same as pure assert - when condition fails, the dialog is shown, which halts all execution (at least in current thread I guess) - not very good for bot which is running while you're at the gym :) But generally I just don't care - I like C# more than Java anyway, it has some cool features that Java lacks IMO. I use Java mostly because I'm much more familiar with it, and tons of available libs of all sorts.


Top
 Profile  
 
 Post subject: Re: Yet Another Language War
PostPosted: Thu Feb 25, 2010 8:12 pm 
Offline
PokerAI fellow
User avatar

Posts: 1562
Location: Finland
Favourite Bot: Self-made
PolarBear wrote:
It's not the same as pure assert - when condition fails, the dialog is shown, which halts all execution (at least in current thread I guess)

If the dialog bothers you, here you go.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.diagnostics>
        <trace>
            <listeners>
                <clear/>
            </listeners>
        </trace>
        <assert assertuienabled="false" />
    </system.diagnostics>
</configuration>


Want programmatic solution?
Code:
((DefaultTraceListener)Debug.Listeners[0]).AssertUiEnabled = false;


Need to know something more about c#? Just ask... ;)

_________________
Opinions expressed are my own, your mileage may vary... ;)
Warning: If I spot an opportunity to give sarcastic replies, I will take it. Nothing personal. I don't even know you.


Top
 Profile  
 
 Post subject: Re: Yet Another Language War
PostPosted: Fri Sep 30, 2011 11:46 pm 
Offline
Junior member
User avatar

Posts: 38
Favourite Bot: ToBeBorn 2012-09
Hi all,
Instead of opening a new thread, this one looks a good place.
Here are recent language comparison with very interesting technologies like V8:JS or Shed Skin Python :
http://attractivechaos.github.com/plb/


For V8:JS (Google Java Script Engine) : http://code.google.com/p/v8/
For Shed Skin Python :
Speed up your Python: Unladen vs. Shedskin vs. PyPy vs. Cython vs. C : http://geetduggal.wordpress.com/2010/11/25/speed-up-your-python-unladen-vs-shedskin-vs-pypy-vs-c/


Top
 Profile E-mail  
 
 Post subject: Re: Yet Another Language War
PostPosted: Sat Oct 01, 2011 7:37 pm 
Offline
Regular member
User avatar

Posts: 95
Favourite Bot: man
I use C# for stuff like this:

Code:
      public IEnumerable<CardMask> FiveCardCombinations
      {
         get
         {
            Debug.Assert(CardCount >= 5);
            var c = AscendingByteArray;

            for (int c0 = 0; c0 < c.Length; c0++)
               for (int c1 = 0; c1 < c0; c1++)
                  for (int c2 = 0; c2 < c1; c2++)
                     for (int c3 = 0; c3 < c2; c3++)
                        for (int c4 = 0; c4 < c3; c4++)
                           yield return new CardMask(c[c0], c[c1], c[c2], c[c3], c[c4]);
         }
      }


And C++ for stuff like this:

Code:
::_mm_prefetch((char *)r, _MM_HINT_NTA);

...

__m128d r01 = _mm_load_pd(r);
__m128d r2 = _mm_load_sd(r+2);
__m128d pmask_r01 = _mm_cmpgt_pd(r01, _mm_setzero_pd());
__m128d pmask_r2 = _mm_cmpgt_sd(r2, _mm_setzero_pd());
__m128d pr01 = _mm_and_pd(r01, pmask_r01);
__m128d pr2 = _mm_and_pd(r2, pmask_r2);
__m128d psum = _mm_add_sd(_mm_hadd_pd(pr01, pr01), pr2);
__m128d nop = _mm_cmple_sd(psum, _mm_setzero_pd());
__m128d reset = _mm_and_pd(_mm_set1_pd(1.0 / 3.0), _mm_shuffle_pd(nop, nop, 0));
__m128d oopsum = _mm_andnot_pd(nop, _mm_div_sd(_mm_set_sd(1.0), psum));
__m128d s01 = _mm_or_pd(_mm_mul_pd(pr01, _mm_shuffle_pd(oopsum, oopsum, 0)), reset);
__m128d s2 = _mm_or_pd(_mm_mul_sd(pr2, oopsum), reset);
__m128d oldreach2 = _mm_andnot_pd(nop, _mm_set_sd(oldreach));
_mm_storeu_pd(as, _mm_add_pd(_mm_loadu_pd(as), _mm_mul_pd(_mm_shuffle_pd(oldreach2, oldreach2, 0), s01)));
_mm_store_sd(as+2, _mm_add_sd(_mm_load_sd(as+2), _mm_mul_sd(oldreach2, s2)));


Top
 Profile E-mail  
 
 Post subject: Re: Yet Another Language War
PostPosted: Tue Jan 31, 2012 12:24 pm 
Offline
Junior member
User avatar

Posts: 19
Favourite Bot: mine
Well, in my opinion, different languages are most suitable for different purpose.


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 86 posts ]  Go to page Previous  1, 2, 3, 4, 5


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: