@@ -264,6 +264,25 @@ const NOUNS = [
264264 "Penguin" ,
265265] ;
266266
267+ function generateNationName ( random : PseudoRandom ) : string {
268+ const template = NAME_TEMPLATES [ random . nextInt ( 0 , NAME_TEMPLATES . length ) ] ;
269+ const noun = NOUNS [ random . nextInt ( 0 , NOUNS . length ) ] ;
270+
271+ const result : string [ ] = [ ] ;
272+
273+ for ( const part of template ) {
274+ if ( part === PLURAL_NOUN ) {
275+ result . push ( pluralize ( noun ) ) ;
276+ } else if ( part === NOUN ) {
277+ result . push ( noun ) ;
278+ } else {
279+ result . push ( part ) ;
280+ }
281+ }
282+
283+ return result . join ( " " ) ;
284+ }
285+
267286// Words from NOUNS that need irregular "-oes" plural
268287const O_TO_OES = new Set ( [ "Potato" , "Tomato" ] ) ;
269288
@@ -285,22 +304,3 @@ function pluralize(noun: string): string {
285304 }
286305 return `${ noun } s` ;
287306}
288-
289- function generateNationName ( random : PseudoRandom ) : string {
290- const template = NAME_TEMPLATES [ random . nextInt ( 0 , NAME_TEMPLATES . length ) ] ;
291- const noun = NOUNS [ random . nextInt ( 0 , NOUNS . length ) ] ;
292-
293- const result : string [ ] = [ ] ;
294-
295- for ( const part of template ) {
296- if ( part === PLURAL_NOUN ) {
297- result . push ( pluralize ( noun ) ) ;
298- } else if ( part === NOUN ) {
299- result . push ( noun ) ;
300- } else {
301- result . push ( part ) ;
302- }
303- }
304-
305- return result . join ( " " ) ;
306- }
0 commit comments