Hey there! Sign in to join this conversationNew here? Join for free

*megathread* computer science pre release 2016 predicitons Watch

    • Thread Starter
    Offline

    0
    ReputationRep:
    Hey all , This is just a thread for all the questions/predictions for tommorows pre release.

    Lets all work together!!!!
    • Section Leader
    • Very Important Poster
    • Clearing and Applications Advisor
    • Welcome Squad
    Offline

    19
    ReputationRep:
    Section Leader
    Very Important Poster
    Clearing and Applications Advisor
    Welcome Squad
    (Original post by compscistudent1)
    Hey all , This is just a thread for all the questions/predictions for tommorows pre release.

    Lets all work together!!!!
    I've moved this to the Computer Science forum for you
    Offline

    8
    ReputationRep:
    Is this for AQA?
    Offline

    14
    ReputationRep:
    you won't get any predictions here because barely anyone studies AL Computer Science
    • Thread Starter
    Offline

    0
    ReputationRep:
    (Original post by GarlicBread01)
    Is this for AQA?
    Yes it is
    Offline

    8
    ReputationRep:
    Well we only received the skeleton code recently so I dont have that much input yet.

    Im guessing over the days more people will come to have ideas.
    Offline

    1
    ReputationRep:
    I have the Python skeleton code if anyone is taking the exam in Python (I've written it the way AQA have provided it) (: Also just thought it's worth mentioning now, that the program crashes when you enter coordinates too large for the grid - so they may possibly ask for a validation to correct this?
    Code:
    #Skeleton Program for the AQA AS1 Summer 2016 examination 
    #this code should be used in conjunction with the Preliminary Material 
    #written by the AQA AS1 Programmer Team 
    #developed in a Python 3 programming environment 
    
    #Version Number 1.0 
    
    import random
    
    def GetRowColumn():
     print() 
     Column = int(input("Please enter column: ")) 
     Row = int(input("Please enter row: ")) 
     print() 
     return Row, Column 
    
    def MakePlayerMove(Board, Ships): 
     Row, Column = GetRowColumn()
     if Board[Row][Column] == "m" or Board[Row][Column] == "h":
       print("Sorry, you have already shot at the square (" + str(Column) + "," + str(Row) + "). Please try again.") 
     elif Board[Row][Column] == "-":
       print("Sorry, (" + str(Column) + "," + str(Row) + ") is a miss.")
       Board[Row][Column] = "m"
     else:
       print("Hit at (" + str(Column) + "," + str(Row) + ").")
       Board[Row][Column] = "h"
    
    def SetUpBoard():
      Board = [] 
      for Row in range(10): 
        BoardRow = [] 
        for Column in range(10): 
          BoardRow.append("-") 
        Board.append(BoardRow) 
      return Board 
    
    def LoadGame(Filename, Board): 
      BoardFile = open(Filename, "r") 
      for Row in range(10):
        Line = BoardFile.readline() 
        for Column in range(10): 
          Board[Row][Column] = Line[Column] 
      BoardFile.close()
    
    def PlaceRandomShips(Board, Ships): 
      for Ship in Ships:
        Valid = False 
        while not Valid:
          Row = random.randint(0, 9)
          Column = random.randint(0, 9) 
          HorV = random.randint(0, 1) 
          if HorV == 0: 
            Orientation = "v" 
          else: 
            Orientation = "h" 
            Valid = ValidateBoatPosition(Board, Ship, Row, Column, Orientation)                 print("Computer placing the " + Ship[0]) 
          PlaceShip(Board, Ship, Row, Column, Orientation) 
    
    def PlaceShip(Board, Ship, Row, Column, Orientation):
      if Orientation == "v":
        for Scan in range(Ship[1]):
          Board[Row + Scan][Column] = Ship[0][0] 
      elif Orientation == "h": 
        for Scan in range(Ship[1]): 
          Board[Row][Column + Scan] = Ship[0][0] 
    
    def ValidateBoatPosition(Board, Ship, Row, Column, Orientation): 
      if Orientation == "v" and Row + Ship[1] > 10: 
        return False
      elif Orientation == "h" and Column + Ship[1] > 10:
        return False 
      else: 
        if Orientation == "v":
          for Scan in range(Ship[1]):
            if Board[Row + Scan][Column] != "-": 
              return False
      elif Orientation == "h":
        for Scan in range(Ship[1]):
          if Board[Row][Column + Scan] != "-": 
            return False
     return True 
    
    def CheckWin(Board): 
      for Row in range(10):
        for Column in range(10):
          if Board[Row][Column] in ["A","B","S","D","P"]:
            return False
      return True
    
    def PrintBoard(Board): 
      print()
      print("The board looks like this: ") 
      print()
      print (" ", end="") 
      for Column in range(10): 
        print(" " + str(Column) + "  ", end="") 
      print()
      for Row in range(10): 
        print (str(Row) + " ", end="") 
        for Column in range(10):
          if Board[Row][Column] == "-": 
            print(" ", end="") 
          elif Board[Row][Column] in ["A","B","S","D","P"]: 
            print(" ", end="") 
          else: 
            print(Board[Row][Column], end="") 
          if Column != 9:
            print(" | ", end="")
        print() 
    
    def DisplayMenu():
      print("MAIN MENU")
      print()  print("1. Start new game")
      print("2. Load training game") 
      print("9. Quit") 
      print() 
    
    def GetMainMenuChoice():
      print("Please enter your choice: ", end="") 
      Choice = int(input())
      print() 
      return Choice 
    
    def PlayGame(Board, Ships):
      GameWon = False
      while not GameWon:
        PrintBoard(Board) 
        MakePlayerMove(Board, Ships) 
        GameWon = CheckWin(Board) 
        if GameWon: 
          print("All ships sunk!") 
          print() 
     
    if __name__ == "__main__":
      TRAININGGAME = "Training.txt" 
      MenuOption = 0 
      while not MenuOption == 9:
        Board = SetUpBoard() 
        Ships = [["Aircraft Carrier", 5], ["Battleship", 4], ["Submarine", 3], ["Destroyer", 3], ["Patrol Boat", 2]] 
        DisplayMenu()
        MenuOption = GetMainMenuChoice()
        if MenuOption == 1:
          PlaceRandomShips(Board, Ships) 
          PlayGame(Board,Ships) 
        if MenuOption == 2:
          LoadGame(TRAININGGAME, Board)
       PlayGame(Board, Ships)
    Offline

    10
    ReputationRep:
    klm
    Offline

    7
    ReputationRep:
    Is the code provided being used for the new AQA AS Level computer science course?

    If so, I'm studying this course but my teacher hasn't provided us with any of the material yet, or let us know that it's available

    I'll also be programming in Python for the exam
    Offline

    0
    ReputationRep:
    (Original post by AmarRPM)
    Is the code provided being used for the new AQA AS Level computer science course?

    If so, I'm studying this course but my teacher hasn't provided us with any of the material yet.. or even let us known that it's available

    I'll also be programming in Python for the exam
    The code is for the new AQA A level Computer Science, I'm also doing it in Python! But the rest of my class are doing it in PASCAL lol.
    Offline

    7
    ReputationRep:
    (Original post by walkinglamb)
    The code is for the new AQA A level Computer Science, I'm also doing it in Python! But the rest of my class are doing it in PASCAL lol.
    Oh wow, it's good that someone attached the code in here then, as my teacher hasn't provided the material to my class yet.

    I'll definitely be sure to play around with the code a bit and familiarise myself with it. Should make the exam much easier!
    Offline

    7
    ReputationRep:
    (Original post by Little Old Lady)
    I have the Python skeleton code if anyone is taking the exam in Python (I've written it the way AQA have provided it) (: Also just thought it's worth mentioning now, that the program crashes when you enter coordinates too large for the grid - so they may possibly ask for a validation to correct this?
    Code:
    #Skeleton Program for the AQA AS1 Summer 2016 examination 
    #this code should be used in conjunction with the Preliminary Material 
    #written by the AQA AS1 Programmer Team 
    #developed in a Python 3 programming environment 
    
    #Version Number 1.0 
    
    import random
    
    def GetRowColumn():
     print() 
     Column = int(input("Please enter column: ";)) 
     Row = int(input("Please enter row: ";)) 
     print() 
     return Row, Column 
    
    def MakePlayerMove(Board, Ships): 
     Row, Column = GetRowColumn()
     if Board[Row][Column] == "m" or Board[Row][Column] == "h":
       print("Sorry, you have already shot at the square (" + str(Column) + "," + str(Row) + ";). Please try again.";) 
     elif Board[Row][Column] == "-":
       print("Sorry, (" + str(Column) + "," + str(Row) + ";) is a miss.";)
       Board[Row][Column] = "m"
     else:
       print("Hit at (" + str(Column) + "," + str(Row) + ";).";)
       Board[Row][Column] = "h"
    
    def SetUpBoard():
      Board = [] 
      for Row in range(10): 
        BoardRow = [] 
        for Column in range(10): 
          BoardRow.append("-";) 
        Board.append(BoardRow) 
      return Board 
    
    def LoadGame(Filename, Board): 
      BoardFile = open(Filename, "r";) 
      for Row in range(10):
        Line = BoardFile.readline() 
        for Column in range(10): 
          Board[Row][Column] = Line[Column] 
      BoardFile.close()
    
    def PlaceRandomShips(Board, Ships): 
      for Ship in Ships:
        Valid = False 
        while not Valid:
          Row = random.randint(0, 9)
          Column = random.randint(0, 9) 
          HorV = random.randint(0, 1) 
          if HorV == 0: 
            Orientation = "v" 
          else: 
            Orientation = "h" 
            Valid = ValidateBoatPosition(Board, Ship, Row, Column, Orientation)                 print("Computer placing the " + Ship[0]) 
          PlaceShip(Board, Ship, Row, Column, Orientation) 
    
    def PlaceShip(Board, Ship, Row, Column, Orientation):
      if Orientation == "v":
        for Scan in range(Ship[1]):
          Board[Row + Scan][Column] = Ship[0][0] 
      elif Orientation == "h": 
        for Scan in range(Ship[1]): 
          Board[Row][Column + Scan] = Ship[0][0] 
    
    def ValidateBoatPosition(Board, Ship, Row, Column, Orientation): 
      if Orientation == "v" and Row + Ship[1] > 10: 
        return False
      elif Orientation == "h" and Column + Ship[1] > 10:
        return False 
      else: 
        if Orientation == "v":
          for Scan in range(Ship[1]):
            if Board[Row + Scan][Column] != "-": 
              return False
      elif Orientation == "h":
        for Scan in range(Ship[1]):
          if Board[Row][Column + Scan] != "-": 
            return False
     return True 
    
    def CheckWin(Board): 
      for Row in range(10):
        for Column in range(10):
          if Board[Row][Column] in ["A","B","S","D","P"]:
            return False
      return True
    
    def PrintBoard(Board): 
      print()
      print("The board looks like this: ";) 
      print()
      print (" ", end="";) 
      for Column in range(10): 
        print(" " + str(Column) + "  ", end="";) 
      print()
      for Row in range(10): 
        print (str(Row) + " ", end="";) 
        for Column in range(10):
          if Board[Row][Column] == "-": 
            print(" ", end="";) 
          elif Board[Row][Column] in ["A","B","S","D","P"]: 
            print(" ", end="";) 
          else: 
            print(Board[Row][Column], end="";) 
          if Column != 9:
            print(" | ", end="";)
        print() 
    
    def DisplayMenu():
      print("MAIN MENU";)
      print()  print("1. Start new game";)
      print("2. Load training game";) 
      print("9. Quit";) 
      print() 
    
    def GetMainMenuChoice():
      print("Please enter your choice: ", end="";) 
      Choice = int(input())
      print() 
      return Choice 
    
    def PlayGame(Board, Ships):
      GameWon = False
      while not GameWon:
        PrintBoard(Board) 
        MakePlayerMove(Board, Ships) 
        GameWon = CheckWin(Board) 
        if GameWon: 
          print("All ships sunk!";) 
          print() 
     
    if __name__ == "__main__":
      TRAININGGAME = "Training.txt" 
      MenuOption = 0 
      while not MenuOption == 9:
        Board = SetUpBoard() 
        Ships = [["Aircraft Carrier", 5], ["Battleship", 4], ["Submarine", 3], ["Destroyer", 3], ["Patrol Boat", 2]] 
        DisplayMenu()
        MenuOption = GetMainMenuChoice()
        if MenuOption == 1:
          PlaceRandomShips(Board, Ships) 
          PlayGame(Board,Ships) 
        if MenuOption == 2:
          LoadGame(TRAININGGAME, Board)
       PlayGame(Board, Ships)
    Thanks a bunch for attaching this, it's helped me a lot!
    Offline

    1
    ReputationRep:
    Since no one started contributing as of yet, i'll input what me and my class thought could be asked us:
    - Validation for every input (obvious one)
    - Difficulty levels - change how long each ship is.
    - Make the program tell you when each individual ship has been sunk
    - Score system
    - Save/load game
    - Add a new ship

    As far as I am aware there is no other obvious parts of the code that could be used for anything else, and it is unlikely that they ask us to write our own code (they usually don't do it, altough it could happen), so I am quite lost as to what they could ask. Any ideas?

    By the way, I am also doing Python.
    Offline

    10
    ReputationRep:
    jikjml
    Offline

    1
    ReputationRep:
    Bump.
    Offline

    1
    ReputationRep:
    (Original post by gomc)
    can someone send me the Training.txt file?
    Sorry completely forgot to include it with the Python Skeleton Code! Here you go (:
    Attached Files
  1. File Type: txt Training.txt (110 Bytes, 137 views)
    Offline

    0
    ReputationRep:
    i can't use the training game part of the menu that involves the training text file and its stressing me out!! it comes up with an error
    Offline

    0
    ReputationRep:
    So ive left my revision abit late as per xD

    Could anyone supply me with some solutions for the predicted questions? Would really help me!!.

    P.S I am doing it in python also.
    Offline

    1
    ReputationRep:
    Can anyone upload the prerelease in VB.net? Would be much appreciated, can't seem to find it and my school's remote desktop connection isn't working.
    Offline

    1
    ReputationRep:
    (Original post by JonoSwanno)
    So ive left my revision abit late as per xD

    Could anyone supply me with some solutions for the predicted questions? Would really help me!!.

    P.S I am doing it in python also.
    This might help https://en.wikibooks.org/wiki/A-leve...er1_this_year)
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    What's your favourite Christmas sweets?
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • 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

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