The Student Room Group

Aqa comp1 2016

Scroll to see replies

Swear like no one is doing Python this year lol
Original post by crazyy
Do you guys think chapter 6 - System Life cycle will come up this year, I've never seen a question about it ever.


There was only one question in 2011.
Original post by uGo1001
There was only one question in 2011.


I was wondering, can you share me all your past papers you have before june 2013? I would really appreciate it
Original post by crazyy
I was wondering, can you share me all your past papers you have before june 2013? I would really appreciate it


Here is 09, 10 and 11. I don't have 12 and it's not on AQA's website either.,
Original post by uGo1001
Here is 09, 10 and 11. I don't have 12 and it's not on AQA's website either.,


Thanks a bunch!!!
One thing I have found with placing the pieces in a place that can only take, the computer will often get stuck in an infinite loop looking for a place to put a piece. To combat this, I would recommend hard coding a maximum amount of tries a player can have and a way to skip a turn
Original post by TomBoysie
I was wondering what this actually shows on the game display as when i have tried to implement this nothing happens, i must have made a mistake somewhere within my code. I will PM you it if you wouldnt mind helping me out please. Also "x += 1" what does that mean?


yeah i don't mind if you PM for anymore queries, question or help
P.S. x+=1 is x = x + 1
Original post by uGo1001
Can you do this as pseudo code please?


FOR( X = -1; WHILE X < 2; INCREMENT X)
{
FOR( Y = -1; WHILE Y < 2; INCREMENT Y)
{
FUNCTION(Board,BoardSize,Row, X, Y)
}
}
// Two FOR statements work through the combination values of -1, 0 and 1
Has anybody figured out how to make the game skip a players turn if there are no possible flips?
Original post by Hamij006
Has anybody figured out how to make the game skip a players turn if there are no possible flips?


Check wikibooks
Original post by uGo1001
Check wikibooks


I have, and there are no solutions in any language on there.
Has anyone figured out how to make sure the computer only places pieces where a flip is possible?
Original post by ThisGuyThough
fixed value: can't find one

most wanted holder: Any variable that stores the user's input so "Coordinates" would be one

gatherer: "Score"

follower: can't find one

and regarding the EAD. Question 3 (13) looks like an answer box for one of those "dry-run this dumb algorithm" type questions. I imagine one of those marks (in the box 14) is for correctly determining the purpose of the algorithm.


BoardSize is kept as a global variable which is a fixed value, that gets altered internally by the player.
The Score is a Stepper. It iterates through the board and stores the score of the player.
There is no Most Wanted Holder. Coordinates are a temporary variable. They are held for a short time by the program.
As to do with the follower, I agree, there is none.
(edited 7 years ago)
Does anyone have the new spec EAD.
Reply 194
Original post by Filipo
BoardSize is kept as a global variable which is a fixed value, that gets altered internally by the player.
The Score is a Stepper. It iterates through the board and stores the score of the player.
There is no Most Wanted Holder. Coordinates are a temporary variable. They are held for a short time by the program.
As to do with the follower, I agree, there is none.


Just wanted to point out some corrections

Score is a gatherer ( Gatherer tallies up a set of data)
Row and column are steppers ( Are used to step through a array in function GetPlayerScore)

The rest I agree with you

here is my source and you guys can read up on the different variable roles that exist

https://en.wikibooks.org/wiki/A-level_Computing_2009/AQA/Problem_Solving,_Programming,_Data_Representation_and_Practical_Exercise/Fundamentals_of_Programming/The_Role_of_Variables
Will we get any extra marks if we comment our code or are comments uneccessary for this exam?
Original post by Filipo
BoardSize is kept as a global variable which is a fixed value, that gets altered internally by the player.
The Score is a Stepper. It iterates through the board and stores the score of the player.
There is no Most Wanted Holder. Coordinates are a temporary variable. They are held for a short time by the program.
As to do with the follower, I agree, there is none.


Oh sorry, I was thinking of a Most Recent Holder, Coordinates would be both a temporary and a Most Recent Holder.

Score However I still think is a gatherer.

I don't think BoardSize is a fixed value as it does change its value when the user decides to. Its actual value is changed outside of the main PlayGame routine and newly assigned by the routine "ChangeBoardSize" during the main menu while loop.
Original post by uGo1001
Python code for only letting a player put a piece down if it takes an opponents piece:
def CheckIfMoveIsValid(Board, Move, BoardSize, HumanPlayersTurn):
Row = Move % 10
Column = Move // 10
MoveIsValid = False
if Board[Row][Column] == " ":
if HumanPlayersTurn == True:
Board[Row][Column] = "H"
else:
Board[Row][Column] = "C"
if ((CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 1, 0) == True) or (CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, -1, 0) == True) or (CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 0, 1) == True) or (CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 0, -1) == True)):
MoveIsValid = True
else:
MoveIsValid = False
Board[Row][Column] = " "
return MoveIsValid


This will also work with diagonals if you add 4 more CheckIfThereArePiecesToFlip's.
You'll also need to add BoardSize and HumanPlayersTurn when you in PlayGame when you call upon the function


why are confusing this??

if (Board[Row, Column] == ' ' && ( CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 1, 0) == true || CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 0, 1) == true || CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, -1, 0) == true || CheckIfThereArePiecesToFlip(Board, BoardSize, Row, Column, 0, -1) == true))

thats all u need
Original post by TercioOfParma
One thing I have found with placing the pieces in a place that can only take, the computer will often get stuck in an infinite loop looking for a place to put a piece. To combat this, I would recommend hard coding a maximum amount of tries a player can have and a way to skip a turn


I have a solution for this in python.

I will write it in pseudocode:

1) You will need a routine that creates a list of the possible moves that the computer/player can make. This routine assigns a value to an array called PossibleMoves. The routine is called just after DisplayGameBoard is called and before the second while loop in PlayGame is called.


FUNCTION GetPossibleMoves(Board):
__PossibleMoves <-- Array(Empty)
____For Row in Board:
______RowIndex <-- Board.index(Row)
______For Column in Row:
________ColumnIndex <-- Row.index(Column)
________IF Board[RowIndex][ColumnIndex] = " ":
__________String(ColumnIndex)
__________String(RowIndex)
__________Coordinate <-- integer (ColumnIndex + RowIndex)
__________PossibleMoves appends(Coordinate)

Return PossibleMoves

2) In the PlayGame Routine you need to check if all possible coordinates have been checked. Place the following just after the program obtains a random computer move but just before CheckMoveIsValid is run.

IF Move in PossibleMoves:
___PossibleMoves.remove(Move)
___IF length of PossibleMoves = 0:
_____Output a string Indicating to the user the computer could make no moves.
Break Loop

3) Change the conditions for the second while loop in PlayGame (the one that runs until MoveIsValid = True) to also include a check for the length of PossibleMoves being greater than 0
(edited 7 years ago)
A very simple solution to only allowing a flip if it takes a piece is to let the move happen, and just delete the piece you placed if it didn't take another piece. You would need to impliment a max number of tries because the computer would infinite loop sometimes:
Create a variable in PlayGame called "MadeAFlip" (Boolean = false)
Whenever MakeMove is called, pass "MadeAFlip"
In MakeMove, pass FlipOpponentPiecesInOneDirection "MadeAFlip" too.
Then inside the existing "If FlipFound then..." loop in FlipOpponnentsPiecesInOneDirection, have the statement "MadeAFlip = True".
Then in MakeMove put this if statement:

If MadeAFlip = False Then
Board(Row, Column) = ""
End If

Then loop until MadeAFlip = true in PlayGame.

Quick Reply

Latest

Trending

Trending