[MonoDevelop] I want to run a c program on Prisoner's Dilemma in Mono - build report

Manisha Gaur Manisha.Gaur at rsystems.com
Thu Jul 24 13:44:23 UTC 2014


Can somebody please tell me how do I remove my email id from this list?

Thanks,
Manisha

-----Original Message-----
From: monodevelop-list-bounces at lists.ximian.com [mailto:monodevelop-list-bounces at lists.ximian.com] On Behalf Of Rajib Bandopadhyay
Sent: 24 July 2014 19:15
To: Ian Norton
Cc: monodevelop-list; Norton, Ian
Subject: Re: [MonoDevelop] I want to run a c program on Prisoner's Dilemma in Mono - build report

Okay, replaced with int. The build report:
Build successful.
Build failed. Object reference not set to an instance of an object

On 24/07/2014, Rajib Bandopadhyay <bkpsusmitaa at gmail.com> wrote:
> Dear Mr. Norton,
> I have replaced Boolean with Bool as suggested. I renamed the file as
> *.cpp.
> Have you been able to run the program after conversion to c#? If you
> have been successful then I shall proceed, otherwise, it would be a
> waste of energy and time.
> Regards,
>
> On 24/07/2014, Ian Norton <ian.norton-badrul at thales-esecurity.com> wrote:
>> On Thu, Jul 24, 2014 at 02:09:06PM +0100, Rajib Bandopadhyay wrote:
>>> Dear Mr. Norton,
>>> I know only c, and I haven't practiced c#. I am not confident if I
>>> can take up the work, but it is sure worth a try. Also. I have no
>>> alternative but to port the program to c++ or c#, do I?!
>>> For that to happen I have to understand how the Prisoner's Dilemma
>>> was written in the original code, barring the graphics part.
>>> Thank you for responding.
>>> Regards
>>> Rajib Bandopadhyay
>>
>> Well, C# is very easy, but I guess for the purposes of this excercize
>> it could just as well be done in both. (c# is much easier than C in
>> my opionion)
>>
>> So, Lets start with C anyway.
>>
>> It is probably best you try and compile it by hand first, so try running:
>>
>> $ gcc -c prisoner.c
>>
>> I get errors like:
>>
>> inb at carrot:~$ gcc -c prisoner.c
>> prisoner.c: In function 'main':
>> prisoner.c:27:5: error: unknown type name 'WindowPtr'
>> prisoner.c:28:5: error: unknown type name 'Rect'
>> prisoner.c:39:5: error: unknown type name 'Boolean'
>> prisoner.c:40:5: error: unknown type name 'Boolean'
>> prisoner.c:42:16: error: 'qd' undeclared (first use in this function)
>> prisoner.c:42:16: note: each undeclared identifier is reported only
>> once for each function it appears in
>> prisoner.c:47:20: warning: cast to pointer from integer of different
>> size [-Wint-to-pointer-cast]
>> prisoner.c:49:16: error: 'Boolean' undeclared (first use in this
>> function)
>>
>> Which is complaining about WindowPtr, Rect as unknown types.
>>
>> Boolean suggests that the program was originally written for an
>> Objective-C compiler, which makes sense if the original was for
>> MacOS.
>>
>> So we'll probably want to remove or comment out the WindowPtr and
>> Rect lines and replace "Boolean" with "bool" if we want this in C.
>>
>> See what you get after making those changes.
>>
>> Ian
>>
>>> On 24/07/2014, Ian Norton <ian.norton-badrul at thales-esecurity.com>
>>> wrote:
>>> > On Thu, Jul 24, 2014 at 01:06:43PM +0100, Rajib Bandopadhyay wrote:
>>> >> I contacted the original writer of the said codes, Prof.Alexander
>>> >> M Kasprzyk, of the Imperial College, London. He says:
>>> >> "..The code is written for Classic Mac OS -- this is the
>>> >> operating system predating OS X, and will not run on any modern
>>> >> hardware. This is explained quite clearly on the webpage. You
>>> >> will not be able to run it "as-is" on any modern computer.
>>> >> "But the code is only a few tens of lines long, and it is a
>>> >> beginner's exercise in C programming to port it to the operating
>>> >> system of your choice. There is, at most, an hour of work
>>> >> involved..."
>>> >> Can someone with sufficient knowledge of c programming help me
>>> >> please?
>>> >> Regards
>>> >
>>> > I'm sure there are a few of us but the monoodevelop list probably
>>> > isn't the most likley place to be filled with C developers. (since
>>> > monodevelop is mainly for c#)
>>> >
>>> > I'll try and get you started. Infact, probably the first thing to
>>> > do is not use monodevelop for this, since you'll need to know
>>> > about the compiler and what you are giving it. second you will
>>> > need to adjust you expectations a bit, graphical programming is
>>> > very hard. Currently prisoner.c draws directly to some sort of
>>> > graphics window, you wont be able to get that sort of access very
>>> > easily in C without learning about a specific library.
>>> >
>>> > That said, you could re-write it in C# which would give you easier
>>> > access to graphics (System.Drawing + System.Windows.Forms) and
>>> > would help you understand both the languages in use and the
>>> > aspects that the demo illustrates from the thoery.
>>> >
>>> > Let me know what you'd like to try,
>>> >
>>> > Best Regards
>>> >
>>> > Ian
>>> >
>>> >> On 24/07/2014, Rajib Bandopadhyay <bkpsusmitaa at gmail.com> wrote:
>>> >> > Thank you for trying, Mr. Norton.
>>> >> >
>>> >> > On 24/07/2014, Ian Norton
>>> >> > <ian.norton-badrul at thales-esecurity.com>
>>> >> > wrote:
>>> >> >> Hi there,
>>> >> >>
>>> >> >> Well it looks like the code is missing some instructions. Like
>>> >> >> what platform it is intended for and what libraries it needs
>>> >> >> and the headers it needs to include.
>>> >> >>
>>> >> >> For me it fails to compile as a c program because it has no
>>> >> >> idea that some of the types are
>>> >> >>
>>> >> >> On 24 July 2014 10:07:43 BST, Rajib Bandopadhyay
>>> >> >> <bkpsusmitaa at gmail.com>
>>> >> >> wrote:
>>> >> >>>Dear Mr. Norton,
>>> >> >>>I have just the code, from the informed link. The field is
>>> >> >>>game  theory.
>>> >> >>>Regards
>>> >> >>>
>>> >> >>>On 24/07/2014, Ian Norton
>>> >> >>><ian.norton-badrul at thales-esecurity.com>
>>> >> >>>wrote:
>>> >> >>>> Ok,  What kind of project did you create? A C Console project?
>>> >> >>>>
>>> >> >>>> On Thu, Jul 24, 2014 at 09:41:06AM +0100, Rajib Bandopadhyay
>>> >> >>>> wrote:
>>> >> >>>>> Dear Mr. Norton, I am trying to just use Monodevelop to
>>> >> >>>>> build and
>>> >> >>>run
>>> >> >>>>> the C program? Regards
>>> >> >>>>> Rajib Bandopadhyay
>>> >> >>>>>
>>> >> >>>>> On 24/07/2014, Rajib Bandopadhyay <bkpsusmitaa at gmail.com>
>>> >> >>>>> wrote:
>>> >> >>>>> > Dear Mr. Norton,
>>> >> >>>>> > Could you please visit the original link provided with my
>>> >> >>>>> > first
>>> >> >>>post?
>>> >> >>>>> > Eager to receive your solution.
>>> >> >>>>> > Regards
>>> >> >>>>> > Rajib Bandopadhyay
>>> >> >>>>> >
>>> >> >>>>> > On 24/07/2014, Ian Norton
>>> >> >>>>> > <ian.norton-badrul at thales-esecurity.com>
>>> >> >>>>> > wrote:
>>> >> >>>>> >> Hi Rajib,
>>> >> >>>>> >>
>>> >> >>>>> >> Well the source you attached has some bits missing. (it
>>> >> >>>>> >> has
>>> >> >>>define
>>> >> >>>>> >> rather
>>> >> >>>>> >> than
>>> >> >>>>> >> #define)
>>> >> >>>>> >>
>>> >> >>>>> >> Ian
>>> >> >>>>> >>
>>> >> >>>>> >> On Thu, Jul 24, 2014 at 09:16:49AM +0100, Rajib
>>> >> >>>>> >> Bandopadhyay
>>> >> >>>wrote:
>>> >> >>>>> >>> Thank you for emailing, Mr. Norton! As I have informed
>>> >> >>>>> >>> in my
>>> >> >>>earlier
>>> >> >>>>> >>> email (along with link) I am trying to run this program
>>> >> >>>>> >>> written
>>> >> >>>in c
>>> >> >>>>> >>> (and correct, as per poster, who is a Tenured Prof. in
>>> >> >>>>> >>> the
>>> >> >>>>> >>> UK)
>>> >> >>>in
>>> >> >>>>> >>> Mono.
>>> >> >>>>> >>> If I am successful in running the program (with your
>>> >> >>>>> >>> support)
>>> >> >>>>> >>> I
>>> >> >>>will
>>> >> >>>>> >>> be in a position to study the various aspects of Game
>>> >> >>>>> >>> theory.
>>> >> >>>>> >>> Regards,
>>> >> >>>>> >>> Rajib Bandopadhyay
>>> >> >>>>> >>>
>>> >> >>>>> >>> On 24/07/2014, Ian Norton
>>> >> >>><ian.norton-badrul at thales-esecurity.com>
>>> >> >>>>> >>> wrote:
>>> >> >>>>> >>> > Are you trying to compile a c program (that looks
>>> >> >>>>> >>> > full of
>>> >> >>>errors)
>>> >> >>>>> >>> > with
>>> >> >>>>> >>> > monodevelop as a c# assembly?
>>> >> >>>>> >>> >
>>> >> >>>>> >>> > Can you describe the steps you take in setting up the
>>> >> >>>>> >>> > project?
>>> >> >>>>> >>> >
>>> >> >>>>> >>> > On 24 July 2014 08:30:37 BST, Rajib Bandopadhyay
>>> >> >>>>> >>> > <bkpsusmitaa at gmail.com>
>>> >> >>>>> >>> > wrote:
>>> >> >>>>> >>> >>I am very new to Mono. I wish to run a program on
>>> >> >>>>> >>> >>Prisoner's  Dilemma in Mono. The program is attached.
>>> >> >>>>> >>> >>The file is originally  from
>>> >> >>>:
>>> >> >>>>> >>> >>http://www.kasprzyk.demon.co.uk/www/alife/dilemma.htm
>>> >> >>>>> >>> >>l
>>> >> >>>>> >>> >>The IDE reports:
>>> >> >>>>> >>> >>Build successful.
>>> >> >>>>> >>> >>Build failed. Object reference not set to an instance
>>> >> >>>>> >>> >>of  an
>>> >> >>>object
>>> >> >>>>> >>> >>
>>> >> >>>>> >>> >>Conflicting outputs are confusing. Could anyone
>>> >> >>>>> >>> >>please  suggest
>>> >> >>>where
>>> >> >>>>> >>> >> I
>>> >> >>>>> >>> >>am going wrong?
>>> >> >>>>> >>> >>Regards,
>>> >> >>>>> >>> >>Rajib Bandopadhyay
>>> >> >>>>> >>> >>
>>> >> >>>>> >>> >>
>>> >> >>>>> >>> >>
>>> >> >>>>> >>> >>================================
>>> >> >>>>> >>> >>             Mono Version Information
>>> >> >>>>> >>> >>================================
>>> >> >>>>> >>> >>MonoDevelop 3.0.3.2
>>> >> >>>>> >>> >>Installation UUID:
>>> >> >>>>> >>> >>8c06afc7-839d-481d-bea9-2136986f0a9c
>>> >> >>>>> >>> >>Runtime:
>>> >> >>>>> >>> >>     Mono 2.10.8.1 (Debian 2.10.8.1-8)
>>> >> >>>>> >>> >>     GTK 2.24.10
>>> >> >>>>> >>> >>     GTK# (2.12.0.0)
>>> >> >>>>> >>> >>Build information:
>>> >> >>>>> >>> >>     Git revision:
>>> >> >>>>> >>> >> 7bf6ac0ca43c1b12703176ad9933c3484c05c84c-dirty
>>> >> >>>>> >>> >>     Build date: 2012-06-22 20:57:52+0000 Operating
>>> >> >>>>> >>> >>System:
>>> >> >>>>> >>> >>     Linux
>>> >> >>>>> >>> >>     Linux Microknoppix 3.9.6 #25 SMP PREEMPT Sat Jun 15
>>> >> >>>>> >>> >> 15:27:01
>>> >> >>>CEST
>>> >> >>>>> >>> >>2013 i686 GNU/Linux
>>> >> >>>>> >>> >
>>> >> >>>>> >>> _______________________________________________
>>> >> >>>>> >>> Monodevelop-list mailing list
>>> >> >>>>> >>> Monodevelop-list at lists.ximian.com
>>> >> >>>>> >>> http://lists.ximian.com/mailman/listinfo/monodevelop-li
>>> >> >>>>> >>> st
>>> >> >>>>> >>
>>> >> >>>>> >
>>> >> >>>>> _______________________________________________
>>> >> >>>>> Monodevelop-list mailing list
>>> >> >>>>> Monodevelop-list at lists.ximian.com
>>> >> >>>>> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>>> >> >>>>
>>> >> >>
>>> >> >
>>> >
>>
>
_______________________________________________
Monodevelop-list mailing list
Monodevelop-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monodevelop-list

The information contained in this e-mail and any accompanying documents may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, please immediately alert the sender by reply e-mail and then delete this message. Any dissemination, distribution or other use of the contents of this message by anyone other than the intended recipient is strictly prohibited. R Systems has taken every reasonable precaution to minimize the risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment.


More information about the Monodevelop-list mailing list