Difference between revisions of "User:Evin-/Hackenbush"

m (Fixed Asy)
 
Line 4: Line 4:
 
<br /><center><asy>
 
<br /><center><asy>
 
/* Ground */
 
/* Ground */
 +
size(200);
 
draw((-1, 0) -- (5, 0));
 
draw((-1, 0) -- (5, 0));
  
 
int num_left = 4; /* How many left twigs */
 
int num_left = 4; /* How many left twigs */
pair[] left_nodes = [(1, 0), (1, 1), (1, 2), (2, 3), (4, 0), (3, 1), (3, 1), (4, 2)]; /* start, end of left twigs */
+
pair[] left_nodes = {(1, 0), (1, 1), (1, 2), (2, 3), (4, 0), (3, 1), (3, 1), (4, 2)}; /* start, end of left twigs */
  
 
int num_right = 3; /* How many right twigs */
 
int num_right = 3; /* How many right twigs */
pair[] right_nodes = [(0, 0), (1, 1), (1, 1), (1, 2), (1, 1), (3, 1)]; /* start, end of right twigs */
+
pair[] right_nodes = {(0, 0), (1, 1), (1, 1), (1, 2), (1, 1), (3, 1)}; /* start, end of right twigs */
  
 
/* pens for left and right */
 
/* pens for left and right */
Line 18: Line 19:
 
/* draw left's twigs */
 
/* draw left's twigs */
 
for(int i = 0; i < num_left; ++i) {
 
for(int i = 0; i < num_left; ++i) {
   begin = left_nodes[2 * i];
+
   pair begin = left_nodes[2 * i];
   end = left_nodes[2 * i + 1];
+
   pair end = left_nodes[2 * i + 1];
   draw(begin -- end, l);
+
   draw(begin -- end, l + linewidth(1));
 
}
 
}
  
 
/* draw right's twigs */
 
/* draw right's twigs */
 
for(int i = 0; i < num_right; ++i) {
 
for(int i = 0; i < num_right; ++i) {
   begin = right_nodes[2 * i];
+
   pair begin = right_nodes[2 * i];
   end = right_nodes[2 * i + 1];
+
   pair end = right_nodes[2 * i + 1];
   draw(begin -- end, r);
+
   draw(begin -- end, r + linewidth(1));
 
}
 
}
  

Latest revision as of 15:22, 9 March 2021


Who wants to play some Hackenbush?


[asy] /* Ground */ size(200); draw((-1, 0) -- (5, 0));  int num_left = 4; /* How many left twigs */ pair[] left_nodes = {(1, 0), (1, 1), (1, 2), (2, 3), (4, 0), (3, 1), (3, 1), (4, 2)}; /* start, end of left twigs */  int num_right = 3; /* How many right twigs */ pair[] right_nodes = {(0, 0), (1, 1), (1, 1), (1, 2), (1, 1), (3, 1)}; /* start, end of right twigs */  /* pens for left and right */ pen l = rgb(1, 0, 0); pen r = rgb(0, 0, 1);  /* draw left's twigs */ for(int i = 0; i < num_left; ++i) {   pair begin = left_nodes[2 * i];   pair end = left_nodes[2 * i + 1];   draw(begin -- end, l + linewidth(1)); }  /* draw right's twigs */ for(int i = 0; i < num_right; ++i) {   pair begin = right_nodes[2 * i];   pair end = right_nodes[2 * i + 1];   draw(begin -- end, r + linewidth(1)); }  /* draw nodes */ for(pair node : left_nodes) {   dot(node, rgb(0, 0, 0) + linewidth(6)); } for(pair node : right_nodes) {   dot(node, rgb(0, 0, 0) + linewidth(6)); } [/asy]

Rules

Two players, bLue/Left and Red/Right take turns chopping edges of their own color. When a group of edges is no longer connected to the ground, it falls. Whoever is first unable to move loses.

Signups

Games