Share your repls and programming experiences

← Back to all posts
AMERICAN FOOTBALL [GAME]
h
RohilPatel (1535)

Console Football Version 1.0

What does this update feature?

  • Offensive plays, 4 downs, scoring, etc
  • Features a "beautiful" console, ikr

Whats to come later then?

  • More plays, including specifics, like shotgun and etc
  • More a nicer UI to work with (keeping the console, but making it easier to use for the average person.
  • Defense (Coming version 2.0)

Why the console of all places

  • It seems like a very nice place to put something down; with websites you need to do all sorts of junk, but I think the console feel gives it a sense of "oldness"
  • I want to make a console game. Yes, it sounds really weird, but I think it was necessary to actually do this since I wanted to use C++.

BUGS FIXED

I officially announce this as my second step towards using C++

Comments
hotnewtop
programmeruser (571)
#pragma once
#ifndef RANDOMNUM_H
#define RANDOMNUM_H

If you're using #pragma once you don't need #ifndef (which is much better).

double randnum(double start, double end);
double randnum();
int randint();
int randint(int start, int end);

Why are you declaring function prototypes and defining them right after?

(int)randnum(0.0, 20.0)

C++ style casts (static_cast and the like) are preferred over C-style casts ((type)).

std::endl

"\n" is preferred over std::endl.

std::cin >> userSelect;

std::getline or std::ostream::get are preferred over std::ostream operator >>.

down++

Use ++down.

void displayOffensiveOptions(int);

First off all, there's no name for the int argument. Second of all, camel_case is generally used in C++ for variable, function, and method names and PascalCase is used for classes.

[deleted]

What's a touchback?

You punted for 60 yards. The result of the play was a touchback...yada yada yada...

What's that mean?

[deleted]

@RohilPatel - I looked up...and saw the sky...and understood what a touchback means...thanks :)

JasonLiu19 (69)

Also, why only blitz plays? What about Zone and Man-To-Man?

RohilPatel (1535)

Check the coming soon lol, and I also need to work on the defense. This is mainly for offense @JasonLiu19

AyushGudipati (5)

@JasonLiu19 Defense doesn't work for me.

Bookie0 (5993)

Ok so pretty good except I don't really know how to play. Maybe add a rules of some sort to show how to play American Football?

also, not sure if possible in C, but maybe colors? Oooo what about adding some cool ASCII art of like people throwing ball, kicking, the field, etc.

Good luck! :D

RohilPatel (1535)

ooh i dont know about colors lol. also, its a sport that isnt "mine", so look it up, as my description wouldnt be that great @Bookie0

JasonLiu19 (69)

@Bookie0 Gridiron Football is a game that originated from the 1890s and the modern rules are as follows:

  • At the start of each game, the referee flips a coin. Whoever wins gets to choose whether to kick-off and receive it in the second half (3rd quarter) or vice-versa.
  • The receiving team can return it, catch it and kneel for 25 yards, or ignore it as a touchback.
  • The offense has 40 seconds to snap or call a timeout.
  • When the quarterback (or someone else) receives the snap, they can either:
    • Drop back and pass
    • Hand it over to another player
    • Keep it and rush
    • Lateral/Flip it to another player
    • Kneel/Cock the ball (I think that's what it's called)
  • After the play, a down passed. Here are some outcomes:
    • They gained some yardage and it is 2nd down
    • They lost yardage and it is 2nd down
    • It was a turnover and the other team now has possession
    • It was a safety for 2 points (the other team gets tackled
      in their
      endzone)
    • It got turnovered for a touchdown
    • A flag happened before the play, and the down is redone
      with a penalty.
    • A flag happened during the play, and a penalty is put on
      the play, usually a redo.
    • A flag happened after the play, and the penalty doesn't
      effect what happened but instead puts yardage on the outcome.
  • There are a starting 4 downs and to get another set, you have to reach the 10 yards or more.
  • There are 4 quarters and 1 overtime if needed.

Colors are the same as in Bookie's Python tutorial (escape codes)

Bookie0 (5993)

@RohilPatel I know it isn't your game lol, but you could add rules in the actual repl (md file or in game)

RohilPatel (1535)

If I had a pin button I would use it lol @Bookie0

Bookie0 (5993)

First thing's first before I even run the repl:

AMERICAN FOOTBALL [GAME]

why buggy? like, you don't put that on a title man lol! xD

cdl7 (0)

I scored a touchdown and went for an extra point and instead of giving me 1 point (6 to 7) it gave me 7 (6 to 13).

RohilPatel (1535)

yeah, i just fixed that bug!! see if its better now @cdl7

RohilPatel (1535)

thanks for the feedback btw, it means a lot @cdl7

cdl7 (0)

its fixed! This is really cool by the way, looking forward to the full version. @RohilPatel

RohilPatel (1535)

thanks a lot! upvote if you want, and ill be sure to let you know when its done! @cdl7

programmeruser (571)

What's this?

if (rush)

  if (yardAt >= 100) {
    touchdown();
  } else {
    displayOffensiveOptions(down);
  }
RohilPatel (1535)

its also possible i was fixing bugs ;) @programmeruser

JBloves27 (1720)

Pretty cool but it seems like there are a lot of bugs you might want to fix. Maybe fix before you post?

RohilPatel (1535)

im trying to get people to help find them before moving to the defense @JBYT27

RohilPatel (1535)

also there aren't as many bugs as you think. its mainly on one single scenario, 4th down @JBYT27

RohilPatel (1535)

yeah. is there anything you have found that i can use? @JBYT27

JBloves27 (1720)

not yet, but i will soon! @RohilPatel

RhinoRunner (820)

I just kept pressing #3 and I got a touchdown in like 5 seconds

RohilPatel (1535)

not really a bug lmao, i know i should fix that @RhinoRunner

RohilPatel (1535)

THERE ARE BUGS, AND I WOULD APPRECIATE IF YOU TOLD ME WHERE SO I CAN PATCH THEM AS SOON AS POSSIBLE!

ALSO, THE PROGRAM STOPS IF ITS A TURNOVER, SINCE DEFENSE ISN'T PLUGGED IN YET

JasonLiu19 (69)

@RohilPatel 3 yard rush on 3rd and 2 ah yes 4th and -1

JasonLiu19 (69)

@RohilPatel also idk know if you know, the endzone adds 18 yards to the field goal attempt

JasonLiu19 (69)

@RohilPatel i have 12 points after scoring a touchdown and I missed the extra point my kicker sucks

JasonLiu19 (69)

@RohilPatel not sure if a 20-yard pass from your own 49 puts you at the opponent's 20 yard line..

inyourface3445 (37)

@RohilPatel press 4 than press 1. it will stop.

RohilPatel (1535)

what play did u run for the 4th and -1? like what offensively? there are lots of bugs there @JasonLiu19

RohilPatel (1535)

ok rushing 4th & -1 fixed. @JasonLiu19

RohilPatel (1535)

not sure about the "own 49" thing...its very possible i messed up some math but im not sure... @JasonLiu19

RohilPatel (1535)

and wait, u got 12 point touch down????? or u had like 2 and like missed both lol? @JasonLiu19

RohilPatel (1535)

lmao fixed that bug too big (touchdown)@JasonLiu19

RohilPatel (1535)

Yeah, is it fixed? I think so, but check. Also, lmao I increased the points by 1 for a 2 point attempt so that's fixed. @JasonLiu19

RohilPatel (1535)

And by the way, I just don't add field goal numbers like that, I just use field goal range: roughly about the 39 yard line @JasonLiu19

RohilPatel (1535)

Yeah. It's also rare that u get exactly 57 too, so the chances are likely somewhere between 47-55 I would presume @JasonLiu19

RohilPatel (1535)

Yup ur right; forgot to do that command ;) @AyushGudipati

AyushGudipati (5)

@RohilPatel When do you think defense will come out?

AyushGudipati (5)

Can you tell me when the bug is fixed?

RohilPatel (1535)

In a week hopefully. U wanna play it and get pinged when it's out? @AyushGudipati

AyushGudipati (5)

@RohilPatel yeah pls. Do I need to tell you my email address? because I don't hav gmail. You could put it in a google doc and share it to [email protected] . I am 9, so I am in a school where gmail isn't allowed ) c :

AyushGudipati (5)

I just pressed 3 and got a touchdown.