Search Results

Search found 28627 results on 1146 pages for 'case statement'.

Page 85/1146 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • Javascript : assign variable in if condition statement, good practice or not?

    - by Michael Mao
    Hi all: I moved one years ago from classic OO languages such like Java to Javascript. The following code is definitely not recommended (or even not correct) in Java: if(dayNumber = getClickedDayNumber(dayInfo)) { alert("day number found"); } function getClickedDayNumber(dayInfo) { dayNumber = dayInfo.indexOf("fc-day"); if(dayNumber != -1) //substring found { //normally any calendar month consists of "40" days, so this will definitely pick up its day number. return parseInt(dayInfo.substring(dayNumber+6, dayNumber+8)); } else return false; } Basically I just found out that I can assign a variable to a value in an if condition statement, and immediately check the assigned value as if it is boolean. For a safer bet, I usually separate that into two lines of code, assign first then check the variable, but now that I found this, I am just wondering whether is it good practice or not in the eyes of experienced javascript developers? Many thanks in advance.

    Read the article

  • PHP - Short hand if statement with a date format with weird output.

    - by McNabbToSkins
    I am using a short hand notation of an if statement to format a field. If the field is an empty string I leave it as an empty string, if not then I am trying to format it to a proper datetime format so it can be inserted into a mysql db. here is my php code $date = ($date == '') ? date("Y-m-d", strtotime($date)) : $date; for some reason when the $date string is not empty it is returning it int he format 'm/d/Y' example: 04/01/2010 When I pull the code out of the shorthand if $date = date("Y-m-d", strtotime($date)); print($date); it is formatted correctly like this 'Y-m-d' or 2010-04-01. Does anyone know why this happens? Thanks

    Read the article

  • How to insert into two different tables in one statement with Java and MySQL?

    - by MalcomTucker
    I am using Java, Spring (NamedParameterJdbcTemplate) and MySQL. My statement looks like this: INSERT INTO Table1 (Name) VALUES (?); INSERT INTO Table2 (Path, Table1Id) VALUES (?, LAST_INSERT_ID()) But it is throwing the following error: PreparedStatementCallback; bad SQL grammar [INSERT INTO Table1 (Name) VALUES (?); INSERT INTO Table2 (Path, Table1Id) VALUES (?, LAST_INSERT_ID())] ` Nested exception is: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO Table2 (Path, Table1Id' at line 1 The syntax works fine in MySQL but something is up when combining via the Spring template. Thanks!

    Read the article

  • LINQ - Select Statement - The null value cannot be assigned to a member with type System.Int32 which

    - by thiag0
    I am trying to achieve the following... _4S.NJB_Request request = (from r in db.NJB_Requests where r.RequestId == referenceId select r).Take(1).SingleOrDefault(); Getting the following exception... Message: The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type. StackTrace: at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression) at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source) at DAL.SqlDataProvider.MarkNJBPCRequestAsComplete(Int32 referenceId, Int32 processState) I have verified that 'referenceId' does have a value. Anyone know why this would happen in a select statement? Thanks!

    Read the article

  • How to retrieve MYSQL records as an INSERT statement.

    - by Aglystas
    I'm trying come up with the best method of synchronizing particular rows of 2 different database tables. So, for example there's 2 product tables in different databases as such... Origin Database product{ merchant_id, product_id, ... additional fields } Destination Database product{ merchant_id product_id ... additional fields } So, the database schema is the same for both. However I'm looking to select records with a particular merchant_id, remove all records from the destination table that have that merchant_id and replace those records with records from the origin database of the same merchant_id. My first thought was using mysqldump, parsing out the create table statements, and only running the Insert Statements. Seems like a pain though. So I was wondering if there is a better technique to do this. I would think mysql has some method of creating INSERT statements as output from a SELECT statement, so you can define how to insert specific record information into a new db. Any help would be appreciated, thank you much.

    Read the article

  • In PHP is faster to get a value from an if statement or from an array?

    - by Vittorio Vittori
    Maybe this is a stupid question but what is faster? <?php function getCss1 ($id = 0) { if ($id == 1) { return 'red'; } else if ($id == 2) { return 'yellow'; } else if ($id == 3) { return 'green'; } else if ($id == 4) { return 'blue'; } else if ($id == 5) { return 'orange'; } else { return 'grey'; } } function getCss2 ($id = 0) { $css[] = 'grey'; $css[] = 'red'; $css[] = 'yellow'; $css[] = 'green'; $css[] = 'blue'; $css[] = 'orange'; return $css[$id]; } echo getCss1(3); echo getCss2(3); ?> I suspect is faster the if statement but I prefere to ask!

    Read the article

  • Optimizing MySQL statement with lot of count(row) an sum(row+row2)...

    - by Zombies
    I need to use InnoDB storage engine on a table with about 1mil or so records in it at any given time. It has records being inserted to it at a very fast rate, which are then dropped within a few days, maybe a week. The ping table has about a million rows, whereas the website table only about 10,000. My statement is this: select url from website ws, ping pi where ws.idproxy = pi.idproxy and pi.entrytime > curdate() - 3 and contentping+tcpping is not null group by url having sum(contentping+tcpping)/(count(*)-count(errortype)) < 500 and count(*) > 3 and count(errortype)/count(*) < .15 order by sum(contentping+tcpping)/(count(*)-count(errortype)) asc; I added an index on entrytime, yet no dice. Can anyone throw me a bone as to what I should consider to look into for basic optimization of this query. The result set is only like 200 rows, so I'm not getting killed there.

    Read the article

  • Need to speed up the results of this SQL statement. Any advice?

    - by jeffself
    I've got the following SQL Statement that needs some major speed up. The problem is I need to search on two fields, where each of them is calling several sub-selects. Is there a way to join the two fields together so I call the sub-selects only once? SELECT billyr, billno, propacct, vinid, taxpaid, duedate, datepif, propdesc FROM trcdba.billspaid WHERE date(datepif) > '01/06/2009' AND date(datepif) <= '01/06/2010' AND custno in (select custno from cwdba.txpytaxid where taxpayerno in (select taxpayerno from cwdba.txpyaccts where accountno in (select accountno from rtadba.reasacct where controlno = 1234567))) OR custno2 in (select custno from cwdba.txpytaxid where taxpayerno in (select taxpayerno from cwdba.txpyaccts where accountno in (select accountno from rtadba.reasacct where controlno = 1234567)))

    Read the article

  • How do I translate a List<string> into a SqlParameter for a Sql In statement?

    - by KallDrexx
    I seem to be confused on how to perform an In statement with a SqlParameter. So far I have the following code: cmd.CommandText = "Select dscr from system_settings where setting in @settings"; cmd.Connection = conn; cmd.Parameters.Add(new SqlParameter("@settings", settingList)); reader = cmd.ExecuteReader(); settingsList is a List<string>. When cmd.ExecuteReader() is called, I get an ArgumentException due to not being able to map a List<string> to "a known provider type". How do I (safely) perform an In query with SqlCommands?

    Read the article

  • How would make this run with an if statement and one for loop?

    - by Nick Jacobs
    I'm trying to get this to run by using an if statment, a for loop, and a list. The list is part of the parameters. I am not sure how to write the if statement and have the program loop through all of the different words and set everything how it is supposed to be. newSndIdx=0; for i in range (8700, 12600+1): sampleValue=getSampleValueAt(sound, i) setSampleValueAt(newSnd, newSndIdx, sampleValue) newSndIdx +=1 newSndIdx=newSndIdx+500 for i in range (15700, 17600+1): sampleValue=getSampleValueAt(sound, i) setSampleValueAt(newSnd, newSndIdx, sampleValue) newSndIdx +=1 newSndIdx=newSndIdx+500 for i in range (18750, 22350+1): sampleValue=getSampleValueAt(sound, i) setSampleValueAt(newSnd, newSndIdx, sampleValue) newSndIdx +=1 newSndIdx=newSndIdx+500 for i in range (23700, 27250+1): sampleValue=getSampleValueAt(sound, i) setSampleValueAt(newSnd, newSndIdx, sampleValue) newSndIdx +=1 newSndIdx=newSndIdx+500 for i in range (106950, 115300+1): sampleValue=getSampleValueAt(sound, i) setSampleValueAt(newSnd, newSndIdx, sampleValue) newSndIdx+=1

    Read the article

  • Can I use a MySQL PREPARE statement in a function to create a query with a variable table name

    - by aHunter
    I want to create a function that has a select query inside that can be used against multiple database tables but I can not use a variable as the table name. Can I get around this using a PREPARE statement in the function? An Example: FUNCTION `TESTFUNC`(dbTable VARCHAR(25)) RETURNS bigint(20) BEGIN DECLARE datereg DATETIME; DECLARE stmt VARCHAR(255); SET stmt := concat( 'SELECT dateT FROM', dbTable, 'ORDER BY dateT DESC LIMIT 1'); PREPARE stmt FROM @stmt; EXECUTE stmt; RETURN dateT; END $$ Thanks in advance for any input.

    Read the article

  • Mysql: how to generate count table by PATTERN / LIKE statement ? very tricky

    - by Abdulrahman Al-Qabandi
    to simplify, I got a database of registered users, I want to count how many emails there are for each email domain name (note I do not know all domain names) for example, Users table- id | email ------------------ 1 | [email protected] 2 | [email protected]<--unknown to me 3 | [email protected]<--unknown to me 4 | [email protected] 5 | [email protected]<--unknown to me 6 | [email protected] 7 | [email protected] 8 | [email protected] ( note: I want to count each email without specifying which email exactly ) so the result I want is suffix | count hotmail.com | 3 somesite.aaa | 2 unknownsite.aaa| 1 yahoo.com | 2 again, I stress this, I do not know unknownsite.aaa nor can i mention it in a statement because it is unknown to me, i hope I am clear. So essentially I want to make a statistic of what my website users use as an email host website. but like I said and I will repeat the third time, I do not know every mailhost that exists. I am going to investigate this more, I have a feeling this is something mysql cannot handle.

    Read the article

  • Is it inefficient to access a python class member container in a loop statement?

    - by Dave
    Hi there. I'm trying to adopt some best practices to keep my python code efficient. I've heard that accessing a member variable inside of a loop can incur a dictionary lookup for every iteration of the loop, so I cache these in local variables to use inside the loop. My question is about the loop statement itself... if I have the following class: class A(object): def init(self) self.myList = [ 'a','b','c', 'd', 'e' ] Does the following code in a member function incur one, or one-per-loop-iteration (5) dictionary lookups? for letter in self.myList: print letter IE, should I adopt the following pattern, if I am concerned about efficiency... localList = self.myList for letter in localList: print letter or is that actually LESS efficient due to the local variable assign? Note, I am aware that early optimization is a dangerous pitfall if I'm concerned about the overall efficiency of code development. Here I am specifically asking about the efficiency of the code, not the coding. Thanks in advance! D

    Read the article

  • How can I create a boolean in the `if` statement within the for loop to check for existence of term prepended to filename %%f?

    - by user784637
    I have lyrics for about 60% of my song collection. The filename of the lyrics is the same as the file name of song with zzz_ prepended to the filename and .lrc as the extension. C:\Songs\album\song.mp3 C:\Songs\album\zzz_song.lrc I currently print the file names like so for /r "C:\Songs" %%f in (*.mp3 *.flac) do ( echo %%f ) How can I create a boolean in the if statement within the for loop as a check on the existence of lyrics files? I was thinking something like if exist zzz_%f echo zzz_%f.lrc but zzz_%f prepends zzz_ to the full file path (ex. zzz_C:\Songs\album\song.mp3) and .lrc is appended to the existing extension

    Read the article

  • Return cell reference as result of if statement with vlookups.

    - by EMJ
    I have two sets of data in excel. One contains a set of data which represents the initial step of a process. The other set of data represents the additional steps which take place after the first step is completed. Each of the data records in the "additional step data" has an id in a column. I need to find the identifying codes of the "additional step data" which correspond with the initial step data records. The problem is that I have to match the data in 4 columns between the two data sets and return the id of the "additional step data". I started by doing a combination of an if and vlookup functions, but I got stuck when I tried to figure out how to get the if statement to reference the id of the matching "additional step data". Basically I am trying to avoid having to search by manually filtering between two sets of data and finding corresponding records. Does anyone have any idea about how to do this?

    Read the article

  • If the "with" statement in Javascript creates a new scope, why does the following code not work as e

    - by Jian Lin
    If the "with" statement in Javascript creates a new scope, shouldn't clicking on the links show a different x which are in different scopes? It doesn't. <a href="#" id="link1">ha link 1</a> <a href="#" id="link2">ha link 2</a> <a href="#" id="link3">ha link 3</a> <a href="#" id="link4">ha link 4</a> <a href="#" id="link5">ha link 5</a> <script type="text/javascript"> for (i = 1; i <= 5; i++) { with({foo:"bar"}) { var x = i; document.getElementById('link' + i).onclick = function() { alert(x); return false; } } } </script>

    Read the article

  • How do I get this php statement that gets all the values from database and outputs as checkboxes to

    - by ggfan
    I am a bit lost in all these "" and '' and . in this statement. Basically this query is to get all the tagname from table "tag" and display them for the users as checkboxes. If they have clicked 'submit' and they missed another field(say the title of a post), it would still have the tag they chose displayed. The part I need help with is the echoing part. It doesn't seem to remember the tag when they click submit. $query4 = "SELECT * FROM tags ORDER BY tagname"; $data4 = mysqli_query($dbc, $query4); while ($row4 = mysqli_fetch_array($data4)) { echo "<li><input type='checkbox' name='postingtag[]'"; if (!empty($postingtag)){ echo "value='$postingtag'"; } else{ echo "value='{$row4['tagID']}'"; } echo ">{$row4['tagname']}</li>"; }

    Read the article

  • Subprocess statement works in python console but not work in Serverdensity plugin?

    - by maxigs
    in the python console the following statement works perfectly fine (i guess using eval that way is not really good, but its just for testing purpose in this case and will be replaced with proper parsing) $ python >>> import subprocess >>> r = subprocess.Popen(['/home/kupferwerk/sd-agent-plugins/plugin1.rb'], stdout=subprocess.PIPE, close_fds=True).communicate()[0] >>> data = eval(r) >>> data {'test': 1} when i convert this into a Serverdensity plugin however it keeps crashing the agent.py daemon everytime it executes the plugin. i was able to narrow it down to the subprocess line but could not find out why. exception catching did not seem to work also. here how the plugin looks like: class plugin1: def run(self): r = subprocess.Popen(['/pathto/plugin1.rb'], stdout=subprocess.PIPE, close_fds=True).communicate()[0] data = eval(r) return data I'm quite new to work with python and cant really figure out why this wont work. Thanks a lot for ideas :)

    Read the article

  • What happens if you break out of a Lock() statement?

    - by cyclotis04
    I'm writing a program which listens to an incoming TcpClient and handles data when it arrives. The Listen() method is run on a separate thread within the component, so it needs to be threadsafe. If I break out of a do while loop while I'm within a lock() statement, will the lock be released? If not, how do I accomplish this? Thanks! (Any other advice on the subject of Asynchronous TCP Sockets is welcome as well.) private void Listen() { do { lock (_client) { if (!_client.Connected) break; lock (_stateLock) { if (!_listening) break; if (_client.GetStream().DataAvailable) HandleData(); } } Thread.Sleep(0); } while (true); }

    Read the article

  • When debugging in VS 2008 why does the debugger land on a second return statement?

    - by Hellfire
    When debugging the following console program: class Program { static void Main(string[] args) { Console.WriteLine(DoIt(false)); Console.WriteLine(DoIt(true)); } private static Boolean DoIt(Boolean abort) { try { throw new InvalidOperationException(); } catch(Exception ex) { if (abort) { return true; } Console.WriteLine("Got here"); return false; } } } Why does the IDE land on the second return statement during the second call to DoIt()? The results of the execution is correct but the debugging experience is misleading. Is this a known issue? Is the behavior in VS 2010 the same?

    Read the article

  • How do I specify a wildcard (for ANY character) in a c# regex statement?

    - by Scott
    Trying to use a wildcard in C# to grab information from a webpage source, but I cannot seem to figure out what to use as the wildcard character. Nothing I've tried works! The wildcard only needs to allow for numbers, but as the page is generated the same every time, I may as well allow for any characters. Regex statement in use: Regex guestbookWidgetIDregex = new Regex("GuestbookWidget(' INSERT WILDCARD HERE ', '(.*?)', 500);", RegexOptions.IgnoreCase); If anyone can figure out what I'm doing wrong, it would be greatly appreciated!

    Read the article

  • C++ MFC how to compare LPCTSTR in a if statement?

    - by user1078510
    I have the following code: LPCTSTR strPermission = Method(); if (strPermission == L"0") { return true; } else { return false; } While debugging I can see that strPermission does equal "0", yet when I compare it like in the if statement it always returns false. The only thing I can think of is that it is comparing the memory address of the variable rather than the variable value. How do I compare strPermission to L"0" so that it would return true if strPermission equals "0". Thank you!

    Read the article

  • How can I update a column in a table with the result of a select statement that uses row being updat

    - by Sailing Judo
    This SQL statement example is very close to what I think I need... update table1 set value1 = x.value1 from (select value1, code from table2 where code = something) as x However, what I need to do is change the "something" in the above example to a value from the row that is being updated. For example, I tried this but it didn't work: update table1 A set value1 = x.value1 from (select value1, code from table2 where code = A.something) as x This is a one time operation to update an existing table and I'm not really looking for high performance way to do this. Any solution that gets the task done is good enough.

    Read the article

  • Level of detail algorithm not functioning correctly

    - by Darestium
    I have been working on this problem for months; I have been creating Planet Generator of sorts, after more than 6 months of work I am no closer to finishing it then I was 4 months ago. My problem; The terrain does not subdivide in the correct locations properly, it almost seems as if there is a ghost camera next to me, and the quads subdivide based on the position of this "ghost camera". Here is a video of the broken program: http://www.youtube.com/watch?v=NF_pHeMOju8 The best example of the problem occurs around 0:36. For detail limiting, I am going for a chunked LOD approach, which subdivides the terrain based on how far you are away from it. I use a "depth table" to determine how many subdivisions should take place. void PQuad::construct_depth_table(float distance) { tree[0] = -1; for (int i = 1; i < MAX_DEPTH; i++) { tree[i] = distance; distance /= 2.0f; } } The chuncked LOD relies on the child/parent structure of quads, the depth is determined by a constant e.g: if the constant is 6, there are six levels of detail. The quads which should be drawn go through a distance test from the player to the centre of the quad. void PQuad::get_recursive(glm::vec3 player_pos, std::vector<PQuad*>& out_children) { for (size_t i = 0; i < children.size(); i++) { children[i].get_recursive(player_pos, out_children); } if (this->should_draw(player_pos) || this->depth == 0) { out_children.emplace_back(this); } } bool PQuad::should_draw(glm::vec3 player_position) { float distance = distance3(player_position, centre); if (distance < tree[depth]) { return true; } return false; } The root quad has four children which could be visualized like the following: [] [] [] [] Where each [] is a child. Each child has the same amount of children up until the detail limit, the quads which have are 6 iterations deep are leaf nodes, these nodes have no children. Each node has a corresponding Mesh, each Mesh structure has 16x16 Quad-shapes, each Mesh's Quad-shapes halves in size each detail level deeper - creating more detail. void PQuad::construct_children() { // Calculate the position of the Quad based on the parent's location calculate_position(); if (depth < (int)MAX_DEPTH) { children.reserve((int)NUM_OF_CHILDREN); for (int i = 0; i < (int)NUM_OF_CHILDREN; i++) { children.emplace_back(PQuad(this->face_direction, this->radius)); PQuad *child = &children.back(); child->set_depth(depth + 1); child->set_child_index(i); child->set_parent(this); child->construct_children(); } } else { leaf = true; } } The following function creates the vertices for each quad, I feel that it may play a role in the problem - I just can't determine what is causing the problem. void PQuad::construct_vertices(std::vector<glm::vec3> *vertices, std::vector<Color3> *colors) { vertices->reserve(quad_width * quad_height); for (int y = 0; y < quad_height; y++) { for (int x = 0; x < quad_width; x++) { switch (face_direction) { case YIncreasing: vertices->emplace_back(glm::vec3(position.x + x * element_width, quad_height - 1.0f, -(position.y + y * element_width))); break; case YDecreasing: vertices->emplace_back(glm::vec3(position.x + x * element_width, 0.0f, -(position.y + y * element_width))); break; case XIncreasing: vertices->emplace_back(glm::vec3(quad_width - 1.0f, position.y + y * element_width, -(position.x + x * element_width))); break; case XDecreasing: vertices->emplace_back(glm::vec3(0.0f, position.y + y * element_width, -(position.x + x * element_width))); break; case ZIncreasing: vertices->emplace_back(glm::vec3(position.x + x * element_width, position.y + y * element_width, 0.0f)); break; case ZDecreasing: vertices->emplace_back(glm::vec3(position.x + x * element_width, position.y + y * element_width, -(quad_width - 1.0f))); break; } // Position the bottom, right, front vertex of the cube from being (0,0,0) to (-16, -16, 16) (*vertices)[vertices->size() - 1] -= glm::vec3(quad_width / 2.0f, quad_width / 2.0f, -(quad_width / 2.0f)); colors->emplace_back(Color3(255.0f, 255.0f, 255.0f, false)); } } switch (face_direction) { case YIncreasing: this->centre = glm::vec3(position.x + quad_width / 2.0f, quad_height - 1.0f, -(position.y + quad_height / 2.0f)); break; case YDecreasing: this->centre = glm::vec3(position.x + quad_width / 2.0f, 0.0f, -(position.y + quad_height / 2.0f)); break; case XIncreasing: this->centre = glm::vec3(quad_width - 1.0f, position.y + quad_height / 2.0f, -(position.x + quad_width / 2.0f)); break; case XDecreasing: this->centre = glm::vec3(0.0f, position.y + quad_height / 2.0f, -(position.x + quad_width / 2.0f)); break; case ZIncreasing: this->centre = glm::vec3(position.x + quad_width / 2.0f, position.y + quad_height / 2.0f, 0.0f); break; case ZDecreasing: this->centre = glm::vec3(position.x + quad_width / 2.0f, position.y + quad_height / 2.0f, -(quad_height - 1.0f)); break; } this->centre -= glm::vec3(quad_width / 2.0f, quad_width / 2.0f, -(quad_width / 2.0f)); } Any help in discovering what is causing this "subdivding in the wrong place" would be greatly appreciated.

    Read the article

  • How should I structure my turn based engine to allow flexibility for players/AI and observation?

    - by Reefpirate
    I've just started making a Turn Based Strategy engine in GameMaker's GML language... And I was cruising along nicely until it came time to handle the turn cycle, and determining who is controlling what player, and also how to handle the camera and what is displayed on screen. Here's an outline of the main switch happening in my main game loop at the moment: switch (GameState) { case BEGIN_TURN: // Start of turn operations/routines break; case MID_TURN: switch (PControlledBy[Turn]) { case HUMAN: switch (MidTurnState) { case MT_SELECT: // No units selected, 'idle' UI state break; case MT_MOVE: // Unit selected and attempting to move break; case MT_ATTACK: break; } break; case COMPUTER: // AI ROUTINES GO HERE break; case OBSERVER: // OBSERVER ROUTINES GO HERE break; } break; case END_TURN: // End of turn routines/operations, and move Turn to next player break; } Now, I can see a couple of problems with this set-up already... But I don't have any idea how to go about making it 'right'. Turn is a global variable that stores which player's turn it is, and the BEGIN_TURN and END_TURN states make perfect sense to me... But the MID_TURN state is baffling me because of the things I want to happen here: If there are players controlled by humans, I want the AI to do it's thing on its turn here, but I want to be able to have the camera follow the AI as it makes moves in the human player's vision. If there are no human controlled player's, I'd like to be able to watch two or more AI's battle it out on the map with god-like 'observer' vision. So basically I'm wondering if there are any resources for how to structure a Turn Based Strategy engine? I've found lots of writing about pathfinding and AI, and those are all great... But when it comes to handling the turn structure and the game states I am having trouble finding any resources at all. How should the states be divided to allow flexibility between the players and the controllers (HUMAN, COMPUTER, OBSERVER)? Also, maybe if I'm on the right track I just need some reassurance before I lay down another few hundred lines of code...

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >