about summary refs log tree commit diff stats
path: root/src/command/cmd_defs.c
Commit message (Expand)AuthorAgeFilesLines
* Use current room for /bookmark add and /bookmark removeJames Booth2016-10-051-4/+4
* Allow vertical positioning of all windowsJames Booth2016-09-231-6/+57
* Rename /titlebar -> /wintitleJames Booth2016-09-221-5/+5
* Add /inputwin top|bottom commandJames Booth2016-09-191-0/+17
* cmd_defs: Fix typoTim Nieradzik2016-09-051-4/+4
* Update helpJames Booth2016-08-221-9/+8
* Tidy headersJames Booth2016-07-241-9/+9
* Moved window_list.cJames Booth2016-07-241-1/+1
* Moved roster_list.cJames Booth2016-07-241-1/+1
* Moved muc.cJames Booth2016-07-241-1/+1
* Moved jid.cJames Booth2016-07-241-1/+1
* Moved contact.cJames Booth2016-07-241-1/+1
* Moved chat_session.cJames Booth2016-07-241-1/+1
* Add /plugins python_version commandJames Booth2016-07-241-2/+4
* Update GPL link in headersJames Booth2016-07-241-1/+1
* Add /plugins install commandJames Booth2016-07-121-2/+5
* Allow reloading all plugins with /plugin reloadJames Booth2016-07-101-3/+3
* Add /plugin reload commandJames Booth2016-07-101-2/+5
* /plugins unload command and completerJames Booth2016-06-301-2/+5
* Revert "WIP - Unload plugin commands"James Booth2016-06-301-6/+3
* WIP - Unload plugin commandsJames Booth2016-06-291-3/+6
* Update /notify helpJames Booth2016-05-311-1/+2
* Remove commented codeJames Booth2016-05-311-26/+0
* Move /statuses options to /presence commandJames Booth2016-05-311-31/+48
* Add /presence titlebar subcommandJames Booth2016-05-311-29/+29
* Update window navigation helpJames Booth2016-05-251-9/+12
* Option to bookmark room invitesJames Booth2016-05-231-2/+4
* Remove unneeded functions from cmd headersJames Booth2016-05-231-14/+16
* Move functions from cmd_defs to cmd_funcsJames Booth2016-05-231-102/+22
* Fix command headersJames Booth2016-05-231-1/+1
* Rename command sourcesJames Booth2016-05-221-0/+2445
class="mi">50][50]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { map[i][j] = '-'; } } int stop=0,i=0,moves=0,score=0,pos[2] = {n/2,m/2}; int bonus[2]; int trap[2] ; int death[2]; map[pos[0]][pos[1]] = '+'; do{ bonus[0] = arc4random_uniform(n); bonus[1] = arc4random_uniform(m); trap[0] = arc4random_uniform(n); trap[1] = arc4random_uniform(m); death[0] = arc4random_uniform(n); death[1] = arc4random_uniform(m); }while((bonus[0] == trap[0] && bonus[1] == trap[1]) || (bonus[0] == death[0] && bonus[1] == death[1]) || (trap[0] == death[0] && trap[1] == death[1]) || (bonus[0] == pos[0] && bonus[1] == pos[1]) || (trap[0] == pos[0] && trap[1] == pos[1]) || (death[0] == pos[0] && death[1] == pos[1])); map[bonus[0]][bonus[1]] = 'B'; map[trap[0]][trap[1]] = 'T'; map[death[0]][death[1]] = 'D'; do{ printf("Map:\n"); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { printf("%c ", map[i][j]); } printf("\n"); } printf("Score: %d\n", score); printf("Moves: %d\n", moves); printf("Enter a direction (w,a,s,d) or c to quit: "); scanf(" %c", &input); // pos[0] updown pos[1] lr if (input == 'w') { printf("Moving up\n"); map[pos[0]][pos[1]] = '-'; if (pos[0] == 0) { pos[0] = n-1; } else { pos[0]--; } } else if (input == 'a') { printf("Moving left\n"); map[pos[0]][pos[1]] = '-'; if (pos[1] == 0) { pos[1] = m-1; } else { pos[1]--; } } else if (input == 's') { printf("Moving down\n"); map[pos[0]][pos[1]] = '-'; if (pos[0] == n-1) { pos[0] = 0; } else { pos[0]++; } } else if (input == 'd') { printf("Moving right\n"); map[pos[0]][pos[1]] = '-'; if (pos[1] == m-1) { pos[1] = 0; } else { pos[1]++; } } else if (input == 'c') { printf("Quitting\n"); } else { printf("Invalid input\n"); } map[pos[0]][pos[1]] = '+'; if (pos[0] == bonus[0] && pos[1] == bonus[1]) { score++; do{ bonus[0]= arc4random_uniform(n); bonus[1]= arc4random_uniform(m); }while((bonus[0] == trap[0] && bonus[1] == trap[1]) || (bonus[0] == death[0] && bonus[1] == death[1]) || (bonus[0] == pos[0] && bonus[1] == pos[1])); } if (pos[0] == trap[0] && pos[1] == trap[1]) { score--; do{ trap[0]= arc4random_uniform(n); trap[1]= arc4random_uniform(m); }while((trap[0] == bonus[0] && trap[1] == bonus[1]) || (trap[0] == death[0] && trap[1] == death[1]) || (trap[0] == pos[0] && trap[1] == pos[1])); } if (pos[0] == death[0] && pos[1] == death[1]) { score = 0; do{ death[0]= arc4random_uniform(n); death[1]= arc4random_uniform(m); }while((death[0] == bonus[0] && death[1] == bonus[1]) || (death[0] == trap[0] && death[1] == trap[1]) || (death[0] == pos[0] && death[1] == pos[1])); } if (score % 3 == 0 && score != 0 && stop == 0) { map[death[0]][death[1]] = '-'; do{ death[0]= arc4random_uniform(n); death[1]= arc4random_uniform(m); }while((death[0] == bonus[0] && death[1] == bonus[1]) || (death[0] == trap[0] && death[1] == trap[1]) || (death[0] == pos[0] && death[1] == pos[1])); stop = 1; } else if (score % 3 != 0) { stop = 0; } if (moves % 5 == 0 && moves != 0) { do{ map[trap[0]][trap[1]] = '-'; trap[0]= arc4random_uniform(n); trap[1]= arc4random_uniform(m); }while((trap[0] == bonus[0] && trap[1] == bonus[1]) || (trap[0] == death[0] && trap[1] == death[1]) || (trap[0] == pos[0] && trap[1] == pos[1])); } map[bonus[0]][bonus[1]] = 'B'; map[trap[0]][trap[1]] = 'T'; map[death[0]][death[1]] = 'D'; moves++; }while(input != 'c'); return 0; }