Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta

AQA Computer Science 2016 ~ COMP 1 Tasks (VB.net) watch

Announcements
    • Thread Starter
    Offline

    1
    ReputationRep:
    Hey there, for anyone struggled with ideas for revision for the AQA Computer Science exam on Battleships coming up on Monday, I have attached a series of example questions they could ask you about the code. An almost certain question they will ask you is to fix the GetRowColumn sub routine to ensure it does not crash when an invalid input has been entered (Understanding try or catch exceptions is not required).

    The answers are also there, but I urge you to have a go at programming before you check the answer - remember in the exam there are multiple 'method' marks available.

    Best of luck to you all in the exam, if anyone else has any questions about the exam, I also have learnt and understand the program in Python and Java. So feel free to ask any questions or concerns about the COMP 1 (or perhaps COMP 2) exam .

    ================
    P.s. Just a useful tip, for the randomization of the positions on ships, it is not actually initialized in the program, and so in VB.net, all you need to do is add Randomize() into the PlaceRandomShips sub routine
    ================

    Edit: I am currently trying to respond but I still need moderator approval, sorry guys :/
    Attached Files
  1. File Type: docx Tasks to plan and create.docx (15.1 KB, 276 views)
  2. File Type: docx Tasks to plan and create (Answers).docx (51.2 KB, 244 views)
    Offline

    2
    ReputationRep:
    do you have any potential questions for the comp2 exam? thanks
    Offline

    0
    ReputationRep:
    Hi, thanks a lot for the questions!

    I've tried out your solution to the difficulty problem but found that it doesn't work as if you set the difficulty to hard and attempt to start a game the program will crash because there are still lines in the program that identify positions in the array that doesn't exist, since the array was shortened by ReDim... I'm not sure how to fix it, help would be appreciated!

    Thank you
    • Thread Starter
    Offline

    1
    ReputationRep:
    (Original post by katiealex99)
    do you have any potential questions for the comp2 exam? thanks
    There is always the specimen questions which are available here. I would recommend having a full go at both Paper 2 Specimen papers, and ensure to learn some key points from the 9 mark questions to help you with the 9 mark question coming in the exam.

    Other than that, attached is a collection of past papers for paper 2, along with word documents indicating which questions to do as many from the old specimen no longer apply to our new specimen.

    Anything else let me know.
    Offline

    7
    ReputationRep:
    (Original post by Nouie)
    Hey there, for anyone struggled with ideas for revision for the AQA Computer Science exam on Battleships coming up on Monday, I have attached a series of example questions they could ask you about the code. An almost certain question they will ask you is to fix the GetRowColumn sub routine to ensure it does not crash when an invalid input has been entered (Understanding try or catch exceptions is not required).

    The answers are also there, but I urge you to have a go at programming before you check the answer - remember in the exam there are multiple 'method' marks available.

    Best of luck to you all in the exam, if anyone else has any questions about the exam, I also have learnt and understand the program in Python and Java. So feel free to ask any questions or concerns about the COMP 1 (or perhaps COMP 2) exam .


    ================
    P.s. Just a useful tip, for the randomization of the positions on ships, it is not actually initialized in the program, and so in VB.net, all you need to do is add Randomize() into the PlaceRandomShips sub routine
    ================
    Thank you so much for uploading this! I really appreciate this!!!!

    (Original post by nikthepolarbear)
    Hi, thanks a lot for the questions!I've tried out your solution to the difficulty problem but found that it doesn't work as if you set the difficulty to hard and attempt to start a game the program will crash because there are still lines in the program that identify positions in the array that doesn't exist, since the array was shortened by ReDim... I'm not sure how to fix it, help would be appreciated!Thank you
    Since the solution in the answer document didn't randomize the ships but rather the position, I may be able to post my solution here.

    I just declared a difficulty variable and set it initially to 2 (2 being normal) and going from there tbh. Works as intended. May lose marks cause it's not the efficient way of doing it and it doesn't randomize the ships so you're always gonna get that 1 type of boat etc.
    Attached Images
  3. File Type: pdf difficulty_thing.pdf (127.7 KB, 114 views)
    Offline

    0
    ReputationRep:
    (Original post by TheTechnoGuy)
    Thank you so much for uploading this! I really appreciate this!!!!



    Since the solution in the answer document didn't randomize the ships but rather the position, I may be able to post my solution here.

    I just declared a difficulty variable and set it initially to 2 (2 being normal) and going from there tbh. Works as intended. May lose marks cause it's not the efficient way of doing it and it doesn't randomize the ships so you're always gonna get that 1 type of boat etc.

    Ah thank you!

    I don't think you lose any marks in the exam for being inefficient, I thought as long as it works you get full marks
    Offline

    7
    ReputationRep:
    (Original post by nikthepolarbear)
    Ah thank you!

    I don't think you lose any marks in the exam for being inefficient, I thought as long as it works you get full marks
    yep, I hope so - I just hope it's a nice exam, last few have been nasty. Maybe because this is a new spec, they may be nice haha
    Offline

    2
    ReputationRep:
    Is this alright for question 2?
    Sub MakePlayerMove(ByRef Board(,) As Char, ByRef Ships() As TShip)
    Dim Row As Integer
    Dim Column As Integer
    Dim n As Integer = 0
    GetRowColumn(Row, Column)
    If Board(Row, Column) = "m" Or Board(Row, Column) = "h" Then
    Console.WriteLine("Sorry, you have already shot at the square (" & Column & "," & Row & ". Please try again."
    ElseIf Board(Row, Column) = "-" Then
    Console.WriteLine("Sorry, (" & Column & "," & Row & " is a miss." Board(Row, Column) = "m"
    Else
    For n = 0 To 4
    If Board(Row, Column) = Mid(Ships(n).Name, 1, 1) Then
    If Ships(n).Size > 0 Then
    Ships(n).Size -= 1
    Else
    Console.WriteLine("You sunk the " & Ships(n).Name)
    End If
    End If
    Next
    Console.WriteLine("Hit at (" & Column & "," & Row & "."
    Board(Row, Column) = "h"
    End If End Sub
    Offline

    7
    ReputationRep:
    @nikthepolarbear
    Attached Images
  4. File Type: pdf diagonal.pdf (139.3 KB, 119 views)
    Offline

    0
    ReputationRep:
    (Original post by TheTechnoGuy)
    @nikthepolarbear
    <3 <3 thank you!!
    Offline

    0
    ReputationRep:
    Anyone know how to do the torpedo in VB, the wikibook only has python and java ?
    Offline

    0
    ReputationRep:
    Sub PlayGame(ByVal Board(,) As Char, ByVal Ships() As TShip)
    Dim GameWon As Boolean = False
    Dim TorpedoUsed As Boolean = False
    Dim TorpedoChosen As Char
    Do
    PrintBoard(Board)
    If Not TorpedoUsed Then
    Console.Write("Fire a torpedo? (Y/N)")
    TorpedoChosen = Console.ReadLine()
    End If
    If TorpedoChosen = "Y" Then
    MakePlayerTorpedoMove(Board, Ships)
    TorpedoChosen = "N"
    TorpedoUsed = True
    Else
    MakePlayerMove(Board, Ships)
    End If
    GameWon = CheckWin(Board)
    If GameWon Then
    Console.WriteLine("All ships sunk!"
    Console.WriteLine()
    End If
    Loop Until GameWon
    End Sub

    Sub MakePlayerTorpedoMove(ByRef Board(,) As Char, ByVal Ships() As TShip)
    Dim Row As Integer
    Dim Column As Integer
    GetRowColumn(Row, Column)
    While Row > 0 And (Board(Row, Column) = "m" Or Board(Row, Column) = "-"
    Board(Row, Column) = "m"
    Row = Row - 1
    End While
    If Board(Row, Column) <> "-" And Board(Row, Column) <> "m" Then
    Console.WriteLine("Torpedo hits at (" & Row & "," & Column & "" Board(Row, Column) = "h"
    Else
    Console.WriteLine("Torpedo failed to hit a ship" Board(Row, Column) = "m"
    End If
    End Sub
 
 
 
Reply
Submit reply
Turn on thread page Beta
Updated: June 21, 2017
Poll
Do you like carrot cake?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.