From 113192f897ed6f7e1ce0f2f3f9d8abe6a75f017c Mon Sep 17 00:00:00 2001 From: Frank Villaro-Dixon Date: Thu, 1 Jan 2015 12:46:48 +0100 Subject: [PATCH] patterns --- patterns.c | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/patterns.c b/patterns.c index cebd574..335cee8 100644 --- a/patterns.c +++ b/patterns.c @@ -10,11 +10,9 @@ #include "obs.h" - void -pattern_copyleft(struct s_game *g) { +pattern_copyleft_spec(struct s_game *g, int cleared_face) { int times; - int cleared_face = rand() % g->polygon_type; int max_dist = get_max_obs_dist(g); for(times = 0; times < g->polygon_type; times++) { @@ -26,6 +24,43 @@ pattern_copyleft(struct s_game *g) { } } +void +pattern_copyleft(struct s_game *g) { + pattern_copyleft_spec(g, rand() % g->polygon_type); +} + +void +pattern_copy3left(struct s_game *g) { + pattern_copyleft_spec(g, 0); + pattern_copyleft_spec(g, g->polygon_type/2); + pattern_copyleft_spec(g, 0); +} + + +void +pattern_opposing_forces(struct s_game *g) { + int times; + int max_dist = get_max_obs_dist(g); + int cleared_face = rand() % g->polygon_type; + + for(times = 0; times < g->polygon_type; times+=2) { + struct s_obstacle o; + o = create_obstacle(SHAPE_THICK, + (times + cleared_face)%g->polygon_type, + 1, max_dist + K_CLEARANCE); + add_obstacle(g, o); + } +} + +void +pattern_3opposing_forces(struct s_game *g) { + pattern_opposing_forces(g); + pattern_opposing_forces(g); + pattern_opposing_forces(g); +} + + + void pattern_schenille(struct s_game *g) { int times; @@ -52,9 +87,12 @@ pattern_schenille(struct s_game *g) { void add_pattern(struct s_game *g) { - int n_patterns = 2; + int n_patterns = 5; void (*patterns[])(struct s_game *g) = {pattern_copyleft, - pattern_schenille}; + pattern_schenille, + pattern_copy3left, + pattern_opposing_forces, + pattern_3opposing_forces}; int choosen_pattern = rand() % n_patterns;