# darrin k

Member

12

0 Neutral

• Rank
Member

• Interests
Programming

## Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. ## C++ c++ how to have the cpu keep choosing a play from a menu

I am trying to write a function for the CPU to keep calling a play in a do while loop (which I am assuming is correct) with a pause in between and for the menu to be brought up to the user after each selection from the playbook function that contains the playbook menu. I am not an expert with the cin operator, but my playbook function works perfectly when the user is entering the plays but the cursor hangs when it is calling the function_cpu for the cpu to make the selection. I am sure I am missing something in the code here. I put some notes in the code below.
2. ## structure of a text based football game in C++

Okay this should not be too difficult but a simple lookup table looks like the right solution. I am struggling in how to best organize the data because it seems like it would be a huge table. I have separated four tables here in the spreadsheet, where team would be the index.One table would hold the numerical ratings, one table with the distance, one table with the number of downs, and another with the playcall. To calculate every scenario between every team with each down and distance combo and playcall would be a massive table ??? Ai combo.xlsx
3. ## structure of a text based football game in C++

So, I am just trying to get on the right track, would be it just constructing an array like this below and I am not even sure if my logic is right. 1st column = 1 for Chicago Bears offense 2nd column = # of Down 3rd column = Yards to Go 4th column = team 23 --- seattle seahawks defense columns 5 through 21 would be percentages that the play would be completed based upon the bears offense ratings vs whatever defense they would face (I would have to just make up percentages?) Is this correct way to do it, I have no idea, seems inefficient with repeated values. {1,1,10,23,...................}; {1,2,10,23,...................}; {1,3,10,23,...................}; {1,4,10,23,...................}; {1,1,5,23,....................}; {1,2,5,23,....................}; {1,3,5,23,....................}; {1,4,5,23,....................}; But then yards to go could go from a theoretical range from 1-100 not discrete increments like I listed above.
4. ## structure of a text based football game in C++

1024, exactly correct...I want to first model it the way your describing to keep it simple and eventually be able to build like LorenzoGatti described on another more complex project. I am definitely not an AI expert, so I want to keep for simple for now. My main question, how do I implement a lookup table in C++. Do I have to just construct a csv excel spreadsheet with the teams and attribute ratings and percentages etc....and write a function to call it...depending on the play call??? I am trying to understand the implementation. Is there an easy way to read csv files into C++ or libraries???
5. ## structure of a text based football game in C++

With regards to data, what do you mean by that exactly? I am not following in how to implement the behavior. If I want to implement the play chosen, I figure that this will be separate from the other variables. For instance, if it is first down and 10 and I select a play action pass, how is that best implemented in the code? I figured that would remain separate from other variables such as the chances of the CPU guessing the correct play call, the chance of the actual play being completed (the longer the pass play the lower the chance of the play being completed), and the attributes/ratings for the user controlled offense and the AI controlled defense. I guess I could write functions for all this stuff or a load of switch statements, but that does seem correct like you stated and I would need to implement some randomness so it does not get too predictable.
6. ## C++ structure of a text based football game in C++

I am looking for some advice in how best to structure a text-based football game in C++. I am actually a trying to mimic an old DOS game called Armchair Quarterback but without any graphics for the time being. The original DOS game had very minimal graphics just showing a cursor moving across a static graphic (but I will leave the graphics to the end). I attached what the original game looked like below. So far, I wrote functions for the following : - for the user to select a team - for the user to select the opponent's which is always the CPU controlled - for the user to select difficulty (enum) Things left to do: Set-up one overarching team class for all the teams in the game then each specific team would inherit the attributes from the overarching team class. In the original game, each team only had four attributes that they were rated on. I would also have to construct 17 offensive plays that the user has to choose from. Would each play be a separate function??? Also, the main logic and AI would need to be constructed (would need some variables for logic and AI). -Bigger pass plays have lower % of completion than shorter pass plays -CPU is guessing what the user selects to "play" defense -The user is guessing what the CPU selects to "play" defense -This will incorporate the attribute ratings for the offense and defense per team plus randomness and the situation in the game (down and distance???) Any help would be appreciated in how the code base should be structured. Thanks! DK -