The Student Room Group

AQA COMP1 Dice cricket JUNE 2011 HELP!

Can someone confirm what is meant to happen to the function of saving csv? If you load topscores there are four players. Now if two new people play and get two new highscores its meant to replace the lowest scores on the topscores file right? But is it meant to replace it temporarily just in while your playing the game? for example say if ur playing and get 2 topscores during the game it will replace the lowest topscores, but once you quit the game those topscores are gone. Now i want to know do you need to replace the new topscores on the actual textfile?? like i said before if i get a topscore and quit the game, is it possible to store the new topscores on the actual hiscores.txt file?? so when you start a new game next time and load the topscores it will have you in the file? Does that need to happen? If so how?? Please help! Thanks
Reply 1
Nobody can confirm this one way or the other. It all depends on what you get asked to do in the exam an only the people at the exam board know that.
It is possible that you may be asked to write a save routine, possibly as an additional menu option. If you search this site there are already several threads about this exam and lots of suggestions as to what may or may not come up on the exam.
Reply 2
Original post by sagederby
Nobody can confirm this one way or the other. It all depends on what you get asked to do in the exam an only the people at the exam board know that.
It is possible that you may be asked to write a save routine, possibly as an additional menu option. If you search this site there are already several threads about this exam and lots of suggestions as to what may or may not come up on the exam.



Ok thanks but couldnt find a thread that talks about this! Do you knw how to create a sub routine to save to actual file? or you got a link? Please post!
Thanks
Reply 3
Hi here is my save sub if you want to take a look

Sub saveTopScores(ByRef TopScores() As TTopScore)
Dim file As New System.IO.StreamWriter("HiScores.txt")
For i = 1 To MaxSize
file.WriteLine(TopScores(i).Name + "," + TopScores(i).Score.ToString())
Next i
file.Close()
End Sub


hope that helps
Reply 4
Original post by DownMoney
Hi here is my save sub if you want to take a look

Sub saveTopScores(ByRef TopScores() As TTopScore)
Dim file As New System.IO.StreamWriter("HiScores.txt")
For i = 1 To MaxSize
file.WriteLine(TopScores(i).Name + "," + TopScores(i).Score.ToString())
Next i
file.Close()
End Sub


hope that helps


Yep helps alot but does this replace the actual csv text file with the lastest top scores? or does it just replace it temporarily in the game?
Thanks
Reply 5
Let me know if you're doing it in Pascal and I can help/we can help each other. :smile:
Reply 6
Original post by mujahid_e3
Yep helps alot but does this replace the actual csv text file with the lastest top scores? or does it just replace it temporarily in the game?
Thanks


It replaces the file with the scores in the TopScores table, you probably need to sort it before you save it. If you want I can post that sub is well.
Reply 7
Original post by mujahid_e3
Ok thanks but couldnt find a thread that talks about this! Do you knw how to create a sub routine to save to actual file? or you got a link? Please post!
Thanks

Try these links
http://www.thestudentroom.co.uk/showthread.php?t=1566252

http://en.wikibooks.org/wiki/A-level_Computing/AQA/Problem_Solving,_Programming,_Data_Representation_and_Practical_Exercise/2011_Exam

The second one has lots of useful material about the skeleton program and the theory side of the exam.
Reply 8
Original post by Toppy
Let me know if you're doing it in Pascal and I can help/we can help each other. :smile:


Sorry doing it in VB but anyway feel free to contribute
Reply 9
Original post by DownMoney
It replaces the file with the scores in the TopScores table, you probably need to sort it before you save it. If you want I can post that sub is well.


Yes please do help me on that, i've been trying to figure it out this weekend but couldnt... I copied your other sub bit and it replaces the top scores file temporarily within the game,E.g: These are current topscores
Ricky,12
Sachin,45
Brian,2
Monty,1

I press option one and play newscores are now:
Ricky,12
Sachin,45
A,7
B,4

But this is only temporary once i press 9 and go to te hiscores.txt file in my documents i see that scores havent changed? Whats meant to happen? Is my new scores of a, b meant to be replaceing brian and monty? if so help

Thanks

Quick Reply

Latest

Trending

Trending