Javascript Exercises

Javascript Exercises
1 Instructions
In this assignment, you will be required to write JavaScript functions that simplify playing of the
variation of Connect Four. The variation is that this is a team game (odd-numbered pieces vs even-
numbered pieces). The rst team to get some combination of four of their pieces in a horizontal,
vertical, or diagonal line wins.
1.1 Data File Speci cation
An example of properly formatted le is shown in Figure 1. The rst le encodes a list of moves.
The second le encodes the game.
part01test01.moves.cnf
5 ,3 ,3 ,3 ,10 ,10
part01test01.game.cnf
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,-,-,-,-,-,-,-,-,-,-,-,-,x
x,-,4,-,-,-,-,-,-,-,-,-,-,-,x
x,-,4,2,-,1,2,-,-,-,3,-,1,3,x
x,x,x,x,x,x,x,x,x,x,x,x,x,x,x
Figure 1: A properly formatted game encoding
1
2 One

Leave a Reply

Your email address will not be published. Required fields are marked *