Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added initial setup

  • Loading branch information...
commit 76c9351c7f4617a36d1db63b55cd1ca2eea4c6ad 1 parent a02d301
@janne authored
View
10 client/client.coffee
@@ -0,0 +1,10 @@
+Template.board.column = -> [0..SIDE-1]
+
+Meteor.startup ->
+ square_i = 0
+ squares = Square.find().fetch()
+ for col in [HOME_SQUARES+1..HOME_SQUARES+2]
+ for row in [0..HOME_SQUARES]
+ square = squares[square_i++]
+# $('table#board tr#row_' + row + ' td#col_' + col).html(Meteor.ui.render -> Template.square({square: square}))
+ $('table#board tr#row_' + row + ' td#col_' + col).html(Template.square({square: square}))
View
15 client/ludo.css
@@ -0,0 +1,15 @@
+table#board td {
+ border: solid 1px #aaa;
+ width: 20px;
+ height: 20px;
+}
+
+.red { background: #f00; }
+.green { background: #0f0; }
+.blue { background: #00f; }
+.yellow { background: #ff0; }
+
+div.square {
+ width: 100%;
+ height: 100%;
+}
View
26 client/ludo.html
@@ -0,0 +1,26 @@
+<head>
+ <title>Meteor Ludo</title>
+</head>
+
+<body>
+ {{> board}}
+</body>
+
+<template name="board">
+<table id="board">
+ {{#each column}}
+ <tr id="row_{{this}}">
+ {{#each column}}
+ <td id="col_{{this}}">
+ </td>
+ {{/each}}
+ </tr>
+ {{/each}}
+</table>
+</template>
+
+<template name="square">
+<div class="square">
+ x
+</div>
+</template>
View
16 model.coffee
@@ -0,0 +1,16 @@
+@HOME_SQUARES = 4
+@PLAYER_DIFF = 2 + 2 * HOME_SQUARES
+@SIDE = 3 + 2 * HOME_SQUARES
+# @OUTER_LENGTH = 8 + 8 * HOME_SQUARES
+# @TOTAL_LENGTH = OUTER_LENGTH + HOME_SQUARES
+
+@COLORS = ['#f00', '#0f0', '#00f', '#ff0']
+
+# { color }
+@Square = new Meteor.Collection('square')
+
+# { color, start_square }
+@Player = new Meteor.Collection('player')
+
+# { player, square }
+@Piece = new Meteor.Collection('piece')
View
8 server/server.coffee
@@ -0,0 +1,8 @@
+Meteor.startup ->
+ for player_id in [0..3]
+ color = COLORS[player_id]
+ player = Player.insert {color: color}
+ for num in [0..3]
+ Piece.insert { player: player, square: null }
+ for num in [0..PLAYER_DIFF-1]
+ Square.insert {color: color}
Please sign in to comment.
Something went wrong with that request. Please try again.