Comp 1011 Assignment 2 (1 Viewer)

cyrax83

discrete is killing me :(
Joined
Nov 18, 2002
Messages
376
Gender
Male
HSC
2003
Originally posted by Ragerunner
YAY!!!

Ok back to this topic....Someone help me START this assignment....I mean I don't have a CLUE what to put as my first line of code.... :cries:
dibs on asking ragey first when he gets it
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
So anyone know how to do it now? LoL...

I still don't even know how to write up newGame....

I need help!

I can't even compile the sample game...
 

McLake

The Perfect Nerd
Joined
Aug 14, 2002
Messages
4,187
Location
The Shire
Gender
Male
HSC
2002
Originally posted by Ragerunner
I can't even compile the sample game...
Your tutor can't work this out either. I suggest emailing him over and over. Tell him Michael told you to do that.
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
Well I'm more concerned about how to start the assignment...

I don't have a clue what to write in the newGame function :(
 

Lazarus

Retired
Joined
Jul 6, 2002
Messages
5,965
Location
CBD
Gender
Male
HSC
2001
Originally posted by Ragerunner
Laz, are you gonna be my tutor for next year COMP2041 if I transfer to it?

If so that's gonna feel sooooooooooooo weird haha :D
Hahah! I'm not sure... :)
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
Soo.....Is everyone is still clueless about stage 1 of the assignment...
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
I CAN'T START THE ASSIGNMENT BECAUSE GHEY REDHAT WITH CGYWIN IS DOWN!!!

soooooooo dam annoying and i'm pissed off wasting more time trying to get make working instead of doing the assignment!

i can't start because i have no idea how to start and i want to compile the demo so i know wtf is going on!!!!!

end rant...
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
Don't bother with the make file at the moment. All it does is show how the game is supposed to be like. I'll copy and apste you the result of running Cluedo.exe

-----------------------

#Kheng: I think it was [Sarah] in [Burrows] with [BinaryTree].
#Roland: I can disprove your suggestion.
#Roland shows [Sarah] to #Kheng

#Roland: I think it was [David] in [Clancy] with [Keyboard].
#Kheng: I can disprove your suggestion.
#Kheng shows [David] to #Roland

#Kheng: I think it was [Sara] in [Burrows] with [BinaryTree].
#Roland: I can disprove your suggestion.
#Roland shows [BinaryTree] to #Kheng

#Roland: I think it was [Sean] in [Clancy] with [Keyboard].
#Kheng: I can disprove your suggestion.
#Kheng shows [Clancy] to #Roland

#Kheng: I think it was [Sara] in [Burrows] with [PolyFun].
#Roland: I can disprove your suggestion.
#Roland shows [Sara] to #Kheng

#Roland: I think it was [Sean] in [Burrows] with [Keyboard].
#Kheng: I can disprove your suggestion.
#Kheng shows [Keyboard] to #Roland

#Kheng: I think it was [Alex] in [Burrows] with [PolyFun].
#Roland: I can disprove your suggestion.
#Roland shows [PolyFun] to #Kheng

#Roland: I think it was [Sean] in [Burrows] with [Mouse].
#Kheng: I can disprove your suggestion.
#Kheng shows [Sean] to #Roland

#Kheng: I think it was [Alex] in [Burrows] with [ADT].
#Roland: I can disprove your suggestion.
#Roland shows [Alex] to #Kheng

#Roland: I think it was [Jocelyn] in [Burrows] with [Mouse].
#Kheng: I can disprove your suggestion.
#Kheng shows [Mouse] to #Roland

#Kheng: I think it was [Jocelyn] in [Burrows] with [ADT].
The crowd is silent.
#Roland: I think it was [Jocelyn] in [Burrows] with [ADT].
The crowd is silent.
#Kheng: It was [Jocelyn] in [Burrows] with [ADT]!
#Kheng wins the game.


--------------------------------------------

So basically, you need to make stage one so it does all that -__-
 

Constip8edSkunk

Joga Bonito
Joined
Apr 15, 2003
Messages
2,397
Location
Maroubra
Gender
Male
HSC
2003
haha i just finished reading the specs... damn im confused... maybe i should have payed attention in the lectures last week
oh well.....


*kicks cygwin's site
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
All you get is the Cluedo.exe file..

And when you open the exe file all you get is what I just posted above...It's just to show you what the game is supposed to look like..

Then I said...ohhhh so that's how it is....then I looked at the "step" function and I'm like....oh WTF?
 

Constip8edSkunk

Joga Bonito
Joined
Apr 15, 2003
Messages
2,397
Location
Maroubra
Gender
Male
HSC
2003
Thanks Mate!

yeah i installed ghci 6.2 months ago so i uninstalled that and installed ghc 6.0.1 but when i try make it still tells me i use 6.2....... i gave up after a couple hrs of trying... i still havent stated working on the actual assignment yet.... bah

Originally posted by redslert
I CAN'T START THE ASSIGNMENT BECAUSE GHEY REDHAT WITH CGYWIN IS DOWN!!!

soooooooo dam annoying and i'm pissed off wasting more time trying to get make working instead of doing the assignment!

i can't start because i have no idea how to start and i want to compile the demo so i know wtf is going on!!!!!

end rant...
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
I was same as you...

I installed 6.2...

Then installed 6.0.1.....then installed 6.0....then re-downloaded 6.0.1 from the CSE site....all didn't work..:(

Thank god I got unlimited downloads..
 

cyrax83

discrete is killing me :(
Joined
Nov 18, 2002
Messages
376
Gender
Male
HSC
2003
have you guys tried in cygwin make stage1w ?
or make demow.

hmm without the 'w' it doesn't seem to work for me and i get an error

and hmm yeah, i have no clue now =/ i dont want to get 0 :(
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
Don't worry, we will get 4 marks for the 2 diaries put together :D
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
wtf is going on

ok make newGame....

from what i have been hearing there is already a function in the thing which shuffles the cards for each player and deals it out

but where the fuck is that?! i can't see it in any of the files....

newGame is the easy bit eh?! HAHHAHA i can't even do that...guess i just have to live with the 4marks for full bs and complaints in teh diary
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
I got some help from my tutor, which didn't help that much. Perhaps you can help explain it?

---------------------------------------


> Let's say for the newGame function...you've got:
>
> newGame pls ans = CdG pls ans
>
> What am I meant to put to finish the function off? As in, what am I meant
> to be doing exactly?

First of all, you will need to set up your 'CludeoGame' data type.
Somewhere in your code, you will have something like:

data CludeoGame = CdG (???)

First of all, notice the name "CdG". It is useless. Replace it with
something more usefull. ("CludeoGameADT", perhaps?)

After the name of your data-type, you must specify what information you
need to store between turns. By default, you have:

data CluedoGame = CdG [(Player,[Card])] Triple

This means you are specifying that your CludeGame data-type will store a
list of players and the cards the are holding, as well as the solution.

You may wish to store other information as well, such as whose turn it
currently is and/or perhaps what happened in the last turn.

For debugging purposes, you will also certainly want to add the line:

data CluedoGame = CdG [(Player,[Card])] Triple
deriving (Show, Eq, Read)


'newGame' basically just sets up your CludeoGame data type, and returns
it to 'Cludeo.hs'. Cludeo.hs will then repeatably call 'step', giving
'step' your data-type, and getting a new one.


newGame :: [(Player,[Card])] -> Triple -> CluedoGame
newGame pls ans = CdG pls ans

All 'newGame' in its current format does is get the list of players and
cards, get the solution, and shove them into the default (insufficient)
CludeoGame data type.

So the code is basically saying:

newGame pls ans = CdG pls ans
^ ^ ^
| | |
| | +-- Create a new data-type 'CdG' (which is a
| | CludeoGame) and set its values to 'pls' and
| | 'ans'.
| |
| +---- Save the answer in the variable 'ans'
|
|
+-------- Save the players in the variable 'pls'


> What am I meant to put to finish the function off? As in, what am I meant
> to be doing exactly?

So, to answer your question, you must:

1. Define your own CludeoGame data-type. (Or just modify the current
one)

2. Change 'newGame' so it sets up and returns your CludeoGame data-type
in a state ready to given to 'step'.











> So basically what I need to do for newGame is to store all the details for
> all the players? e.g. Roland has cards K17,David,Mouse,Matthews,BFG
> and Kheng has cards Sara,Keyboard,Clancy etc... ?

Correct. As well as any other information you need to keep the game
running. (For example, you might want to remember that player "Bob" made
an accusation and was wrong, so he is out of the game, and that it is
Alice's turn next.)














> newGame :: [(Player,[Card])] -> Triple -> CluedoGame

This is the function signature. It is written in the spec. You can not
change it.

> newGame pls ans = CluedoGameADT pls ans

This is the line of code you need to rewrite.

Perhaps an example is in order.

Lets say I have a data-type 'Car':

type NumberPlate = String
type KilometersTravelled = Int
type CarAccidents = Int
type PedestriansHit = Int

data Car = CarADT NumberPlate KilometersTravelled CarAccidents PedestriansHit

I could then write a function, 'newCar':

newCar :: NumberPlate -> Car
newCar plateNumber
= CarADT plateNumber 0 0 0

I could then write some functions to do things to my car:

getNumberPlate :: Car -> NumberPlate
getNumberPlayer (CarADT plateNumber _ _ _)
= plateNumber

hitPedestrian :: Car -> Car
hitPedestrian (CarADT plateNumber kmTravelled accidents pedestriansHit)
= (CarADT plateNumber kmTravelled accidents (pedestriansHit + 1))

(And so on)

Basically, all 'newCar' does is creates a Car data-type which can then
be used in my other functions.

All 'newGame' does is creates a 'CludeoGame' data-type which can then
be used in Cludeo's other functions, such as 'step'.


-------------------------------------------------------------
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top