Skip to content

Instantly share code, notes, and snippets.

@jh0l
Last active May 22, 2020 11:41
Show Gist options
  • Save jh0l/02b8eaa23ad684cff7f3c7fd93cae7cc to your computer and use it in GitHub Desktop.
Save jh0l/02b8eaa23ad684cff7f3c7fd93cae7cc to your computer and use it in GitHub Desktop.
discussion on the file save format to use for APT lab Friday 19:30
F
RYYU
RBBB
BLLL
RRUU
RYBL
.
..
...
....
.....
.....
.....
.....
.....
.....
.......
.
..
...
....
.....
.....
.....
.....
.....
.....
.......
0
Jessiah anthony Malik
23
Rob William Tirtasentana
30
YUBRYLRBYRULBYRUBYRLBUYUYBLRBLBLRYRYRUYBURYBULBURYLRUBYRLBY
RBYURULBYRLBLRURY
@jh0l
Copy link
Author

jh0l commented Apr 24, 2020

Requirements for file format:

To help your lab make the saved-game file format, you might want to think about representing things such as:
• Factories, including the centre factory. Note factories might be empty.
• Mosaics, including the storage grid, partially-filled grid, and broken tiles.
• Tile Bag contents.
• Box Lid contents.
• Player details, including name, and score.
• Current player
• Ability to provide a comment about the file (such as at the very top of the file)

Loading the game

The player loads the game at the main menu. When loading a game, the game reads the saves.azul for all available saves and lists them by number, the player may also enter a game save by name (file extension omitted).

The format of each file in each game save is as follows:

factories.save

#first line for centre factory
#second line for first factory
#third line for second factory
#etc
factories.save

F
RYYU
RBBB
BLLL
RRUU
RYBL

mosaic.save

player 1 is first
1st line is for the first row of tiles (1 tile)
2nd line for the second row tiles (2 tiles)
3rd line for third row (3 tiles)
4th line for fourth row
5th line for fifth row
lines 6 to 10 are for the mosaic wall each line will be 5 tiles long
line 11 is for the floor line (broken)
player 2 follows with same format
mosaic.save

.
..
...
....
.....
.....
.....
.....
.....
.....
.......
.
..
...
....
.....
.....
.....
.....
.....
.....
.......

tilebag_boxlid.save

tilebag_boxlid.save is 2 line long
1st line is for tilebag containing a preshuffled sequence of R, Y, B, L, and U tiles
2nd line is for boxlid
tilebag_boxlid.save

YUBRYLRBYRULBYRUBYRLBUYUYBLRBLBLRYRYRUYBURYBULBURYLRUBYRLBY
RBYURULBYRLBLRURY

players.save

1st line determines which player's turn it currently is (int)
2nd line is the 1st players name (string)
3rd line is the 1st players score (int)
4th line is the 2nd players name (string
5th line is the 2nd players score (int)

players.save

0
Jessiah anthony Malik
23
Rob William Tirtasentana
30

commenting

Commenting can be done at the end of each of these files. The parser will ignore comments.

@s3731166
Copy link

game.toString(){

std::string game = "";

for each Player
game +=":"
game += player1.toString

game +=":"

for each tile 
   game +=":"
   game += tile.toString

game +=":"

for each factory 
   game +=":"
   game += factory.toString

game +=":"

ect...

}

Object.toString(){
std::string objStr = '' ;
for each param
objStr += ,
objStr += "param"

}

@jh0l
Copy link
Author

jh0l commented Apr 24, 2020

lets come up with the file format first and then work out how to convert the game code to the file format afterwards

@s3731166
Copy link

rtf

@Jacob-Mango
Copy link

how does this sound?

begin game #this is a comment
	currentPlayer 0 #max two players, 0 is first in the save game list, 1 is second
end game
begin player
	name Jessiah anthony Malik
	score 10
end player
begin player
	name Rob William Tirtasentana
	score 100
end player

@Jacob-Mango
Copy link

Jacob-Mango commented May 1, 2020

players.save

1st line determines which player's turn it currently is (int)
2nd line is the 1st players name (string)
3rd line is the 1st players score (int)
4th line is the 2nd players name (string
5th line is the 2nd players score (int)

players.save

0
Jessiah anthony Malik
23
Rob William Tirtasentana
30

@jh0l
Copy link
Author

jh0l commented May 1, 2020

players.save

1st line determines which player's turn it currently is (int)
2nd line is the 1st players name (string)
3rd line is the 1st players score (int)
4th line is the 2nd players name (string
5th line is the 2nd players score (int)

players.save

0
Jessiah anthony Malik
23
Rob William Tirtasentana
30

Yep this is good I'll update the spec

@jh0l
Copy link
Author

jh0l commented May 1, 2020

I kinda feel like the mosaics should be merged with the players file, a bit unnecessary to separate the two

@Jacob-Mango
Copy link

This is being changed to this instead of reading from folders

For each save:

{saveName}-factories.save
{saveName}-mosaic.save
{saveName}-tilebag_boxlid.save
{saveName}-players.save

The persistent save:

persistentGame-factories.save
persistentGame-mosaic.save
persistentGame-tilebag_boxlid.save
persistentGame-players.save

@Jacob-Mango
Copy link

Jack Harry Hollis-London
20:57

We should be using any random behaviour after shuffling the tilebag

20:57
*should not be using rng behaviour

20:58
and the tilebag should only be shuffle at the start of a new game

20:58
the tilebag is only filled from the box lid again once the tilebag is empty

20:59
and it is filled in order, no shuffling happens when tilebag is refilled

21:00
To move from a tilefactory to a players floor line we can use turn 6

@Jacob-Mango
Copy link

Everything is FIFO

@mattrwalters
Copy link

Fill each factory in order from 1 to 5. Eg. Fill 1 completely then continue.
Always right to left.
Place in broken tile command is 6.
Bag and Lid are FIFO, doesnt matter how its implemented as long as it processes in that order.
Do not shuffle during testing. The seed is not neccessary for sharing tests.
The file format "persistent-*.save" where * represents all save types is reserved. No save game can be called persistent in a test case.
Saving is in the following format, "save {saveName}" then once saved all 4 files are saved with that string appended to them eg.
{saveName}-factories.save
{saveName}-mosaic.save
{saveName}-tilebag_boxlid.save
{saveName}-players.save
Commands are designated in the format the same as the assignment specification where "turn 3 L 3" is a valid turn. All tiles must be capital.
Menu items (number is command) 1. New Game; 2. Load Game; 3. Credits; 4. Quit;
Commands for "load" and "save".

@jh0l
Copy link
Author

jh0l commented May 15, 2020

Always right to left.

Would this not be left to right?

Commands for "load" and "save".

I was under the impression there is no need for a load gamecommand as loading is done from the main menu

@CameronvanRoon
Copy link

Matt is mostly correct, however, as jh0l points out:

We always read LEFT TO RIGHT
We save with "save [saveName]"
Load game is handled explicitly from the main menu. Selection "2"
No need to load from mid-game.

Also note, each test contains 3 files:
A saved game starting state.
A file of input commands
A saved game state for the expected output - Probably just append with .output to make this clear.

Input command file example:

2
[nameOfTestFile]
turn 3 R 3
turn 0 Y 6
save [nameOfTestFile]

@jh0l
Copy link
Author

jh0l commented May 15, 2020

more clarification:
when there is no room to place a tile in the floor line, they should not linger on the floor line, they should be immediately placed in the box lid in FIFO order.

@mattrwalters
Copy link

Oop sorry everyone was fairly tired when I wrote that. As stated above I should have said left to right, and there is no need for a load command. Again, sorry about the confusion.

@mattrwalters
Copy link

Regarding the following.

Also note, each test contains 3 files:
A saved game starting state.
A file of input commands
A saved game state for the expected output - Probably just append with .output to make this clear

Should we change our implementation of the save state to be a single file instead of how we have it with multiple files now. I believe this was decided in the original meeting regarding saves that we would store the save over multiple files How we have it now will this cause a reduction in marks?

@jh0l
Copy link
Author

jh0l commented May 17, 2020 via email

@jh0l
Copy link
Author

jh0l commented May 22, 2020

for scoring on the wall, when we're counting adjacent linked tiles next to a tile that is being placed on a wall, are we placing each tile on the wall before the next one is counted, or are we only counting tiles on the wall from previous rounds when counting adjacent linked tiles next to a tile that is being placed on a wall?

@jh0l
Copy link
Author

jh0l commented May 22, 2020

@CameronvanRoon
Copy link

for scoring on the wall, when we're counting adjacent linked tiles next to a tile that is being placed on a wall, are we placing each tile on the wall before the next one is counted, or are we only counting tiles on the wall from previous rounds when counting adjacent linked tiles next to a tile that is being placed on a wall?

My understanding (could be wrong) was that tiles are placed on wall one at a time, beginning from the top row of the storage rows, going down. Thus, scores would be based on the time of placement. Therefore, you would score for a tile in the same turn only if it was above it on the storage rows.

@CameronvanRoon
Copy link

From the rules:

Go through your pattern lines from top to bottom. Move the rightmost tile of each complete line to the space of the same color in the corresponding line of your wall. Each time you move a tile, score points immediately (see Scoring).

@jh0l
Copy link
Author

jh0l commented May 22, 2020

alright cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment