• YOU can help the next generation of students in the community!
    Share your trial papers and notes on our Notes & Resources page

Comp 1011 Assignment 2 (2 Viewers)

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
tim is a total liar!!

he said it's as easy and around the same size as pronounce.......BS!!

this is like 5 times the size
 

cyrax83

discrete is killing me :(
Joined
Nov 18, 2002
Messages
376
Gender
Male
HSC
2003
someone create another different version and start up an auction to sell it, they'll make $$ !!
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
can u explain to me how i would go about writing checkSuggestion? pretty please!

oh btw, having same variable/function names won't make a difference. i found out how that gay plagarism detector works.

It checks the runtime for your assignment and compares it with other peoples. typically you'd almost never have the same runtime as another person as the functions all work at different speed depending on how u implement it. which is why he says chaning variable names won't work since that doesn't increase or decrease the runtime of your program.

Then it checks structure. but you'd be brain dead to copy someone else's code exactly in every way..

then it does some other fancy stuff cbf explaining. 5th year masters student told me how it works haha
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
lol if you know a 5th year masters, just ask him/her to do the assign for you!

ok firstly my function name "checkSuggestion" was a bit abstract lol....i've renamed it to 'findDisprover' now HEHE

but can you be a bit more specific as to where you are stuck? i can example the logic and how to go about solving it
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
hmm i want to try it myself but im not sure what type signatures to use. e.g. checkSuggestion :: blah -> blah -> blah

can u tell me that? i don't think that would cause any problems..
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
ok my game logic is that the player gives their suggestion

that suggestion has 2 possibilities....
1. it is the same as the answer which means there are no one to disprove it....hence it will just go to next game
2. it's not the same as the solution! then there MUST be someone with a disproving card

now if there is a disproving player and card, then all you have to do is find that player and the card....put it back into -> (Maybe (Player,Action), Maybe (PlayerID,Card), Maybe CluedoGame)

and continue on....

only problem is finding the correct player and their card

for now just ignore whisper/inform! first get the game working and then implementing whisper/inform is very easy!
 
Last edited:

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
hmm but say i manage to write a fuction that works to check the suggestion, i can't implement it into the tuple so that it matches with the type signature...

i.e. in the step function,

step :: CluedoGame -> (Maybe (Player, Action), Maybe (PlayerID,Card), Maybe CluedoGame)

I can't implement that check suggestion function so that it works with the type signature of Maybe (PlayerID,Card)...
 

enak

Limbo
Joined
Oct 18, 2002
Messages
1,046
Location
Sydney
Gender
Undisclosed
HSC
N/A
How do we check if its right?
so make stage1w should have the same output as make demow?
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
Originally posted by Ragerunner
hmm but say i manage to write a fuction that works to check the suggestion, i can't implement it into the tuple so that it matches with the type signature...

i.e. in the step function,

step :: CluedoGame -> (Maybe (Player, Action), Maybe (PlayerID,Card), Maybe CluedoGame)

I can't implement that check suggestion function so that it works with the type signature of Maybe (PlayerID,Card)...
yep that was a pain in the arse to do!!
spent a couple of hours just to do that!!

all you have to do is find the playerID and the Card....put it into a truple

getDisprove :: Action -> [listofplayers] -> (PlayerID,Card)

as you want to put
(Just (pl, play pl), Just (TRUPLE FROM GETDISPROVE), Just (CdG CluedoGame))
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
Originally posted by enak
How do we check if its right?
so make stage1w should have the same output as make demow?
technically no stage1w answer doesn't have to be 100% the same as demow

my version is not the same as demow!!

my finding disproving player is different to the demo's version...
for the demo it will take the first disproving card no matter if it is name,place,what

but my version differs in that it will go through the list in order of name -> place -> weapon

so if the list of things in the demo game is
Kheng has [David] [Clancy] [Keyboard] [Sean] [Mouse] [Burrows] [ADT]
Roland has [Alex] [Matthews] [BinaryTree] [Sara] [HelpDesk] [PolyFun] [Sarah] [LG1]
Answer is [Jocelyn] in [K17] with [BFG]

for the demo if the suggestion is
(Sarah,Matthew,BinaryTree)
the first disproving card is Matthews for the demo

but for MY version it will be Sarah because i search in the order of names -> places -> weapon....

now technically it is still following rules within cluedo...so they can't mark me wrong....i hope so anyway
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
hmm ok thanks...

now to spend the next 10 hours trying to write the getDisprove bit.... *pours 5 cups of coffee*

how many lines of code did it take for you to write that getDisprove function?
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
Originally posted by Ragerunner
hmm ok thanks...

now to spend the next 10 hours trying to write the getDisprove bit.... *pours 5 cups of coffee*

how many lines of code did it take for you to write that getDisprove function?
around 11....but 16 if you count after i fixed my style
as it passed the 80character per line limit...i had to go into the next line for some parts
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
bah fucking can't do it :(

brb, jumping off a cliff.....
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
ar 100% finished coding with 11 functions
229 lines
max 80 characters except in 2 lines which

around 50% comments....

so around 110 lines of actual code!

it's not hard rage!! trial and error!

to get the disproving card i first found the first player who actually had the disproving card.....and then use filters on their cards to pick the right card

there's heaps of other ways to do this, i tried maybe functions and that kinda worked but i had problems....so i re-wrote it using filters
 

Ragerunner

Your friendly HSC guide
Joined
Apr 12, 2003
Messages
5,472
Location
UNSW
Gender
Male
HSC
2003
well the thing is, im not up to the suggestion part.

IM STILL STUCK IN THE ACCUSATION PART >.<

like...

if the accusation is correct then win game....if it's incorrect then player gets invalidated.....i can't even do that....rips hair out!!

programming just aint my thing :(
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
ok relax!

although this is one of the easiest parts
don't worry it's different for everyone
you might find the other parts easier!
like i found inform/whisper easier, others found it the hardest...

ok accusation
2 possibilities......either the player is right or they are wrong

if wrong then the result would be

(Just (pl,play pl), Nothing, just (new game))

if they are right then,
(just (pl, play pl),Nothing,Nothing)

the this is that did you add in a variable in newGame for if the players are dead or alive??

very import step!

enormous tip, practically giving away my code

(Just (pl,play pl),Nothing,Just (CdG (pls ++ [(pl,cards,THIS MOTHER F*#% IS DEAD)]) ans)
 

Constip8edSkunk

Joga Bonito
Joined
Apr 15, 2003
Messages
2,397
Location
Maroubra
Gender
Male
HSC
2003
every1 is using the boolean method...think i'll convert..... (what i did was i had a changed CluedoGame so that it cycled through a list of only players(that is alive) to play and kept the player, cards list static... though its somewhat shorter in linelength....dun think its better style though:( )

yeah for checking suggestions for disproval, i started with a longarsed recursion(prolly the easiest to write), then used elem.... now im using filter

i have 8 functions but i need to find a way to split up this mega block of a function i used to create a new game state which is 16 lines by itself including a 10 line where clause ><

when you have type signature problems with all the maybe's around, you can use fromJust imported from Maybe.hs to remove the Just infront
 
Last edited:

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
oh so that's how you get rid of the fukin Just infront of the stuff!!!

if only i had known 2days ago!! wouldn't have had to re-write everything...
 

redslert

yes, my actual brain
Joined
Nov 25, 2002
Messages
2,373
Location
Behind You!!
Gender
Male
HSC
2003
i was the same couple of days ago!

now i am studying calculus instead!
test on monday and i'm doomed!
 

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

Top