blackjack simulation

IRIX and IRIX software discussion including open source and commerical offerings.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Wed Jan 07, 2015 1:43 pm

vishnu wrote:Awesome, thanks! :P

Trying to compile it on my Sun at work but the bastards in IT seem to have removed the X11 and Motif includes, WTF... :cry:

meanies :P

EDIT: I wonder if there's another defined symbol in IRIX 6.2 that we can use other than __sgi, that's not defined in IRIX 6.5 so the existing ifdef would work automagically, without users having to see your note and edit the source code for use in IRIX 6.5?

yeah i thought about that too but i'm not aware of os version specific macros but maybe there's something c++ specific that tells if it's pre c++98 or not

Not that I expect anyone other than the two of us to actually show enough interest to do that... :lol:

:P

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Wed Jan 07, 2015 2:06 pm

foetz wrote:
vishnu wrote:Awesome, thanks! :P

Trying to compile it on my Sun at work but the bastards in IT seem to have removed the X11 and Motif includes, WTF... :cry:

meanies :P

I put in a ticket and they reinstalled everything so I've got it running on my 1.6GHz Blade 2500, compiled with gcc it runs in from .233 to .235 seconds. :mrgreen: Trying to compile it with Sun Studio 11 fails miserably... :cry:

vishnu wrote:
foetz wrote:EDIT: I wonder if there's another defined symbol in IRIX 6.2 that we can use other than __sgi, that's not defined in IRIX 6.5 so the existing ifdef would work automagically, without users having to see your note and edit the source code for use in IRIX 6.5?

yeah i thought about that too but i'm not aware of os version specific macros but maybe there's something c++ specific that tells if it's pre c++98 or not

I'll bet there is I'll look into it... 8-)

EDIT: Just for funzies this is what happens when I try to compile it with Sun Studio 11:

Code: Select all

"/usr/sfw/include/c++/3.4.3/backward/pair.h", line 60: Error: Could not open include file<bits/c++config.h>.
"/usr/sfw/include/c++/3.4.3/backward/function.h", line 60: Error: Could not open include file<bits/c++config.h>.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 57: Error: Multiple declaration for unary_function.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 64: Error: Multiple declaration for binary_function.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 76: Error: Multiple declaration for plus.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 85: Error: Multiple declaration for minus.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 94: Error: Multiple declaration for multiplies.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 103: Error: Multiple declaration for divides.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 112: Error: Multiple declaration for modulus.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 121: Error: Multiple declaration for negate.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 133: Error: Multiple declaration for equal_to.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 142: Error: Multiple declaration for not_equal_to.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 151: Error: Multiple declaration for greater.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 160: Error: Multiple declaration for less.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 169: Error: Multiple declaration for greater_equal.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 178: Error: Multiple declaration for less_equal.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 191: Error: Multiple declaration for logical_and.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 200: Error: Multiple declaration for logical_or.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 209: Error: Multiple declaration for logical_not.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 221: Error: Multiple declaration for unary_negate.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 238: Error: std::not1<std::_Predicate>(const std::_Predicate&) already had a body defined.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 242: Error: Multiple declaration for binary_negate.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 268: Error: std::not2<std::_Predicate>(const std::_Predicate&) already had a body defined.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 276: Error: Multiple declaration for binder1st.
"/tools/sunstudio-11/SUNWspro/prod/include/CC/Cstd/./functional", line 302: Error: std::bind1st<std::_Operation, std::_Tp>(const std::_Operation&, const std::_Tp&) already had a body defined.
Compilation aborted, too many Error messages.

:shock: :shock: :shock:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Wed Jan 07, 2015 2:38 pm

jeez you're sure your build env is right? that looks like it's getting the wrong stuff at some point. because since it works on irix 6.2 sunpro 11 shouldn't have any probs at all.

as for the c++ headers, if nothing practical shows up and in case you wanna have a more "professional" package to share we could just provide 2 source files. one for old systems and the other one for more recent ones

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Thu Jan 08, 2015 4:22 pm

Yah whoever removed all the X and Motif headers borked the Sun Studio C++ headers as well, I put in another ticket and it's fixed now, our Unix support guys are awesome. They don't know how it happened though, they said none of them had changed anything... :shock:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Thu Jan 08, 2015 7:11 pm

vishnu wrote:They don't know how it happened though, they said none of them had changed anything... :shock:

that's what they always say :P

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Thu Jan 08, 2015 10:30 pm

foetz wrote:
vishnu wrote:They don't know how it happened though, they said none of them had changed anything... :shock:

that's what they always say :P

Or they say "It was working ten minutes ago and all I changed was..." :lol:

I finished adding up the totals, not getting why the lower right hand one doesn't equal 100,000, either I made a mistake in the additions, quite possible given that there are 384 of them, or I don't really know what we're simulating here... ;)

g++ is complaining about your timer:

Code: Select all

braun04.C:1704:94: warning: format '%u' expects type 'unsigned int', but argument 2 has type '__time_t'
braun04.C:1704:94: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
It seems to work just fine though. :mrgreen:
Attachments
braun04_15.tar.bz2
(32.05 KiB) Downloaded 31 times
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Fri Jan 09, 2015 2:38 am

vishnu wrote:g++ is complaining about your timer:

Code: Select all

braun04.C:1704:94: warning: format '%u' expects type 'unsigned int', but argument 2 has type '__time_t'
braun04.C:1704:94: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
It seems to work just fine though. :mrgreen:

couldn't care less about g++ :twisted:

played a bit on 6.5 and it turned out the n32 version is faster than the 64bit :P
attached is the fastest build i got: 0.43 seconds.
Attachments
braun04_65mips4.bz2
(28.29 KiB) Downloaded 30 times

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Fri Jan 09, 2015 3:18 pm

foetz wrote:
vishnu wrote:g++ is complaining about your timer:

Code: Select all

braun04.C:1704:94: warning: format '%u' expects type 'unsigned int', but argument 2 has type '__time_t'
braun04.C:1704:94: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
It seems to work just fine though. :mrgreen:

couldn't care less about g++ :twisted:
Pass -fullwarn to MIPSPro I bet you'll get the same complaint... :mrgreen:

foetz wrote:played a bit on 6.5 and it turned out the n32 version is faster than the 64bit :P
attached is the fastest build i got: 0.43 seconds.

That's not bad at all; which processor do you have on your 6.5?
Last edited by vishnu on Fri Jan 09, 2015 10:24 pm, edited 1 time in total.
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Fri Jan 09, 2015 3:25 pm

vishnu wrote:Pass -fullwarn to MIPSPro I bet you'll get the same complaint... :mrgreen:

haha of course but who wants that spam :P
on a more serious note it is good for checking sometimes of course

That's not bad at all; which processor do you have on your 6.5?

run it on a few irix boxes and compare :-)

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Fri Jan 09, 2015 10:36 pm

On my 3.2GHz Linux box it's coming in around .130 seconds. You know what the RISC guys always say though, that to compare Intel to RISC you have to double the speed of the RISC processor, so the 600MHz processors on my Octane are like 1.2GHz intel processors. Um, okay that was a bit of a non sequitur but that doesn't mean it's not a good point... 8-)
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Thu Jan 22, 2015 1:00 am

So I went back to the original code and figured out how to get the label widgets to update in real time, which is really the whole reason why I wanted to write this sim in the first place, because I thought it would look kind of cool, which, at least as far as X is able to, I think it does. But of course if you get X to do something cool it has to throw another roadblock in your face; after the simulation finishes, X takes several minutes to realize it's done, during which time the user interface (all two buttons of it) is useless. I have no idea what it's doing, probably I need to do real time updates of the frame widgets that hold all the labels, if you hide the simulation window behind another window while it's running and then bring it back to the front the label widgets keep updating but the frames do not. At the risk of repeating myself it's no wonder the chapter on X in the Unix Haters Manual is titled The X Windows Disaster...
braun04.cpp.gz
(14.48 KiB) Downloaded 13 times
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Thu Jan 22, 2015 4:47 am

guess i'll stick to the previous version then :P

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Thu Jan 22, 2015 8:47 am

You should give it a try foetz, it's very weird, it updates 434 label widgets 100,000 times in real time in just a few seconds, which you would think is the hard part, I mean the whole simulation is over and then it just haaaaaaaaaangs for minutes doing I know not what. :shock:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:

User avatar
foetz
Moderator
Moderator
Posts: 6542
Joined: Mon Apr 14, 2003 4:34 am
Contact:

Re: blackjack simulation

Unread postby foetz » Thu Jan 22, 2015 10:05 am

was just kidding. will try it of course :D

User avatar
vishnu
Donor
Donor
Posts: 3174
Joined: Sun Mar 18, 2007 3:25 pm
Location: Minneapolis, Minnesota USA

Re: blackjack simulation

Unread postby vishnu » Fri Jan 23, 2015 11:25 pm

I solved the horrible lag that the program fell into after the simulation completed by calling XSync() and telling it to discard all events queued in the server, which is to say add the line XSync(XtDisplay(w), 1); at the end of the simulate() function, and it works great, no lag at all and now I'm just as happy as though I were in my right mind... :P

Of course, from the XSync manpage "Client applications seldom need to call XSync." Yeah right... :twisted:
Project:
Temporarily lost at sea...
Plan:
World domination! Or something...

:Tezro: :Octane2:


Return to “IRIX and Software”

Who is online

Users browsing this forum: def13 and 2 guests