The Student Room Group

Computing pre-release material AQA A

Scroll to see replies

Reply 380
For VB.net when using a function that doesn't need parameters should you write empty brackets,
So
Console.ReadLine

Or
Console.ReadLine()

or does it really not matter?
Reply 381
Original post by JoeUtd
Can someone give an example for the following in Monster?

Fixed Value
Stepper
Most Recent Holder
Most Wanted Holder
Gatherer
Follower
Temporary

Anyone? Usually a question on it.
Reply 382
Original post by jon889
For VB.net when using a function that doesn't need parameters should you write empty brackets,
So

Or

or does it really not matter?


You need the brackets or it won't work.
This is to anyone using Java for the exam:

private boolean checkValidMove(CellReference playerPosition, char direction) {
boolean validMove;
validMove = true;
if (!(direction == 'N' && playerPosition.noOfCellsSouth > 1 ||
direction == 'n' && playerPosition.noOfCellsSouth > 1 ||
direction == 'S' && playerPosition.noOfCellsSouth <7 ||
direction == 's' && playerPosition.noOfCellsSouth <7 ||
direction == 'W' && playerPosition.noOfCellsEast > 1 ||
direction == 'w' && playerPosition.noOfCellsEast > 1 ||
direction == 'E' && playerPosition.noOfCellsEast <7 ||
direction == 'e' && playerPosition.noOfCellsEast <7 ||
direction == 'M'||
direction == 'm' )) {
validMove = false;
{
console.println("ERROR! Please choose a valid move");
}

}
return validMove;

This is the correction to the boundary error, if anyone else has some code to other problems please could you upload it thanks
Reply 384
Original post by mathieuh
You need the brackets or it won't work.


It works if you are assigning the return value to a variable:

Dim temp As String
temp = Console.ReadLine

But if you're doing just
Console.ReadLine, then Visual Studio automatically and forces the brackets. (you readline at the end of the program so you the console doesn't close, and you can get a screenshot)
But in the markschemes for pastpapers there are no brackets, and also the markschemes don't include a Console.ReadLine() at the end of the program (which is needed to get screenshots, although not included in the algorithm given)

I'd much prefer to have the brackets as it makes it clear you're calleda function/sub-routine, rather than a property or variable
Reply 385
Original post by xDanny 117
Why do I have to do the programming language no one else does - python.

Good luck all tomorrow!


I'm doing python! What modifications have you made to the pre-release? :smile:
Original post by ElMoro
Really not ready with this exam :frown:



Mate, since you're doing python would you mind telling what kinds of changes you've made to the pre-release and how you've done them, please? I would really really appreciate it :smile:


These are the changes I made:

Different directions of movement e.g SW, NW.

Fixed the crash when a letter or nothing is entered in the main menu.

Added validation in the CheckValidMove function to prevent the player walking off the map.

Added the ability for more traps to be added to the game.

Incorporated more traps into the save and load game function.

Stopped the program from crashing when loading a game that does not exist.

Auto capitalisation of user inputs when imputing moves.



These are ones that I can remember I have done and are realistically going to appear. If you need any help just ask :smile:.
Reply 387
Anyone figured out a way to resume the game?

The solution in the Wikibook doesn't seem very good, and doesn't work properly, for example you can resume even if the game is over.

I'm using VB

help would be appreciated
Reply 388
Original post by JoeUtd
Anyone? Usually a question on it.


most recent holder flask position
stepper count1
fixed variable NSDistance
fixed value role const
most wanted holder cavern

that's what I got couldn't find follower though :/
Reply 389
Original post by jon889
It works if you are assigning the return value to a variable:

Dim temp As String
temp = Console.ReadLine

But if you're doing just
Console.ReadLine, then Visual Studio automatically and forces the brackets. (you readline at the end of the program so you the console doesn't close, and you can get a screenshot)
But in the markschemes for pastpapers there are no brackets, and also the markschemes don't include a Console.ReadLine() at the end of the program (which is needed to get screenshots, although not included in the algorithm given)

I'd much prefer to have the brackets as it makes it clear you're calleda function/sub-routine, rather than a property or variable


Interesting, thanks. In any other language I can think of you need the brackets. I agree it's probably best to put them in anyway even if they aren't required.
Reply 390
Original post by JoeUtd
Can someone give an example for the following in Monster?


Fixed Value - There isn't really a fixed value variable here, but it does use constants. If it asks for a constant then NoOfTraps, NSDistance or WEDistance
Stepper - Count1 Count2 or i
Most Recent Holder - Choice, FileName or Move
Most Wanted Holder - I'm not too sure here, but you could maybe argue MonsterAwake is a most wanted holder
Gatherer - Couldn't find one
Follower - NewCellForFlask/FlaskPosition
Temporary - Move, Choice
Original post by Poloxide
Anyone figured out a way to resume the game?

The solution in the Wikibook doesn't seem very good, and doesn't work properly, for example you can resume even if the game is over.

I'm using VB

help would be appreciated


My alternate solution to this would be to make a temporary save which would be loaded when resuming the game. This would be much more simple in my opinion.
Reply 392
Original post by Poloxide
Anyone figured out a way to resume the game?

The solution in the Wikibook doesn't seem very good, and doesn't work properly, for example you can resume even if the game is over.

I'm using VB

help would be appreciated


the code on wikibooks works but u need to use try and catch to stop it resuming a game when it is over
Reply 393
I put links to my revision notes here (in PDF and GDocs), if you scroll to the bottom I put a table with all the roles of variables, and the type returned and role of all the sub-routines, you're welcome to use them if you want.
Reply 394
Original post by JoeUtd
Anyone? Usually a question on it.


Take a look at past markschemes, and the textbook.

But I'd guess (please corrct me if I'm wrong):

Dim MostRecent As Integer
Dim MostWanted As Integer
Dim Count As Integer = 0
For Index = 1 To 10
If index > MostWanted Then
MostWanted = Index
End If
MostRecent = Index
Count += 1
Next

Where Index is a Stepper
MostWanted is a Most Wanted Holder (imagine for loop is going through an array (rather than the integers 1 To 10), of unordered values and wants to retrieve the biggest)
MostRecent is the Most Recent Holder (you can use this to compare the current index, to the previous index)
Count is a Gatherer (a better example would be looping through an array of strings, and then checking each string to see if it starts with 'A', if it does add it to a seperate array to hold only string that start with 'A', the seperate arrray being the gatherer)
The other's I'm not sure how to explain.
Reply 395
Original post by I_Am_The_Man
My alternate solution to this would be to make a temporary save which would be loaded when resuming the game. This would be much more simple in my opinion.


There was a discussion on this a while ago. It's not necessary to have a temporary save, just use the current held values. You can add a boolean variable InProgress and set this to false if a game ends and set it to true once you set up a new game, then it's easy to stop resuming game if there no game in progress.
Reply 397
Original post by sl96
the code on wikibooks works but u need to use try and catch to stop it resuming a game when it is over


Yes but there isn't an error so this wouldn't work...

It just carries on playing even if the player is dead or the flask is found.
Reply 398
Original post by D-Box
Fixed Value - There isn't really a fixed value variable here, but it does use constants. If it asks for a constant then NoOfTraps, NSDistance or WEDistance
Stepper - Count1 Count2 or i
Most Recent Holder - Choice, FileName or Move
Most Wanted Holder - I'm not too sure here, but you could maybe argue MonsterAwake is a most wanted holder
Gatherer - Couldn't find one
Follower - NewCellForFlask/FlaskPosition
Temporary - Move, Choice


Nice one cheers.
Original post by I_Am_The_Man
These are the changes I made:


Different directions of movement e.g SW, NW.

Fixed the crash when a letter or nothing is entered in the main menu.

Added validation in the CheckValidMove function to prevent the player walking off the map.

Added the ability for more traps to be added to the game.

Incorporated more traps into the save and load game function.

Stopped the program from crashing when loading a game that does not exist.

Auto capitalisation of user inputs when imputing moves.



These are ones that I can remember I have done and are realistically going to appear. If you need any help just ask :smile:.


For different directions of movement, what did you do? I did:

if Direction == 'SW':
PlayerPosition.NoOfCellsSouth +=1 and PlayerPosition.NoOfCellsEast -=1

However when I run the program, I get "invalid syntax" over the '-=1' part.

Quick Reply

Latest

Trending

Trending