Computing pre-release material AQA A
Computer Science and ICT discussion, revision, exam and homework help.
-
Re: Computing pre-release material AQA A
For the training game just go to line 148 and add 'M','T' and 'F'.
Just here like this.
Also would be kind of neat if there was this command that you could type in during the game to activate "Cheat Mode" if you like.Code:if Cavern[Count1][Count2] in [' ','*','M','T','F'] or ((Cavern[Count1][Count2] == 'M') and MonsterAwake.Is):
-
Re: Computing pre-release material AQA A
Oh yeah for changing the size of the map you'll probably want to scale the number of traps accordingly. To do this you'll have to use the NO_OF_TRAPS variable down in the PlayGame function as they've only coded in the activation of two traps.
Right there. I'm not so sure how you'd go about doing this but me and my computing teacher probably think that the coders delibratly didn't put NO_OF_TRAPS in the PlayGame function.Code:if not MonsterAwake.Is and not FlaskFound and not Eaten: MonsterAwake.Is = CheckIfSameCell(PlayerPosition, TrapPositions[1]) if not MonsterAwake.Is: MonsterAwake.Is = CheckIfSameCell(PlayerPosition, TrapPositions[2])
Just something to think about if you're considering implementing changeable map size. -
Re: Computing pre-release material AQA Ai think that the fact that NO_OF_TRAPS is a constant at the start of the code and yet it's not consistently used as in the example above is bound to come up in one way or another. Either as a programming task (increase the number of traps, test, find it's not as simple as changing the number, fix) or perhaps it will just be a question that does not require coding but needs you to explain why this approach isn't so good and what measures would be needed to fix it.(Original post by andythebrit)
Oh yeah for changing the size of the map you'll probably want to scale the number of traps accordingly. To do this you'll have to use the NO_OF_TRAPS variable down in the PlayGame function as they've only coded in the activation of two traps.
Right there. I'm not so sure how you'd go about doing this but me and my computing teacher probably think that the coders delibratly didn't put NO_OF_TRAPS in the PlayGame function.Code:if not MonsterAwake.Is and not FlaskFound and not Eaten: MonsterAwake.Is = CheckIfSameCell(PlayerPosition, TrapPositions[1]) if not MonsterAwake.Is: MonsterAwake.Is = CheckIfSameCell(PlayerPosition, TrapPositions[2])
Just something to think about if you're considering implementing changeable map size.
SetUpTrainingGame, LoadGame, SaveGame, PlayGame all have the number of traps hard coded to 2 and so would not work as expected if NO_OF_TRAPS was increased or decreased. In fact decreasing it to 1 makes the game crash. -
Re: Computing pre-release material AQA A
I'm using Pascal as my programming language. Me and my class know of the following:
1) Board limits validation (So player does not walk off)
2) Menu validation input
3) Case difficulties when using not a capital letter
4) Something kinda funky - CIRCULAR MODE - If player meets the boundary of the dungeon then it would go through the wall and come out at the opposite wall.
5) Difficulty settings by adding a parameter to SetUpGame and PlayGame.
6) Implementing a move counter that only counts when a valid move is done.
7) Generating a score for the player?? We thought the score could be based on how many moves you took to find the flask (score := movecounter * 5).
8) Diagonal Moves (Plus using string input, instead of char)
9) Displaying the Trap positions of the last game as a menu option.
10) Storing Name of Player and Score in a file (using records and arrays etc....)
11) Multiplayer support?? (UNLIKELY)
12) An idea of a 3D Dungeon??? (Probably going to be asked at the end of the paper)
13) Undo Move??Last edited by drackiseries; 22-03-2012 at 15:02. -
Re: Computing pre-release material AQA ATo make the game 3d all you would have to do is add a line to the cellReference dateType (structure). e.g. NoOfLevels.(Original post by Ali_1)
Do any of you think that they will ask us to make it a 3d array and we will have to make rooms up a ladder for example or not?
whereever there is a "cellsNS" or "cellsWE" assignment you would also add a "Level" assignement. I haven't been through to see if this is practical in terms of time.. But it could always be asked as a "what would you do" question.. i.e. not actually coding the solution just outlining the steps.
Hope this helps
JoeMch -
Re: Computing pre-release material AQA AI guess that does means that if there are not enough free spaces for the randomly placed objects it will go to an infinite loop? it might be worth making sure you could add a check to see if noOfTraps+3 <= (NoOfCellsNS*NoOfCellsWE)(Original post by mister c)
not sure that's right. this is from the python version. function SetPositionOfItem
while Cavern[Position.NoOfCellsSouth][Position.NoOfCellsEast] != ' ':
Position = GetNewRandomPosition()
this loops until the random position is empty. try reducing the map size to 3x2, you always get two traps.
also, if you want to see where everything is, look at the function DisplayCavern. there will be a line in there somewhere to match this python line:
if Cavern[Count1][Count2] in [' ','*'] or ((Cavern[Count1][Count2] == 'M') and MonsterAwake.Is):
so basically, if the Cavern item is a space or an * or if the monster is awake and the item is an M, it gets printed. Just update this line so that it includes all the other items. in python, that means the line starts like this:
if Cavern[Count1][Count2] in [' ','*','M','T','F']
alternatively just add another OR statement that says or True at the end or comment out that IF statement altogether. some of these methods will be easier than others depending on the language you're using.
I know you would have to have a very small grid or lots of traps but if it's possible! -
Re: Computing pre-release material AQA AIs there not a Try...Catch equivalent for Pascal? Either that, or a built in Boolean function to test if a file exists.(Original post by TipTapToe)
How would I catch the error / validate when loading from a file that doesn't exist? (in Pascal). -
Re: Computing pre-release material AQA A
^ There's Try - Except or Try - Finally. I've tried them both, but don't know exactly where to put them as I've never used the try command before.
EDIT:
Got it working using thisCode:Function FileExists(Filename: String): boolean; var f: file of byte; begin Assign(f,filename); {$I-} Reset(f); {$I+} if (IOResult = 0) then begin close(f); fileExists:=true; end else fileExists:=false; end;Last edited by TipTapToe; 24-03-2012 at 21:46. -
Re: Computing pre-release material AQA AThe vb.NET one works like this:(Original post by TipTapToe)
^ There's Try - Except or Try - Finally. I've tried them both, but don't know exactly where to put them as I've never used the try command before.
I imagine Pascal would be something like this:Code:Try [Open the file] Catch ex as Exception [Display an error message] End Try
Code:Try [Open the file]; Except [Display an error message]; end; -
Re: Computing pre-release material AQA AYep - Just edit the constant to 3 (for example). Then edit the code around line 305:(Original post by Bavsterx1495)
Has anyone managed to change the number of traps successfully in the VB code?
Add the bit in bold, and it'll work.Code:If Not MonsterAwake And Not FlaskFound And Not Eaten Then MonsterAwake = CheckIfSameCell(PlayerPosition, TrapPositions(1)) If Not MonsterAwake Then MonsterAwake = CheckIfSameCell(PlayerPosition, TrapPositions(2)) End If If Not MonsterAwake Then MonsterAwake = CheckIfSameCell(PlayerPosition, TrapPositions(3)) End If If MonsterAwake Then DisplayTrapMessage() DisplayCavern(Cavern, MonsterAwake) End If End If -
Re: Computing pre-release material AQA AAll you need to edit is the check if same cell for player position and traps. To make the number of traps editing more flexible, you can do the check using a for loop.(Original post by Bavsterx1495)
Has anyone managed to change the number of traps successfully in the VB code?
For i = 1 to NoOfTraps
MonsterAwake = CheckIfSameCell(PlayerPosition, Trappositions(i))
If MonsterAwake = True Then Exit For
Next i
This means you can even had the player decide how many traps there are.
To make the program properly support multiple traps, you need to add NoOfTraps variable to the Game Data so that you can save and load the number of traps.
This also means, ReDim TrapPositions() in the SetUPGame procedure, since LoadGame uses this procedure so that TrapPositions can hold the necessary amount of traps.Last edited by h2shin; 25-03-2012 at 20:12. -
Re: Computing pre-release material AQA AYour Code doesn't seem to work properly, at first it wont have increased the number of traps, but for some reason it does increase the traps once you have played a game and gone back to the main menu and start another game. the reason I know this is that I've edited the code to see the traps.(Original post by D-Box)
Yep - Just edit the constant to 3 (for example). Then edit the code around line 305:
Add the bit in bold, and it'll work.Code:If Not MonsterAwake And Not FlaskFound And Not Eaten Then MonsterAwake = CheckIfSameCell(PlayerPosition, TrapPositions(1)) If Not MonsterAwake Then MonsterAwake = CheckIfSameCell(PlayerPosition, TrapPositions(2)) End If If Not MonsterAwake Then MonsterAwake = CheckIfSameCell(PlayerPosition, TrapPositions(3)) End If If MonsterAwake Then DisplayTrapMessage() DisplayCavern(Cavern, MonsterAwake) End If End If -
Re: Computing pre-release material AQA A
From a previous user that entered possible change with the program... i have include some more after playing around found a few shocking things.
I need help resolving most of this...
Potential Changes to Code:
-Update the code to accept upper and lower case direction inputs
-Stop player moving off edge of map, catch the error
-Collect menu choices as char rather than integer so that they can be validated and letter entry doesn't crash the program
-Make it so an innapropriate menu entry brings up an error message
-When saving in the main menu give the option to resume the game
-Allow the player to move diagonally
-Count the number of moves taken before the player is eaten or finds the lamp and display this
-During a game press "T" to teleport, this can only be used once
-"display story" menu item
-Add an option to the menu that resumes a game if they are in save mode
-Change the size of the map
-Make it so selecting to load a non-existent file doesn't crash the program
Problems i found
-Once you win the game and return to the main, then save the file and re-load the file that was saved, the game is was won, can still play without a flask
-If you lose the game return home, then save and re-load your still able to play the game alive and not eaten, also the monster is awake again
-add an option to show all the saved files so it can be selected and prevent saved file form being over written, if the save has the same name as another file the exist.
-Changing the quit option to option 5 instead of 9
-change difficult levels by allowing more movement for the monster